Skip to content

Commit a699b2f

Browse files
committed
[InstrProf] Mark counters as used in debug correlation mode
In debug info correlation mode we do not emit the data globals so we need to explicitly mark the counter globals as used so they don't get stripped. Reviewed By: kyulee Differential Revision: https://reviews.llvm.org/D115981
1 parent 59442a5 commit a699b2f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,11 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) {
997997
ConstantExpr::getBitCast(ValuesVar, Type::getInt8PtrTy(Ctx));
998998
}
999999

1000-
if (DebugInfoCorrelate)
1000+
if (DebugInfoCorrelate) {
1001+
// Mark the counter variable as used so that it isn't optimized out.
1002+
CompilerUsedVars.push_back(PD.RegionCounters);
10011003
return PD.RegionCounters;
1004+
}
10021005

10031006
// Create data variable.
10041007
auto *IntPtrTy = M->getDataLayout().getIntPtrType(M->getContext());

0 commit comments

Comments
 (0)