diff options
Diffstat (limited to 'llvm/lib/CodeGen/ShrinkWrap.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ShrinkWrap.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/ShrinkWrap.cpp b/llvm/lib/CodeGen/ShrinkWrap.cpp index 7e2f15163cb..c406c149c00 100644 --- a/llvm/lib/CodeGen/ShrinkWrap.cpp +++ b/llvm/lib/CodeGen/ShrinkWrap.cpp @@ -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. |