r203072 - PGO: don't emit counter increment if no counters have been allocated.

Bob Wilson bob.wilson at apple.com
Wed Mar 5 20:55:28 PST 2014


Author: bwilson
Date: Wed Mar  5 22:55:28 2014
New Revision: 203072

URL: http://llvm.org/viewvc/llvm-project?rev=203072&view=rev
Log:
PGO: don't emit counter increment if no counters have been allocated.

I hit this while debugging another issue where my sources were in an
inconsistent state, so I don't have a testcase. Regardless, this check is
simpler and more direct than checking if the option is enabled.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenPGO.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=203072&r1=203071&r2=203072&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Wed Mar  5 22:55:28 2014
@@ -772,7 +772,7 @@ void CodeGenPGO::emitCounterVariables()
 }
 
 void CodeGenPGO::emitCounterIncrement(CGBuilderTy &Builder, unsigned Counter) {
-  if (!CGM.getCodeGenOpts().ProfileInstrGenerate)
+  if (!RegionCounters)
     return;
   llvm::Value *Addr =
     Builder.CreateConstInBoundsGEP2_64(RegionCounters, 0, Counter);





More information about the cfe-commits mailing list