diff options
author | Devang Patel <dpatel@apple.com> | 2009-06-05 23:08:56 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-06-05 23:08:56 +0000 |
commit | 5c06f61e577f2c10ea0e6dd78f568fe58910fbbe (patch) | |
tree | 3523dafde61b3634736f3d3dda402d31ba0b5de4 /lib | |
parent | 2392efef1bd2599231ab659dd6ba4233bf5df94c (diff) | |
download | external_llvm-5c06f61e577f2c10ea0e6dd78f568fe58910fbbe.zip external_llvm-5c06f61e577f2c10ea0e6dd78f568fe58910fbbe.tar.gz external_llvm-5c06f61e577f2c10ea0e6dd78f568fe58910fbbe.tar.bz2 |
Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 4b1cda0..03c5005 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -2462,24 +2462,15 @@ void ScalarEvolution::forgetLoopPHIs(const Loop *L) { ScalarEvolution::BackedgeTakenInfo ScalarEvolution::ComputeBackedgeTakenCount(const Loop *L) { // If the loop has a non-one exit block count, we can't analyze it. - SmallVector<BasicBlock*, 8> ExitBlocks; - L->getExitBlocks(ExitBlocks); - if (ExitBlocks.size() != 1) return UnknownValue; + BasicBlock *ExitBlock = L->getExitBlock(); + if (!ExitBlock) + return UnknownValue; // 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 UnknownValue; // More than one block exiting! - } - assert(ExitingBlock && "No exits from loop, something is broken!"); + BasicBlock *ExitingBlock = L->getExitingBlock(); + if (!ExitingBlock) + return UnknownValue; // More than one block exiting! // Okay, we've computed the exiting block. See what condition causes us to // exit. |