aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineSink.cpp
diff options
context:
space:
mode:
authorMomchil Velikov <momchil.velikov@arm.com>2023-11-21 10:10:23 +0000
committerGitHub <noreply@github.com>2023-11-21 10:10:23 +0000
commitef9bcace834e63f25bbbc5e8e2b615f89d85fb2f (patch)
treef027ce0807cc28774bb1eee1eb04264dfcf1c4ed /llvm/lib/CodeGen/MachineSink.cpp
parent4ccdab363618afbfd6958c4351c5a9ab3e37dcc8 (diff)
downloadllvm-ef9bcace834e63f25bbbc5e8e2b615f89d85fb2f.zip
llvm-ef9bcace834e63f25bbbc5e8e2b615f89d85fb2f.tar.gz
llvm-ef9bcace834e63f25bbbc5e8e2b615f89d85fb2f.tar.bz2
[MachineSink][AArch64] Preserve debug location when rematerialising an instruction to replace a COPY (#72685)
Fixes a regression in `tools/lldb-dap/optimized/TestDAP_optimized.py` caused by enabling "sink-and-fold" in MachineSink.
Diffstat (limited to 'llvm/lib/CodeGen/MachineSink.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineSink.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index 9ed6b22..48f5a21 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -506,7 +506,7 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI,
MRI->clearKillFlags(UsedRegB);
for (auto &[SinkDst, MaybeAM] : SinkInto) {
- MachineInstr *New = nullptr;
+ [[maybe_unused]] MachineInstr *New = nullptr;
LLVM_DEBUG(dbgs() << "Sinking copy of"; MI.dump(); dbgs() << "into";
SinkDst->dump());
if (SinkDst->isCopy()) {
@@ -524,9 +524,7 @@ bool MachineSinking::PerformSinkAndFold(MachineInstr &MI,
MachineBasicBlock::iterator InsertPt = SinkDst->getIterator();
Register DstReg = SinkDst->getOperand(0).getReg();
TII->reMaterialize(*SinkDst->getParent(), InsertPt, DstReg, 0, MI, *TRI);
- // Reuse the source location from the COPY.
New = &*std::prev(InsertPt);
- New->setDebugLoc(SinkDst->getDebugLoc());
} else {
// Fold instruction into the addressing mode of a memory instruction.
New = TII->emitLdStWithAddr(*SinkDst, MaybeAM);