summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-06-13 21:17:49 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-06-13 21:17:49 +0000
commit9833a1b4071d5cdbf8a938083ea90a70008f8f9c (patch)
tree321b6ce90fb6bd966e96c3967415cf6c21202afc /llvm/lib/Transforms
parent871fcb57e7601fd9ecdbaeaae1c22c505e6364e8 (diff)
downloadbcm5719-llvm-9833a1b4071d5cdbf8a938083ea90a70008f8f9c.tar.gz
bcm5719-llvm-9833a1b4071d5cdbf8a938083ea90a70008f8f9c.zip
Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the
structure checks are incorrect if the blocks aren't distinct. Fixes PR2435. llvm-svn: 52257
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index c04df4a749b..8dbca0f2e8b 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud