[llvm] [RA] Fix the live range for early-clobber (PR #152895)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 9 23:47:48 PDT 2025
https://github.com/LuoYuanke created https://github.com/llvm/llvm-project/pull/152895
None
>From cc8e0f3aa9eb0df79fea7bb01023b341d4fffd50 Mon Sep 17 00:00:00 2001
From: Yuanke Luo <ykluo at birentech.com>
Date: Sun, 10 Aug 2025 10:40:51 +0800
Subject: [PATCH] [LiveRangeEdit] Fix the live range issue
---
llvm/lib/CodeGen/LiveRangeEdit.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp
index a3858efbdc5e1..bd388b97cbcd4 100644
--- a/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -192,7 +192,9 @@ SlotIndex LiveRangeEdit::rematerializeAt(MachineBasicBlock &MBB,
if (ReplaceIndexMI)
return LIS.ReplaceMachineInstrInMaps(*ReplaceIndexMI, *MI).getRegSlot();
- return LIS.getSlotIndexes()->insertMachineInstrInMaps(*MI, Late).getRegSlot();
+ bool EarlyClobber = MI->getOperand(0).isEarlyClobber();
+ return LIS.getSlotIndexes()->insertMachineInstrInMaps(*MI, Late).getRegSlot(
+ EarlyClobber);
}
void LiveRangeEdit::eraseVirtReg(Register Reg) {
More information about the llvm-commits
mailing list