[DebugInfo][InstrRef] Don't use instr-ref for unoptimised functions
authorJeremy Morse <jeremy.morse@sony.com>
Wed, 25 Aug 2021 13:56:05 +0000 (14:56 +0100)
committerJeremy Morse <jeremy.morse@sony.com>
Wed, 25 Aug 2021 14:10:36 +0000 (15:10 +0100)
commit0116ed006929224a934d99bd3705812485969221
treeabb8beacf27ba95e592d6761b618ebca51595790
parent9b2c6c07b54ac627403d679b8de8f87e90715913
[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
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
llvm/lib/CodeGen/LiveDebugVariables.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/test/DebugInfo/X86/instr-ref-opt-levels.ll [new file with mode: 0644]