summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-05-02 17:43:35 +0000
committerDan Gohman <gohman@apple.com>2009-05-02 17:43:35 +0000
commitf150572af72f108fd727d11c0b4641a618fc57d4 (patch)
tree454bcbed4c5e227176161f562da0aeeb20533ea2 /llvm/lib/Analysis/ScalarEvolution.cpp
parentc27345f0b4d9af879d249c9aca26e4f8d0aab0b5 (diff)
downloadbcm5719-llvm-f150572af72f108fd727d11c0b4641a618fc57d4.tar.gz
bcm5719-llvm-f150572af72f108fd727d11c0b4641a618fc57d4.zip
When ScalarEvolution is told to forget the trip count for a loop, have
it also forget any SCEVs associated with loop-header PHIs in the loop, as they may be dependent on trip count information. llvm-svn: 70633
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index d458399c055..a6d39541aae 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -2111,9 +2111,7 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
// conservative estimates made without the benefit
// of trip count information.
if (ItCount.hasAnyInfo())
- for (BasicBlock::iterator I = L->getHeader()->begin();
- PHINode *PN = dyn_cast<PHINode>(I); ++I)
- deleteValueFromRecords(PN);
+ forgetLoopPHIs(L);
}
return Pair.first->second;
}
@@ -2124,6 +2122,16 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
/// is deleted.
void ScalarEvolution::forgetLoopBackedgeTakenCount(const Loop *L) {
BackedgeTakenCounts.erase(L);
+ forgetLoopPHIs(L);
+}
+
+/// forgetLoopPHIs - Delete the memoized SCEVs associated with the
+/// PHI nodes in the given loop. This is used when the trip count of
+/// the loop may have changed.
+void ScalarEvolution::forgetLoopPHIs(const Loop *L) {
+ for (BasicBlock::iterator I = L->getHeader()->begin();
+ PHINode *PN = dyn_cast<PHINode>(I); ++I)
+ deleteValueFromRecords(PN);
}
/// ComputeBackedgeTakenCount - Compute the number of times the backedge
OpenPOWER on IntegriCloud