<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 19, 2015 at 4:52 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: yrnkrn<br>
Date: Sun Jul 19 06:52:02 2015<br>
New Revision: 242641<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D242641-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=xGkcGLZay0tGz42MHRqT1kpUhLmyhOOqdLIxCg1zLeA&s=X3JuzWcyePp_HXUyXfXf8WRYkmiRpqOG6XosvncsMYU&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=242641&view=rev</a><br>
Log:<br>
De-duplicate CS.getCalledFunction() expression.<br>
<br>
Not sure if the optimizer will save the call as getCalledFunction()<br>
is not a trivial access function but the code is clearer this way.<br>
<br>
<br>
Modified:<br>
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Transforms_IPO_Inliner.cpp-3Frev-3D242641-26r1-3D242640-26r2-3D242641-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=xGkcGLZay0tGz42MHRqT1kpUhLmyhOOqdLIxCg1zLeA&s=IhcqjuDwJezuQpCik0yjmFzl2l1SZTX-b4j5gQa4wTc&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=242641&r1=242640&r2=242641&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Sun Jul 19 06:52:02 2015<br>
@@ -469,7 +469,8 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC<br>
         // If this is a direct call to an external function, we can never inline<br>
         // it.  If it is an indirect call, inlining may resolve it to be a<br>
         // direct call, so we keep it.<br>
-        if (CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration())<br>
+        Function *Callee = CS.getCalledFunction();<br>
+        if (Callee && Callee->isDeclaration())<br></blockquote><div><br>Could use the same number of lines (and, granted, more indentation) and keep the Callee variable more narrowly scoped by doing it this way:<br><br>  if (Function *Callee = CS.getCalledFunction())<br>    if (Callee->isDeclaration())<br>      continue;<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
           continue;<br>
<br>
         CallSites.push_back(std::make_pair(CS, -1));<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>