[llvm] [llvm-profgen] Set ContextWasInlined for probeless nodes (PR #191600)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 11:55:48 PDT 2026
================
@@ -1412,6 +1405,22 @@ ContextTrieNode *CSProfileGenerator::getContextNodeForLeafProbe(
ContextTrieNode *ContextNode =
getOrCreateContextNode(NewContextStack, WasLeafInlined);
ContextNode->getFunctionSamples()->setFunctionHash(FuncDesc->FuncHash);
+
+ // Mark all intermediate inline frames as inlined on the trie node. Walk up
+ // the probe inline tree (which tells us which functions were inlined) and
+ // set the flag on corresponding trie nodes. This information is used later
+ // when creating FunctionSamples (e.g. for probeless nodes) to set
+ // ContextWasInlined.
+ ContextTrieNode *CurNode = ContextNode;
+ auto *InlineTreeNode = LeafProbe->getInlineTreeNode();
+ while (InlineTreeNode->hasInlineSite() && CurNode &&
+ CurNode != &ContextTracker.getRootContext()) {
----------------
HighW4y2H3ll wrote:
Can we embed this in `Binary->getInlineContextForProbe` instead? or just travesing from the `NewContextStack` backward? so we don't redo the inline tree iteration a second time here...
https://github.com/llvm/llvm-project/pull/191600
More information about the llvm-commits
mailing list