summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveDebugValues.cpp
diff options
context:
space:
mode:
authorNikola Prica <nikola.prica@rt-rk.com>2019-06-03 09:48:29 +0000
committerNikola Prica <nikola.prica@rt-rk.com>2019-06-03 09:48:29 +0000
commit2d0106a110410174ae1d1ba394cc58ab127a5949 (patch)
tree53f9aa5022edf34b56c81d2de7606d171409bd12 /llvm/lib/CodeGen/LiveDebugValues.cpp
parent0aa374a3062eca4cfe61083ee0671b6db6201147 (diff)
downloadbcm5719-llvm-2d0106a110410174ae1d1ba394cc58ab127a5949.tar.gz
bcm5719-llvm-2d0106a110410174ae1d1ba394cc58ab127a5949.zip
[LiveDebugValues] Close range for previous variable's location when adding newly deduced location
When LiveDebugValues deduces new variable's location from spill, restore or register copy instruction it should close old variable's location. Otherwise we can have multiple block output locations for same variable. That could lead to inserting two DBG_VALUEs for same variable to the beginning of the successor block which results to ignoring of first DBG_VALUE. Reviewers: aprantl, jmorse, wolfgangp, dstenb Reviewed By: aprantl Subscribers: probinson, asowda, ivanbaev, petarj, djtodoro Tags: #debug-info Differential Revision: https://reviews.llvm.org/D62196 llvm-svn: 362373
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index 7f95e12186f..8b8a340c179 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -430,9 +430,15 @@ void LiveDebugValues::insertTransferDebugPair(
MachineFunction *MF = MI.getParent()->getParent();
MachineInstr *NewDebugInstr;
- auto ProcessVarLoc = [&MI, &OpenRanges, &Transfers,
+ auto ProcessVarLoc = [&MI, &OpenRanges, &Transfers, &DebugInstr,
&VarLocIDs](VarLoc &VL, MachineInstr *NewDebugInstr) {
unsigned LocId = VarLocIDs.insert(VL);
+
+ // Close this variable's previous location range.
+ DebugVariable V(DebugInstr->getDebugVariable(),
+ DebugInstr->getDebugLoc()->getInlinedAt());
+ OpenRanges.erase(V);
+
OpenRanges.insert(LocId, VL.Var);
// The newly created DBG_VALUE instruction NewDebugInstr must be inserted
// after MI. Keep track of the pairing.
@@ -714,6 +720,10 @@ bool LiveDebugValues::transferTerminatorInst(MachineInstr &MI,
});
VarLocSet &VLS = OutLocs[CurMBB];
Changed = VLS |= OpenRanges.getVarLocs();
+ // New OutLocs set may be different due to spill, restore or register
+ // copy instruction processing.
+ if (Changed)
+ VLS = OpenRanges.getVarLocs();
OpenRanges.clear();
return Changed;
}
OpenPOWER on IntegriCloud