From 4b1cb4e3c05e23d84a02c2120d1a5467e6d3e0eb Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Thu, 6 Mar 2014 04:55:28 +0000 Subject: [PATCH] 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 --- lib/CodeGen/CodeGenPGO.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.50.1