[PATCH] D28369: Refactor inline threshold update code. NFC.
Easwaran Raman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 10:59:15 PST 2017
eraman created this revision.
eraman added reviewers: chandlerc, davidxl.
eraman added a subscriber: llvm-commits.
https://reviews.llvm.org/D28369
Files:
lib/Analysis/InlineCost.cpp
Index: lib/Analysis/InlineCost.cpp
===================================================================
--- lib/Analysis/InlineCost.cpp
+++ lib/Analysis/InlineCost.cpp
@@ -636,25 +636,29 @@
else if (Caller->optForSize())
Threshold = MinIfValid(Threshold, Params.OptSizeThreshold);
- bool HotCallsite = false;
- uint64_t TotalWeight;
- if (PSI && CS.getInstruction()->extractProfTotalWeight(TotalWeight) &&
- PSI->isHotCount(TotalWeight)) {
- HotCallsite = true;
+ bool HotCallee = false, ColdCallee = false, HotCallsite = false;
+ if (PSI) {
+ uint64_t TotalWeight;
+ if (CS.getInstruction()->extractProfTotalWeight(TotalWeight) &&
+ PSI->isHotCount(TotalWeight))
+ HotCallsite = true;
+ // If callsite hotness can not be determined, check if callee is hot.
+ else if (PSI->isFunctionEntryHot(&Callee))
+ HotCallee = true;
+ else if (PSI->isFunctionEntryCold(&Callee))
+ ColdCallee = true;
}
// Listen to the inlinehint attribute or profile based hotness information
// when it would increase the threshold and the caller does not need to
// minimize its size.
- bool InlineHint = Callee.hasFnAttribute(Attribute::InlineHint) ||
- (PSI && PSI->isFunctionEntryHot(&Callee));
- if (InlineHint && !Caller->optForMinSize())
- Threshold = MaxIfValid(Threshold, Params.HintThreshold);
-
- if (HotCallsite && !Caller->optForMinSize())
- Threshold = MaxIfValid(Threshold, Params.HotCallSiteThreshold);
+ if (!Caller->optForMinSize()) {
+ if (Callee.hasFnAttribute(Attribute::InlineHint) || HotCallee)
+ Threshold = MaxIfValid(Threshold, Params.HintThreshold);
+ if (HotCallsite)
+ Threshold = MaxIfValid(Threshold, Params.HotCallSiteThreshold);
+ }
- bool ColdCallee = PSI && PSI->isFunctionEntryCold(&Callee);
// For cold callees, use the ColdThreshold knob if it is available and reduces
// the threshold.
if (ColdCallee)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28369.83275.patch
Type: text/x-patch
Size: 1947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170105/e789248a/attachment.bin>
More information about the llvm-commits
mailing list