[llvm] [RegAlloc] Fix register's live range for early-clobber (PR #152895)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 17 22:40:19 PDT 2025


================
@@ -190,9 +190,12 @@ SlotIndex LiveRangeEdit::rematerializeAt(MachineBasicBlock &MBB,
   Rematted.insert(RM.ParentVNI);
   ++NumReMaterialization;
 
+  bool EarlyClobber = MI->getOperand(0).isEarlyClobber();
   if (ReplaceIndexMI)
-    return LIS.ReplaceMachineInstrInMaps(*ReplaceIndexMI, *MI).getRegSlot();
-  return LIS.getSlotIndexes()->insertMachineInstrInMaps(*MI, Late).getRegSlot();
+    return LIS.ReplaceMachineInstrInMaps(*ReplaceIndexMI, *MI)
+        .getRegSlot(EearlyClobber);
----------------
LuoYuanke wrote:

Thx! Fixed typo.

https://github.com/llvm/llvm-project/pull/152895


More information about the llvm-commits mailing list