De-duplicate CS.getCalledFunction() expression.
authorYaron Keren <yaron.keren@gmail.com>
Sun, 19 Jul 2015 11:52:02 +0000 (11:52 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Sun, 19 Jul 2015 11:52:02 +0000 (11:52 +0000)
Not sure if the optimizer will save the call as getCalledFunction()
is not a trivial access function but the code is clearer this way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242641 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/Inliner.cpp

index 5273c3dc3ca29837a4c7a16cf4d1aac1866c0753..0509eed283cff1296cfc4d2a8fdab984e42c3a37 100644 (file)
@@ -469,7 +469,8 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
         // If this is a direct call to an external function, we can never inline
         // it.  If it is an indirect call, inlining may resolve it to be a
         // direct call, so we keep it.
-        if (CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration())
+        Function *Callee = CS.getCalledFunction();
+        if (Callee && Callee->isDeclaration())
           continue;
         
         CallSites.push_back(std::make_pair(CS, -1));