]> granicus.if.org Git - clang/commitdiff
PGO: don't emit counter increment if no counters have been allocated.
authorBob Wilson <bob.wilson@apple.com>
Thu, 6 Mar 2014 04:55:28 +0000 (04:55 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 6 Mar 2014 04:55:28 +0000 (04:55 +0000)
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.

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

lib/CodeGen/CodeGenPGO.cpp

index ec53fdb02256ecf249a37e099b490f65aff8eb8c..38bb4c00aa389681eba9dc8b2ff9bed6e96812c9 100644 (file)
@@ -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);