diff options
author | Chris Lattner <sabre@nondot.org> | 2004-04-18 22:14:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-04-18 22:14:10 +0000 |
commit | f1ab4b4eac5603d19c20f4a508f93a118a52bdd5 (patch) | |
tree | c9d06cae7fa1fa63934b7b22a2a0ea3a83eba636 /lib/Analysis/ScalarEvolution.cpp | |
parent | 7c8781e71f8f9fa6956a7de056fc8a4e5c172c86 (diff) |
Change the ExitBlocks list from being explicitly contained in the Loop
structure to being dynamically computed on demand. This makes updating
loop information MUCH easier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index b93deb2d69..2bf5e5486a 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1452,11 +1452,13 @@ SCEVHandle ScalarEvolutionsImpl::getIterationCount(const Loop *L) { /// will iterate. SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) { // If the loop has a non-one exit block count, we can't analyze it. - if (L->getExitBlocks().size() != 1) return UnknownValue; + std::vector<BasicBlock*> ExitBlocks; + L->getExitBlocks(ExitBlocks); + if (ExitBlocks.size() != 1) return UnknownValue; // Okay, there is one exit block. Try to find the condition that causes the // loop to be exited. - BasicBlock *ExitBlock = L->getExitBlocks()[0]; + BasicBlock *ExitBlock = ExitBlocks[0]; BasicBlock *ExitingBlock = 0; for (pred_iterator PI = pred_begin(ExitBlock), E = pred_end(ExitBlock); @@ -2293,7 +2295,10 @@ static void PrintLoopInfo(std::ostream &OS, const ScalarEvolution *SE, PrintLoopInfo(OS, SE, *I); std::cerr << "Loop " << L->getHeader()->getName() << ": "; - if (L->getExitBlocks().size() != 1) + + std::vector<BasicBlock*> ExitBlocks; + L->getExitBlocks(ExitBlocks); + if (ExitBlocks.size() != 1) std::cerr << "<multiple exits> "; if (SE->hasLoopInvariantIterationCount(L)) { |