[llvm-commits] [llvm] r70633 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp
Dan Gohman
gohman at apple.com
Sat May 2 10:43:35 PDT 2009
Author: djg
Date: Sat May 2 12:43:35 2009
New Revision: 70633
URL: http://llvm.org/viewvc/llvm-project?rev=70633&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=70633&r1=70632&r2=70633&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Sat May 2 12:43:35 2009
@@ -333,6 +333,11 @@
/// expression cannot be evaluated, return UnknownValue itself.
SCEVHandle getSCEVAtScope(SCEV *S, const Loop *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 forgetLoopPHIs(const Loop *L);
+
public:
static char ID; // Pass identification, replacement for typeid
ScalarEvolution();
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=70633&r1=70632&r2=70633&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat May 2 12:43:35 2009
@@ -2111,9 +2111,7 @@
// 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 @@
/// 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
More information about the llvm-commits
mailing list