<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 11, 2017 at 12:27 AM Andrew Kelley via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Observe:<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><div class="gmail_msg">[nix-shell:~/tmp]$ cat test.ll </div><div class="gmail_msg">define internal fastcc void @foo() {</div><div class="gmail_msg">Entry:</div><div class="gmail_msg"> call fastcc void @bar()</div><div class="gmail_msg"> ret void</div><div class="gmail_msg">}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">; Function Attrs: alwaysinline</div><div class="gmail_msg">define internal fastcc void @bar() #0 {</div><div class="gmail_msg">Entry:</div><div class="gmail_msg"> ret void</div><div class="gmail_msg">}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">attributes #0 = { alwaysinline }</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">[nix-shell:~/tmp]$ opt test.ll -always-inline -S</div><div class="gmail_msg">; ModuleID = 'test.ll'</div><div class="gmail_msg">source_filename = "test.ll"</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">define internal fastcc void @foo() {</div><div class="gmail_msg">Entry:</div><div class="gmail_msg"> call fastcc void @bar()</div><div class="gmail_msg"> ret void</div><div class="gmail_msg">}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">; Function Attrs: alwaysinline</div><div class="gmail_msg">define internal fastcc void @bar() #0 {</div><div class="gmail_msg">Entry:</div><div class="gmail_msg"> ret void</div><div class="gmail_msg">}</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">attributes #0 = { alwaysinline }</div></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If I delete "internal" from foo, then the optimziation pass in fact inlines bar. Is this intentional? Is there a way to make the always inliner pass work on internal functions like this too?</div></div></blockquote><div><br>Is this a really representative test? the internal function has no callers - so it doesn't really matter how it's optimized, right? Because it's dead code.<br><br>My test case seems to show that if the function is used, then the inliner will inline into it - but if it's dead code, it won't.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br class="gmail_msg">
LLVM Developers mailing list<br class="gmail_msg">
<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg">
</blockquote></div></div>