[llvm] r292803 - Refactor SampleProfile.cpp to move computation inside a branch. (NFC)

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 09:09:02 PST 2017


Author: dehao
Date: Mon Jan 23 11:09:02 2017
New Revision: 292803

URL: http://llvm.org/viewvc/llvm-project?rev=292803&view=rev
Log:
Refactor SampleProfile.cpp to move computation inside a branch. (NFC)

Modified:
    llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp

Modified: llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp?rev=292803&r1=292802&r2=292803&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp Mon Jan 23 11:09:02 2017
@@ -651,9 +651,9 @@ bool SampleProfileLoader::inlineHotFunct
       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 '") +




More information about the llvm-commits mailing list