aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineCopyPropagation.cpp
diff options
context:
space:
mode:
authorCarlos Alberto Enciso <carlos.alberto.enciso@gmail.com>2018-10-01 08:14:44 +0000
committerCarlos Alberto Enciso <carlos.alberto.enciso@gmail.com>2018-10-01 08:14:44 +0000
commit81d8ef219671241c1486ca08b07ec6e8b1b7531e (patch)
tree19ff3f9bf91854c19d360d1e1977b481862fbd8d /llvm/lib/CodeGen/MachineCopyPropagation.cpp
parentce4caff0de60e115974b05fcf240f294f9b7ff7f (diff)
downloadllvm-81d8ef219671241c1486ca08b07ec6e8b1b7531e.zip
llvm-81d8ef219671241c1486ca08b07ec6e8b1b7531e.tar.gz
llvm-81d8ef219671241c1486ca08b07ec6e8b1b7531e.tar.bz2
[DebugInfo][Dexter] Incorrect DBG_VALUE after MCP dead copy instruction removal.
When MachineCopyPropagation eliminates a dead 'copy', its associated debug information becomes invalid. as the recorded register has been removed. It causes the debugger to display wrong variable value. Differential Revision: https://reviews.llvm.org/D52614 llvm-svn: 343445
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCopyPropagation.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index b530908..dfaa946 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -598,6 +598,11 @@ void MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
LLVM_DEBUG(dbgs() << "MCP: Removing copy due to no live-out succ: ";
MaybeDead->dump());
assert(!MRI->isReserved(MaybeDead->getOperand(0).getReg()));
+
+ // Update matching debug values.
+ assert(MaybeDead->isCopy());
+ MaybeDead->changeDebugValuesDefReg(MaybeDead->getOperand(1).getReg());
+
MaybeDead->eraseFromParent();
Changed = true;
++NumDeletes;