aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index eda96f3..24723e3 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1762,6 +1762,8 @@ void CodeGenFunction::EmitBranchToCounterBlock(
if (!InstrumentRegions || !isInstrumentedCondition(Cond))
return EmitBranchOnBoolExpr(Cond, TrueBlock, FalseBlock, TrueCount, LH);
+ const Stmt *CntrStmt = (CntrIdx ? CntrIdx : Cond);
+
llvm::BasicBlock *ThenBlock = nullptr;
llvm::BasicBlock *ElseBlock = nullptr;
llvm::BasicBlock *NextBlock = nullptr;
@@ -1814,7 +1816,7 @@ void CodeGenFunction::EmitBranchToCounterBlock(
EmitBlock(CounterIncrBlock);
// Increment corresponding counter; if index not provided, use Cond as index.
- incrementProfileCounter(CntrIdx ? CntrIdx : Cond);
+ incrementProfileCounter(CntrStmt);
// Go to the next block.
EmitBranch(NextBlock);