[PATCH] D122844: [llvm-profgen] Fixing a context attribure update issue due to a non-derministic processing order on different platforms.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 17:31:39 PDT 2022
hoy updated this revision to Diff 419590.
hoy added a comment.
Updating D122844 <https://reviews.llvm.org/D122844>: [llvm-profgen] Fixing a context attribure update issue due to a non-derministic processing order on different platforms.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122844/new/
https://reviews.llvm.org/D122844
Files:
llvm/tools/llvm-profgen/ProfileGenerator.cpp
Index: llvm/tools/llvm-profgen/ProfileGenerator.cpp
===================================================================
--- llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -712,7 +712,21 @@
FunctionSamples &FProfile = Ret.first->second;
FProfile.setContext(FContext);
return Ret.first->second;
+ } else {
+ // Update ContextWasInlined attribute for existing contexts.
+ // The current function can be called in two ways:
+ // - when processing a probe of the current frame
+ // - when processing the entry probe of an inlinee's frame, which
+ // is then used to update the callsite count of the current frame.
+ // The two can happen in any order, hence here we are making sure
+ // `ContextWasInlined` is always set as expected.
+ // TODO: Note that the former does not always happen if no probes of the
+ // current frame has samples, and if the latter happens, we could lose the
+ // attribute. This should be fixed.
+ if (WasLeafInlined)
+ I->second.getContext().setAttribute(ContextWasInlined);
}
+
return I->second;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122844.419590.patch
Type: text/x-patch
Size: 1141 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220401/2b295586/attachment.bin>
More information about the llvm-commits
mailing list