summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-15 05:36:31 +0000
committerChris Lattner <sabre@nondot.org>2004-07-15 05:36:31 +0000
commitdaa12135da43cd5abf09e0885cc8bc0e48027f9b (patch)
tree2ab7dcb42b6ffadd8b5f199ffb8e9fbe9193be14
parent34cc695252ff3dd5f3be976b249da32c192789c8 (diff)
downloadbcm5719-llvm-daa12135da43cd5abf09e0885cc8bc0e48027f9b.tar.gz
bcm5719-llvm-daa12135da43cd5abf09e0885cc8bc0e48027f9b.zip
Revert previous patch until I get a bug fixed
llvm-svn: 14853
-rw-r--r--llvm/lib/Transforms/Scalar/LoopSimplify.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplify.cpp b/llvm/lib/Transforms/Scalar/LoopSimplify.cpp
index 9f8373e5450..b2752089d44 100644
--- a/llvm/lib/Transforms/Scalar/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSimplify.cpp
@@ -147,9 +147,6 @@ bool LoopSimplify::ProcessLoop(Loop *L) {
Changed = true;
}
-
- DominatorSet &DS = getAnalysis<DominatorSet>(); // Update dominator info
-
// Next, check to make sure that all exit nodes of the loop only have
// predecessors that are inside of the loop. This check guarantees that the
// loop preheader/header will dominate the exit blocks. If the exit block has
@@ -158,16 +155,19 @@ bool LoopSimplify::ProcessLoop(Loop *L) {
L->getExitBlocks(ExitBlocks);
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
BasicBlock *ExitBlock = ExitBlocks[i];
- if (!DS.dominates(L->getHeader(), ExitBlock)) {
- BasicBlock *NewBB = RewriteLoopExitBlock(L, ExitBlock);
- for (unsigned j = i; j != ExitBlocks.size(); ++j)
- if (ExitBlocks[j] == ExitBlock)
- ExitBlocks[j] = NewBB;
-
- NumInserted++;
- Changed = true;
+ for (pred_iterator PI = pred_begin(ExitBlock), PE = pred_end(ExitBlock);
+ PI != PE; ++PI)
+ if (!L->contains(*PI)) {
+ BasicBlock *NewBB = RewriteLoopExitBlock(L, ExitBlock);
+ for (unsigned j = i; j != ExitBlocks.size(); ++j)
+ if (ExitBlocks[j] == ExitBlock)
+ ExitBlocks[j] = NewBB;
+
+ NumInserted++;
+ Changed = true;
+ break;
+ }
}
- }
// If the header has more than two predecessors at this point (from the
// preheader and from multiple backedges), we must adjust the loop.
OpenPOWER on IntegriCloud