[llvm-commits] [llvm] r72965 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Devang Patel
dpatel at apple.com
Fri Jun 5 15:39:22 PDT 2009
Author: dpatel
Date: Fri Jun 5 17:39:21 2009
New Revision: 72965
URL: http://llvm.org/viewvc/llvm-project?rev=72965&view=rev
Log:
Simplify.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=72965&r1=72964&r2=72965&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Jun 5 17:39:21 2009
@@ -2425,24 +2425,14 @@
// Get the terminating condition for the loop if possible (this isn't
// necessarily in the latch, or a block that's a predecessor of the header).
- SmallVector<BasicBlock*, 8> ExitBlocks;
- L->getExitBlocks(ExitBlocks);
- if (ExitBlocks.size() != 1) return;
+ if (!L->getExitBlock())
+ return; // More than one loop exit blocks.
// Okay, there is one exit block. Try to find the condition that causes the
// loop to be exited.
- BasicBlock *ExitBlock = ExitBlocks[0];
-
- BasicBlock *ExitingBlock = 0;
- for (pred_iterator PI = pred_begin(ExitBlock), E = pred_end(ExitBlock);
- PI != E; ++PI)
- if (L->contains(*PI)) {
- if (ExitingBlock == 0)
- ExitingBlock = *PI;
- else
- return; // More than one block exiting!
- }
- assert(ExitingBlock && "No exits from loop, something is broken!");
+ BasicBlock *ExitingBlock = L->getExitingBlock();
+ if (!ExitingBlock)
+ return; // More than one block exiting!
// Okay, we've computed the exiting block. See what condition causes us to
// exit.
More information about the llvm-commits
mailing list