[llvm] [llvm][CodeGen] Fix the issue caused by live interval checking in window scheduler (PR #123184)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 23:24:25 PST 2025


================
@@ -645,14 +645,17 @@ void WindowScheduler::expand() {
 
 void WindowScheduler::updateLiveIntervals() {
   SmallVector<Register, 128> UsedRegs;
-  for (MachineInstr &MI : *MBB)
+  for (MachineInstr &MI : *MBB) {
     for (const MachineOperand &MO : MI.operands()) {
       if (!MO.isReg() || MO.getReg() == 0)
         continue;
       Register Reg = MO.getReg();
       if (!is_contained(UsedRegs, Reg))
         UsedRegs.push_back(Reg);
     }
+    // Remove the residual slot index of newly cloned MI.
+    Context->LIS->RemoveMachineInstrFromMaps(MI);
----------------
arsenm wrote:

I don't follow this but something is too removed from the IR change. The map update and instruction create / delete should appear directly next to each other in the same function 

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


More information about the llvm-commits mailing list