[PATCH] D122844: [llvm-profgen] Fixing a context attribure update issue due to a non-derministic processing order on different platforms.

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 13:50:44 PDT 2022


wenlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:729
+    if (WasLeafInlined)
+      FProfile.getContext().setAttribute(ContextWasInlined);
   }
----------------
hoy wrote:
> wenlei wrote:
> > This fix assumes that the 1st is always going to be called for given context, and it's just a matter of order. Is that actually true?
> > 
> > What is the exact call path for both cases?  
> Yes. Since we go through the lbr samples in an unorderd way (see CSProfileGenerator::populateBodySamplesWithProbes, `ProbeCounter` is an unordered_map), #1 and #2 can be called in arbitrary order on different platforms. If #1 is called before #2, the context will have the correct attribute set even without this fix. On the contrary, we need the fix for #1 to update already existing context.
Sorry if the question wasn't clear, and not sure if you answered the question:

 - 1st is always going to be called for given context? asking because if in some cases we only call 2nd, then the flag will be missing despite being deterministic. 
 - What is the exact call path for both cases?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122844/new/

https://reviews.llvm.org/D122844



More information about the llvm-commits mailing list