summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-18 22:14:10 +0000
committerChris Lattner <sabre@nondot.org>2004-04-18 22:14:10 +0000
commitd72c3eb54e73b3dfb7c6c5074951ff79bf05ba82 (patch)
treebddc6290c6d12b0a164313f3735e537a8b236fae /llvm/lib/Analysis/ScalarEvolution.cpp
parentbf3c8763c02bdaf5f0f7d680ad29995c4cc85bc4 (diff)
downloadbcm5719-llvm-d72c3eb54e73b3dfb7c6c5074951ff79bf05ba82.tar.gz
bcm5719-llvm-d72c3eb54e73b3dfb7c6c5074951ff79bf05ba82.zip
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. llvm-svn: 13045
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index b93deb2d695..2bf5e5486ab 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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)) {
OpenPOWER on IntegriCloud