mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-27 07:12:06 +00:00
[ShrinkWrapping] Fix an infinite loop while looking for restore point.
This may happen when the input program itself contains an infinite loop with no exit block. In that case, we would fail to find a block post-dominating the loop such that this block is outside of the loop. This fixes PR24823. Working on reducing the test case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247710 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5332ea03d1
commit
07400eaee0
@ -309,6 +309,14 @@ void ShrinkWrap::updateSaveRestorePoints(MachineBasicBlock &MBB) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If the loop does not exit, there is no point in looking
|
||||
// for a post-dominator outside the loop.
|
||||
SmallVector<MachineBasicBlock*, 4> ExitBlocks;
|
||||
MLI->getLoopFor(Restore)->getExitingBlocks(ExitBlocks);
|
||||
if (ExitBlocks.empty()) {
|
||||
Restore = nullptr;
|
||||
break;
|
||||
}
|
||||
// Push Restore outside of this loop if immediate post-dominator is
|
||||
// different from restore block. If immediate post-dominator is not
|
||||
// different, bail out.
|
||||
|
Loading…
x
Reference in New Issue
Block a user