summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineCSE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineCSE.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCSE.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineCSE.cpp b/llvm/lib/CodeGen/MachineCSE.cpp
index 6c92b1d426d..fa785ac0c5a 100644
--- a/llvm/lib/CodeGen/MachineCSE.cpp
+++ b/llvm/lib/CodeGen/MachineCSE.cpp
@@ -180,6 +180,14 @@ bool MachineCSE::PerformTrivialCopyPropagation(MachineInstr *MI,
continue;
LLVM_DEBUG(dbgs() << "Coalescing: " << *DefMI);
LLVM_DEBUG(dbgs() << "*** to: " << *MI);
+
+ // Collect matching debug values.
+ SmallVector<MachineInstr *, 2> DbgValues;
+ DefMI->collectDebugValues(DbgValues);
+ // Propagate SrcReg to debug value instructions.
+ for (auto *DBI : DbgValues)
+ DBI->getOperand(0).setReg(SrcReg);
+
// Propagate SrcReg of copies to MI.
MO.setReg(SrcReg);
MRI->clearKillFlags(SrcReg);
OpenPOWER on IntegriCloud