summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveDebugValues.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse.llvm@gmail.com>2019-10-04 09:38:05 +0000
committerJeremy Morse <jeremy.morse.llvm@gmail.com>2019-10-04 09:38:05 +0000
commit0ca48de26c46281ae9fd15a042cc19cdf316bee6 (patch)
treecb064e755f388456e0f3d29e66b9ef7e1fde6e64 /llvm/lib/CodeGen/LiveDebugValues.cpp
parent4128dc4500693beb29e4f7cdf3f548c27bebbb9a (diff)
downloadbcm5719-llvm-0ca48de26c46281ae9fd15a042cc19cdf316bee6.tar.gz
bcm5719-llvm-0ca48de26c46281ae9fd15a042cc19cdf316bee6.zip
[DebugInfo] LiveDebugValues: defer DBG_VALUE creation during analysis
When transfering variable locations from one place to another, LiveDebugValues immediately creates a DBG_VALUE representing that transfer. This causes trouble if the variable location should subsequently be invalidated by a loop back-edge, such as in the added test case: the transfer DBG_VALUE from a now-invalid location is used as proof that the variable location is correct. This is effectively a self-fulfilling prophesy. To avoid this, defer the insertion of transfer DBG_VALUEs until after analysis has completed. Some of those transfers are still sketchy, but we don't propagate them into other blocks now. Differential Revision: https://reviews.llvm.org/D67393 llvm-svn: 373720
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index 0bdc62a345c..8d523377fb4 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -986,9 +986,6 @@ bool LiveDebugValues::transferTerminator(MachineBasicBlock *CurMBB,
const VarLocMap &VarLocIDs) {
bool Changed = false;
- if (OpenRanges.empty())
- return false;
-
LLVM_DEBUG(for (unsigned ID
: OpenRanges.getVarLocs()) {
// Copy OpenRanges to OutLocs, if not already present.
@@ -1362,11 +1359,6 @@ bool LiveDebugValues::ExtendRanges(MachineFunction &MF) {
DebugEntryVals, OverlapFragments, SeenFragments);
OLChanged |= transferTerminator(MBB, OpenRanges, OutLocs, VarLocIDs);
- // Add any DBG_VALUE instructions necessitated by spills.
- for (auto &TR : Transfers)
- MBB->insertAfterBundle(TR.TransferInst->getIterator(), TR.DebugInst);
- Transfers.clear();
-
LLVM_DEBUG(printVarLocInMBB(MF, OutLocs, VarLocIDs,
"OutLocs after propagating", dbgs()));
LLVM_DEBUG(printVarLocInMBB(MF, InLocs, VarLocIDs,
@@ -1387,6 +1379,13 @@ bool LiveDebugValues::ExtendRanges(MachineFunction &MF) {
assert(Pending.empty() && "Pending should be empty");
}
+ // Add any DBG_VALUE instructions created by location transfers.
+ for (auto &TR : Transfers) {
+ auto *MBB = TR.TransferInst->getParent();
+ MBB->insertAfterBundle(TR.TransferInst->getIterator(), TR.DebugInst);
+ }
+ Transfers.clear();
+
// Deferred inlocs will not have had any DBG_VALUE insts created; do
// that now.
flushPendingLocs(PendingInLocs, VarLocIDs);
OpenPOWER on IntegriCloud