[llvm] [CodeGen][X86] LiveRangeShrink: fix increment after end (PR #115276)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 00:10:32 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-regalloc

Author: Mirko (MuellerMP)

<details>
<summary>Changes</summary>

This fixes the infinite loop discovered in #<!-- -->114195. 
Since we skip debug instructions at the start of the loop we do not need to skip them again at the end of the loop.

---
Full diff: https://github.com/llvm/llvm-project/pull/115276.diff


1 Files Affected:

- (modified) llvm/lib/CodeGen/LiveRangeShrink.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/CodeGen/LiveRangeShrink.cpp b/llvm/lib/CodeGen/LiveRangeShrink.cpp
index f4bf47c3ae158f..6a0b918d5e6f67 100644
--- a/llvm/lib/CodeGen/LiveRangeShrink.cpp
+++ b/llvm/lib/CodeGen/LiveRangeShrink.cpp
@@ -246,7 +246,7 @@ bool LiveRangeShrink::runOnMachineFunction(MachineFunction &MF) {
         if (MI.getOperand(0).isReg())
           for (; EndIter != MBB.end() && EndIter->isDebugValue() &&
                  EndIter->hasDebugOperandForReg(MI.getOperand(0).getReg());
-               ++EndIter, ++Next)
+               ++EndIter)
             IOM[&*EndIter] = NewOrder;
         MBB.splice(I, &MBB, MI.getIterator(), EndIter);
       }

``````````

</details>


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


More information about the llvm-commits mailing list