<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 7/2/2018 10:29 PM, Zhang via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:tencent_5AACEF612ECDC35D28487542@qq.com">
<div>
<div style="font-family: "lucida Grande", Verdana;">Hi
John.</div>
<div style="font-family: "lucida Grande", Verdana;">Thanks
for the info. Currently I'm marking fooo() by hand by adding
the always_inline attribute then run the always inline pass
using the following code:</div>
<div style="font-family: "lucida Grande", Verdana;"><br>
</div>
<div style="font-family: "lucida Grande", Verdana;">```</div>
<div style="font-family: "lucida Grande", Verdana;">
<div>AnalysisManager<Module> AM;</div>
<div>AlwaysInlinerPass*
InlinerPass=cast<AlwaysInlinerPass>(createAlwaysInlinerLegacyPass());</div>
<div>InlinerPass->run(M,AM);</div>
<div>delete InlinerPass;</div>
</div>
<div style="font-family: "lucida Grande", Verdana;">```</div>
<div style="font-family: "lucida Grande", Verdana;">However
the CallSites are not inlined. </div>
<div style="font-family: "lucida Grande", Verdana;">Reading
lib/Transforms/IPO/AlwaysInliner.cpp , it says ``<span
style="caret-color: rgb(36, 41, 46); color: rgb(36, 41,
46);"> </span><span class="pl-k" style="box-sizing:
border-box; color: rgb(215, 58, 73);">if</span><span
style="caret-color: rgb(36, 41, 46); color: rgb(36, 41,
46);"> (CS.</span><span class="pl-c1" style="box-sizing:
border-box; color: rgb(0, 92, 197);">getCalledFunction</span><span
style="caret-color: rgb(36, 41, 46); color: rgb(36, 41,
46);">() == &F)</span>`` , since after linking the
CallSites become indirect calls with Bitcast ConstantExpr as
target I think that's why the inliner has no effect.</div>
<div style="font-family: "lucida Grande", Verdana;">Any
hints?</div>
</div>
<div><includetail>
<div> </div>
</includetail></div>
</blockquote>
<br>
Run instcombine first.<br>
<br>
-Eli<br>
<pre class="moz-signature" cols="72">--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
</body>
</html>