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

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 00:09:56 PST 2024


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

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.

>From c8268941b6df7f942621757b0fa41893896bfb48 Mon Sep 17 00:00:00 2001
From: MuellerMP <mirkomueller97 at live.de>
Date: Thu, 7 Nov 2024 08:44:14 +0100
Subject: [PATCH] [CodeGen][X86] LiveRangeShrink: fix increment after end

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.
---
 llvm/lib/CodeGen/LiveRangeShrink.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
       }



More information about the llvm-commits mailing list