[llvm] a699b2f - [InstrProf] Mark counters as used in debug correlation mode
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 30 14:50:50 PST 2021
Author: Ellis Hoag
Date: 2021-12-30T14:50:45-08:00
New Revision: a699b2f1c029c2f19fa5673370fdb7d68871ae03
URL: https://github.com/llvm/llvm-project/commit/a699b2f1c029c2f19fa5673370fdb7d68871ae03
DIFF: https://github.com/llvm/llvm-project/commit/a699b2f1c029c2f19fa5673370fdb7d68871ae03.diff
LOG: [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
Added:
Modified:
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index de34348606efc..73f208abcb07a 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -997,8 +997,11 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) {
ConstantExpr::getBitCast(ValuesVar, Type::getInt8PtrTy(Ctx));
}
- if (DebugInfoCorrelate)
+ if (DebugInfoCorrelate) {
+ // Mark the counter variable as used so that it isn't optimized out.
+ CompilerUsedVars.push_back(PD.RegionCounters);
return PD.RegionCounters;
+ }
// Create data variable.
auto *IntPtrTy = M->getDataLayout().getIntPtrType(M->getContext());
More information about the llvm-commits
mailing list