diff options
author | Dan Gohman <gohman@apple.com> | 2009-02-17 20:49:49 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-02-17 20:49:49 +0000 |
commit | 60f8a63e2502d57e879bf52a4a48505b74fa9716 (patch) | |
tree | 9d004368211ce140a476954a0d8164d83c30de45 /lib/Analysis/ScalarEvolution.cpp | |
parent | a84f47c3e7bd1ba161ca46b64bd2469d49593320 (diff) |
Add a method to ScalarEvolution for telling it when a loop has been
modified in a way that may effect the trip count calculation. Change
IndVars to use this method when it rewrites pointer or floating-point
induction variables instead of using a doInitialization method to
sneak these changes in before ScalarEvolution has a chance to see
the loop. This eliminates the need for LoopPass to depend on
ScalarEvolution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64810 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 4e0dba7e04..54f2765354 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1453,6 +1453,11 @@ namespace { /// an analyzable loop-invariant iteration count. bool hasLoopInvariantIterationCount(const Loop *L); + /// forgetLoopIterationCount - This method should be called by the + /// client when it has changed a loop in a way that may effect + /// ScalarEvolution's ability to compute a trip count. + void forgetLoopIterationCount(const Loop *L); + /// getIterationCount - If the specified loop has a predictable iteration /// count, return it. Note that it is not valid to call this method on a /// loop without a loop-invariant iteration count. @@ -1931,6 +1936,13 @@ SCEVHandle ScalarEvolutionsImpl::getIterationCount(const Loop *L) { return I->second; } +/// forgetLoopIterationCount - This method should be called by the +/// client when it has changed a loop in a way that may effect +/// ScalarEvolution's ability to compute a trip count. +void ScalarEvolutionsImpl::forgetLoopIterationCount(const Loop *L) { + IterationCounts.erase(L); +} + /// ComputeIterationCount - Compute the number of times the specified loop /// will iterate. SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) { @@ -3091,6 +3103,10 @@ bool ScalarEvolution::hasLoopInvariantIterationCount(const Loop *L) const { return !isa<SCEVCouldNotCompute>(getIterationCount(L)); } +void ScalarEvolution::forgetLoopIterationCount(const Loop *L) { + return ((ScalarEvolutionsImpl*)Impl)->forgetLoopIterationCount(L); +} + SCEVHandle ScalarEvolution::getSCEVAtScope(Value *V, const Loop *L) const { return ((ScalarEvolutionsImpl*)Impl)->getSCEVAtScope(getSCEV(V), L); } |