summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.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/MachineInstr.cpp
parentce4caff0de60e115974b05fcf240f294f9b7ff7f (diff)
downloadbcm5719-llvm-81d8ef219671241c1486ca08b07ec6e8b1b7531e.tar.gz
bcm5719-llvm-81d8ef219671241c1486ca08b07ec6e8b1b7531e.zip
[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/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 092e5859a47..f30290109b7 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -2092,3 +2092,13 @@ void MachineInstr::collectDebugValues(
DbgValues.push_back(&*DI);
}
}
+
+void MachineInstr::changeDebugValuesDefReg(unsigned Reg) {
+ // Collect matching debug values.
+ SmallVector<MachineInstr *, 2> DbgValues;
+ collectDebugValues(DbgValues);
+
+ // Propagate Reg to debug value instructions.
+ for (auto *DBI : DbgValues)
+ DBI->getOperand(0).setReg(Reg);
+}
OpenPOWER on IntegriCloud