aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-06-12 11:22:49 -0700
committerGitHub <noreply@github.com>2024-06-12 11:22:49 -0700
commit31440738bd6b1345ea978914fe01d2e19f4aa373 (patch)
tree86b15cd94d9c629d3fb8590b78dd6ca8ffa06587 /clang/lib/Frontend/InitPreprocessor.cpp
parentaf0d7128c8fd053d3de8af208d7d1682bc7a525a (diff)
downloadllvm-31440738bd6b1345ea978914fe01d2e19f4aa373.zip
llvm-31440738bd6b1345ea978914fe01d2e19f4aa373.tar.gz
llvm-31440738bd6b1345ea978914fe01d2e19f4aa373.tar.bz2
[ProfileData] Use std::vector for ValueData (NFC) (#95194)
This patch changes the type of ValueData to std::vector<InstrProfValueData> so that, in a follow-up patch, we can teach getValueForSite to return ArrayRef<InstrProfValueData>. Currently, a typical traversal over the value data looks like: uint32_t NV = Func.getNumValueDataForSite(VK, I); std::unique_ptr<InstrProfValueData[]> VD = Func.getValueForSite(VK, I); for (uint32_t V = 0; V < NV; V++) Do something with VD[V].Value and/or VD[V].Count; Note that we need to call getNumValueDataForSite and getValueForSite separately. If getValueForSite returns ArrayRef<InstrProfValueData> in the future, then we'll be able to do something like: for (const auto &V : Func.getValueForSite(VK, I)) Do something with V.Value and/or V.Count; If ArrayRef<InstrProfValueData> directly points to ValueData, then getValueForSite won't need to allocate memory with std::make_unique. Now, switching to std::vector requires us to update several places: - sortByTargetValues switches to llvm::sort because we don't need to worry about sort stability. - sortByCount retains sort stability because std::list::sort also performs stable sort. - merge builds another array and move it back to ValueData to avoid a potential quadratic behavior with std::vector::insert into the middle of a vector.
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions