aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2021-06-29 18:50:24 +0100
committerJeremy Morse <jeremy.morse@sony.com>2021-06-30 16:56:25 +0100
commit49555441628a0ec620581bba371e6bb20c2b3f5f (patch)
treec6fc24e8a8c179afe851a077d7b4202e6c10ec8a /llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
parentecabc6684f23cb65925d62fac9a14ab52d07951a (diff)
downloadllvm-49555441628a0ec620581bba371e6bb20c2b3f5f.zip
llvm-49555441628a0ec620581bba371e6bb20c2b3f5f.tar.gz
llvm-49555441628a0ec620581bba371e6bb20c2b3f5f.tar.bz2
[LiveDebugValues][InstrRef][1/2] Recover more clobbered variable locations
In various circumstances, when we clobber a register there may be alternative locations that the value is live in. The classic example would be a value loaded from the stack, and then clobbered: the value is still available on the stack. InstrRefBasedLDV was coping with this at block starts where it's forced to pick a location, however it wasn't searching for alternative locations when values were clobbered. This patch notifies the "Transfer Tracker" object when clobbers occur, and it's able to find alternatives and issue DBG_VALUEs for that location. See: the added test. Differential Revision: https://reviews.llvm.org/D88405
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
index 770c46e..38e803d 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
@@ -14,6 +14,7 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetMachine.h"
/// \file LiveDebugValues.cpp
@@ -33,6 +34,12 @@
using namespace llvm;
+static cl::opt<bool>
+ ForceInstrRefLDV("force-instr-ref-livedebugvalues", cl::Hidden,
+ cl::desc("Use instruction-ref based LiveDebugValues with "
+ "normal DBG_VALUE inputs"),
+ cl::init(false));
+
/// Generic LiveDebugValues pass. Calls through to VarLocBasedLDV or
/// InstrRefBasedLDV to perform location propagation, via the LDVImpl
/// base class.
@@ -87,6 +94,9 @@ bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) {
InstrRefBased = TM.Options.ValueTrackingVariableLocations;
}
+ // Allow the user to force selection of InstrRef LDV.
+ InstrRefBased |= ForceInstrRefLDV;
+
if (InstrRefBased)
TheImpl = llvm::makeInstrRefBasedLiveDebugValues();
else