[PATCH] D99370: [CSSPGO] Minor tweak for inline candidate priority tie breaker
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 25 21:28:54 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5f59f407f59f: [CSSPGO] Minor tweak for inline candidate priority tie breaker (authored by wenlei).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99370/new/
https://reviews.llvm.org/D99370
Files:
llvm/lib/Transforms/IPO/SampleProfile.cpp
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -321,11 +321,16 @@
if (LHS.CallsiteCount != RHS.CallsiteCount)
return LHS.CallsiteCount < RHS.CallsiteCount;
+ const FunctionSamples *LCS = LHS.CalleeSamples;
+ const FunctionSamples *RCS = RHS.CalleeSamples;
+ assert(LCS && RCS && "Expect non-null FunctionSamples");
+
+ // Tie breaker using number of samples try to favor smaller functions first
+ if (LCS->getBodySamples().size() != RCS->getBodySamples().size())
+ return LCS->getBodySamples().size() > RCS->getBodySamples().size();
+
// Tie breaker using GUID so we have stable/deterministic inlining order
- assert(LHS.CalleeSamples && RHS.CalleeSamples &&
- "Expect non-null FunctionSamples");
- return LHS.CalleeSamples->getGUID(LHS.CalleeSamples->getName()) <
- RHS.CalleeSamples->getGUID(RHS.CalleeSamples->getName());
+ return LCS->getGUID(LCS->getName()) < RCS->getGUID(RCS->getName());
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99370.333492.patch
Type: text/x-patch
Size: 1139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210326/2f37ab55/attachment.bin>
More information about the llvm-commits
mailing list