Skip to content

Conversation

@MuellerMP
Copy link
Contributor

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.

@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2024

@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-llvm-regalloc

Author: Mirko (MuellerMP)

Changes

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 --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); } 
Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs test

@nathanchance
Copy link
Member

Thanks, this appears to resolve the issue I reported, but I understand there needs to be a test added before it can be merged.

@MuellerMP
Copy link
Contributor Author

This is how far i could reduce the orginal sample. (Still repros on trunk https://llvm.godbolt.org/z/bh8boEvff)
It requires the debug value + phi setup to trigger this specific issue with debug values at the end of an MBB.

This fixes the infinite loop discovered in llvm#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.
@arsenm arsenm merged commit 5e02fd8 into llvm:main Nov 9, 2024
8 checks passed
Groverkss pushed a commit to iree-org/llvm-project that referenced this pull request Nov 15, 2024
This fixes the infinite loop discovered in llvm#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment