]> granicus.if.org Git - llvm/commitdiff
Refactor SampleProfile.cpp to move computation inside a branch. (NFC)
authorDehao Chen <dehao@google.com>
Mon, 23 Jan 2017 17:09:02 +0000 (17:09 +0000)
committerDehao Chen <dehao@google.com>
Mon, 23 Jan 2017 17:09:02 +0000 (17:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292803 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/SampleProfile.cpp

index cba0a813c44de4d347b780a6fabc9a495752b022..9b280958da8d6c2e9d941b4fdcd2d2d490c118bb 100644 (file)
@@ -651,9 +651,9 @@ bool SampleProfileLoader::inlineHotFunctions(Function &F) {
       Function *CalledFunction = CS.getCalledFunction();
       if (!CalledFunction || !CalledFunction->getSubprogram())
         continue;
-      DebugLoc DLoc = I->getDebugLoc();
-      uint64_t NumSamples = findCalleeFunctionSamples(*I)->getTotalSamples();
       if (InlineFunction(CS, IFI)) {
+        DebugLoc DLoc = I->getDebugLoc();
+        uint64_t NumSamples = findCalleeFunctionSamples(*I)->getTotalSamples();
         LocalChanged = true;
         emitOptimizationRemark(Ctx, DEBUG_TYPE, F, DLoc,
                                Twine("inlined hot callee '") +