[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 12:52:45 PDT 2021
wenlei updated this revision to Diff 333400.
wenlei added a comment.
update
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.333400.patch
Type: text/x-patch
Size: 1139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210325/70e419fb/attachment.bin>
More information about the llvm-commits
mailing list