diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-06-13 21:17:49 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-06-13 21:17:49 +0000 |
commit | 66fe80aa57c6de0b48fb4efb4c7bebe35c6c28c8 (patch) | |
tree | 1af6ed860c44c884595e38f3e9cfed29224ad425 /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | d4b9c17fb705c2f58ceef4f37d789ddb56783584 (diff) |
Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the
structure checks are incorrect if the blocks aren't distinct.
Fixes PR2435.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index c04df4a749..8dbca0f2e8 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -10379,8 +10379,12 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) { } if (++PI != pred_end(DestBB)) return false; - - + + // Bail out if all the relevant blocks aren't distinct (this can happen, + // for example, if SI is in an infinite loop) + if (StoreBB == DestBB || OtherBB == DestBB) + return false; + // Verify that the other block ends in a branch and is not otherwise empty. BasicBlock::iterator BBI = OtherBB->getTerminator(); BranchInst *OtherBr = dyn_cast<BranchInst>(BBI); |