[PATCH] D158689: Fix dangling reference after D147740
William Junda Huang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 23 18:22:31 PDT 2023
huangjd created this revision.
Herald added a subscriber: wenlei.
Herald added a project: All.
huangjd requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158689
Files:
llvm/include/llvm/ProfileData/SampleProf.h
Index: llvm/include/llvm/ProfileData/SampleProf.h
===================================================================
--- llvm/include/llvm/ProfileData/SampleProf.h
+++ llvm/include/llvm/ProfileData/SampleProf.h
@@ -1603,10 +1603,22 @@
? TotalSamples - CalleeProfile.getTotalSamples()
: 0;
TotalSamples += CalleeProfile.getHeadSamplesEstimate();
+
+ }
+ }
+
+ // FlattenNestedProfile adds new FunctionSamples to the output, which may
+ // invalidate the reference Profile, so it needs to be reset after all
+ // flattening.
+ for (const auto &I : FS.getCallsiteSamples()) {
+ for (const auto &Callee : I.second) {
+ const auto &CalleeProfile = Callee.second;
// Recursively convert callee profile.
flattenNestedProfile(OutputProfiles, CalleeProfile);
}
}
+ Profile = OutputProfiles[Context];
+
Profile.addTotalSamples(TotalSamples);
Profile.setHeadSamples(Profile.getHeadSamplesEstimate());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158689.552942.patch
Type: text/x-patch
Size: 1033 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230824/4369f890/attachment.bin>
More information about the llvm-commits
mailing list