diff options
| author | Devang Patel <dpatel@apple.com> | 2009-06-05 22:39:21 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-06-05 22:39:21 +0000 |
| commit | da634298fc5243932274ae261efcd351d5040630 (patch) | |
| tree | 3f244e851de3fd073c0c40376dd9d01d8148bfa6 /lib/Transforms | |
| parent | 578efa920abd218ba75a0fb3c9b8398f4c0a774b (diff) | |
| download | external_llvm-da634298fc5243932274ae261efcd351d5040630.zip external_llvm-da634298fc5243932274ae261efcd351d5040630.tar.gz external_llvm-da634298fc5243932274ae261efcd351d5040630.tar.bz2 | |
Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index f05afec..944f409 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2425,24 +2425,14 @@ void LoopStrengthReduce::OptimizeLoopCountIV(Loop *L) { // 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. |
