<div dir="ltr">This seems to be causing a new warning: <div><br></div><div><div>...llvm/lib/Analysis/InlineCost.cpp:648:5: warning: add explicit braces to avoid dangling else [-Wdangling-else]</div><div> else if (PSI->isColdCount(TotalWeight))</div><div> ^</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 5, 2016 at 1:28 PM, Dehao Chen via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dehao<br>
Date: Fri Aug 5 15:28:41 2016<br>
New Revision: 277860<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=277860&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=277860&view=rev</a><br>
Log:<br>
Replace hot-callsite based heuristic to use its own threshold parameter instead of share inline-hint parameter<br>
<br>
Summary: Hot callsites should have higher threshold than inline hints. This patch uses separate threshold parameter for hot callsites.<br>
<br>
Reviewers: davidxl, eraman<br>
<br>
Subscribers: Prazek, llvm-commits<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D22368" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D22368</a><br>
<br>
Modified:<br>
llvm/trunk/lib/Analysis/<wbr>InlineCost.cpp<br>
llvm/trunk/test/Transforms/<wbr>Inline/inline-hot-callsite.ll<br>
<br>
Modified: llvm/trunk/lib/Analysis/<wbr>InlineCost.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=277860&r1=277859&r2=277860&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Analysis/InlineCost.cpp?rev=<wbr>277860&r1=277859&r2=277860&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Analysis/<wbr>InlineCost.cpp (original)<br>
+++ llvm/trunk/lib/Analysis/<wbr>InlineCost.cpp Fri Aug 5 15:28:41 2016<br>
@@ -66,6 +66,11 @@ static cl::opt<int> ColdThreshold(<br>
"inlinecold-threshold", cl::Hidden, cl::init(225),<br>
cl::desc("Threshold for inlining functions with cold attribute"));<br>
<br>
+static cl::opt<int><br>
+ HotCallSiteThreshold("hot-<wbr>callsite-threshold", cl::Hidden, cl::init(3000),<br>
+ cl::ZeroOrMore,<br>
+ cl::desc("Threshold for hot callsites "));<br>
+<br>
namespace {<br>
<br>
class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {<br>
@@ -635,27 +640,33 @@ void CallAnalyzer::updateThreshold(<wbr>CallS<br>
}<br>
<br>
bool HotCallsite = false;<br>
+ bool ColdCallsite = false;<br>
uint64_t TotalWeight;<br>
- if (CS.getInstruction()-><wbr>extractProfTotalWeight(<wbr>TotalWeight) &&<br>
- PSI->isHotCount(TotalWeight))<br>
- HotCallsite = true;<br>
+ if (CS.getInstruction()-><wbr>extractProfTotalWeight(<wbr>TotalWeight))<br>
+ if (PSI->isHotCount(TotalWeight))<br>
+ HotCallsite = true;<br>
+ else if (PSI->isColdCount(TotalWeight)<wbr>)<br>
+ ColdCallsite = true;<br>
<br>
// Listen to the inlinehint attribute or profile based hotness information<br>
// when it would increase the threshold and the caller does not need to<br>
// minimize its size.<br>
bool InlineHint = Callee.hasFnAttribute(<wbr>Attribute::InlineHint) ||<br>
- PSI->isHotFunction(&Callee) ||<br>
- HotCallsite;<br>
+ PSI->isHotFunction(&Callee);<br>
if (InlineHint && HintThreshold > Threshold && !Caller->optForMinSize())<br>
Threshold = HintThreshold;<br>
<br>
+ if (HotCallsite && HotCallSiteThreshold > Threshold &&<br>
+ !Caller->optForMinSize())<br>
+ Threshold = HotCallSiteThreshold;<br>
+<br>
bool ColdCallee = PSI->isColdFunction(&Callee);<br>
// Command line argument for DefaultInlineThreshold will override the default<br>
// ColdThreshold. If we have -inline-threshold but no -inlinecold-threshold,<br>
// do not use the default cold threshold even if it is smaller.<br>
if ((DefaultInlineThreshold.<wbr>getNumOccurrences() == 0 ||<br>
ColdThreshold.<wbr>getNumOccurrences() > 0) &&<br>
- ColdCallee && ColdThreshold < Threshold)<br>
+ (ColdCallee || ColdCallsite) && ColdThreshold < Threshold)<br>
Threshold = ColdThreshold;<br>
<br>
// Finally, take the target-specific inlining threshold multiplier into<br>
<br>
Modified: llvm/trunk/test/Transforms/<wbr>Inline/inline-hot-callsite.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/inline-hot-callsite.ll?rev=277860&r1=277859&r2=277860&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/test/<wbr>Transforms/Inline/inline-hot-<wbr>callsite.ll?rev=277860&r1=<wbr>277859&r2=277860&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/Transforms/<wbr>Inline/inline-hot-callsite.ll (original)<br>
+++ llvm/trunk/test/Transforms/<wbr>Inline/inline-hot-callsite.ll Fri Aug 5 15:28:41 2016<br>
@@ -1,4 +1,4 @@<br>
-; RUN: opt < %s -inline -inline-threshold=0 -inlinehint-threshold=100 -S | FileCheck %s<br>
+; RUN: opt < %s -inline -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s<br>
<br>
; This tests that a hot callsite gets the (higher) inlinehint-threshold even without<br>
; without inline hints and gets inlined because the cost is less than<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>