diff options
| author | Jeremy Morse <jeremy.morse@sony.com> | 2021-10-13 12:35:35 +0100 |
|---|---|---|
| committer | Jeremy Morse <jeremy.morse@sony.com> | 2021-10-13 12:49:04 +0100 |
| commit | a3936a6c19c7914b86ee7a30ce95439ffb72b9c9 (patch) | |
| tree | 0bec25a90f05b7a19b1f2327718e033c027e7421 /llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp | |
| parent | 5158cfef8bd7d086b08e323a284c98e6d1b18942 (diff) | |
[DebugInfo][InstrRef] Use PHI placement utilities for machine locations
InstrRefBasedLDV used to try and determine which values are in which
registers using a lattice approach; however this is hard to understand, and
broken in various ways. This patch replaces that approach with a standard
SSA approach using existing LLVM utilities. PHIs are placed at dominance
frontiers; value propagation then eliminates un-necessary PHIs.
This patch also adds a bunch of unit tests that should cover many of the
weirder forms of control flow.
Differential Revision: https://reviews.llvm.org/D110173
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp index 07dba303e67b..a6b2f19a0444 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp @@ -81,6 +81,7 @@ public: private: LDVImpl *TheImpl; TargetPassConfig *TPC; + MachineDominatorTree MDT; }; char LiveDebugValues::ID = 0; @@ -97,12 +98,12 @@ LiveDebugValues::LiveDebugValues() : MachineFunctionPass(ID) { } bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) { + bool InstrRefBased = MF.useDebugInstrRef(); + // Allow the user to force selection of InstrRef LDV. + InstrRefBased |= ForceInstrRefLDV; + if (!TheImpl) { TPC = getAnalysisIfAvailable<TargetPassConfig>(); - bool InstrRefBased = MF.useDebugInstrRef(); - - // Allow the user to force selection of InstrRef LDV. - InstrRefBased |= ForceInstrRefLDV; if (InstrRefBased) TheImpl = llvm::makeInstrRefBasedLiveDebugValues(); @@ -110,5 +111,12 @@ bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) { TheImpl = llvm::makeVarLocBasedLiveDebugValues(); } - return TheImpl->ExtendRanges(MF, TPC, InputBBLimit, InputDbgValueLimit); + MachineDominatorTree *DomTree = nullptr; + if (InstrRefBased) { + DomTree = &MDT; + MDT.calculate(MF); + } + + return TheImpl->ExtendRanges(MF, DomTree, TPC, InputBBLimit, + InputDbgValueLimit); } |
