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 | ab39f9ab71286ba352e9685d6744e4a95f6ebf33 (patch) | |
tree | 1af6ed860c44c884595e38f3e9cfed29224ad425 /lib | |
parent | 2418becee47126d941d7c1d879df7de9ed20d550 (diff) | |
download | external_llvm-ab39f9ab71286ba352e9685d6744e4a95f6ebf33.zip external_llvm-ab39f9ab71286ba352e9685d6744e4a95f6ebf33.tar.gz external_llvm-ab39f9ab71286ba352e9685d6744e4a95f6ebf33.tar.bz2 |
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')
-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 c04df4a..8dbca0f 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); |