From: Bob Wilson Date: Thu, 6 Mar 2014 04:55:28 +0000 (+0000) Subject: PGO: don't emit counter increment if no counters have been allocated. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b1cb4e3c05e23d84a02c2120d1a5467e6d3e0eb;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203072 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenPGO.cpp b/lib/CodeGen/CodeGenPGO.cpp index ec53fdb022..38bb4c00aa 100644 --- a/lib/CodeGen/CodeGenPGO.cpp +++ b/lib/CodeGen/CodeGenPGO.cpp @@ -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);