aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2021-08-25 14:56:05 +0100
committerJeremy Morse <jeremy.morse@sony.com>2021-08-25 15:10:36 +0100
commit0116ed006929224a934d99bd3705812485969221 (patch)
treeabb8beacf27ba95e592d6761b618ebca51595790 /llvm/lib/CodeGen/LiveDebugVariables.cpp
parent9b2c6c07b54ac627403d679b8de8f87e90715913 (diff)
downloadllvm-0116ed006929224a934d99bd3705812485969221.zip
llvm-0116ed006929224a934d99bd3705812485969221.tar.gz
llvm-0116ed006929224a934d99bd3705812485969221.tar.bz2
[DebugInfo][InstrRef] Don't use instr-ref for unoptimised functions
InstrRefBasedLDV is marginally slower than VarlocBasedLDV when analysing optimised code -- however, it's much slower when analysing code compiled -O0. To avoid this: don't use instruction referencing for -O0 functions. In the "pure" case of unoptimised code, this won't really harm the debugging experience because most variables won't have been promoted off the stack, so can't go missing. It becomes more complicated when optimised code is inlined into functions marked optnone; however these are rare, and as -O0 doesn't run many optimisations there should be little damage to the debug experience as a result. I've taken the opportunity to refactor testing for instruction-referencing into a MachineFunction method, which seems the most appropriate place to put it. Differential Revision: https://reviews.llvm.org/D108585
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugVariables.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 54058a5..9a86cc7 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -1314,12 +1314,7 @@ bool LiveDebugVariables::runOnMachineFunction(MachineFunction &mf) {
// Have we been asked to track variable locations using instruction
// referencing?
- bool InstrRef = false;
- auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
- if (TPC) {
- auto &TM = TPC->getTM<TargetMachine>();
- InstrRef = TM.Options.ValueTrackingVariableLocations;
- }
+ bool InstrRef = mf.useDebugInstrRef();
if (!pImpl)
pImpl = new LDVImpl(this);