summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-05 16:35:53 +0000
committerDan Gohman <gohman@apple.com>2009-06-05 16:35:53 +0000
commit63964b582184d72246c82b8011ad911e9b404eec (patch)
tree630bf3ebb46d281cb63611a94df8269ed44dae7e /llvm/lib/Analysis/ScalarEvolutionExpander.cpp
parentd9ef48a73e69459f77c88ca2a14d5367354ca645 (diff)
downloadbcm5719-llvm-63964b582184d72246c82b8011ad911e9b404eec.tar.gz
bcm5719-llvm-63964b582184d72246c82b8011ad911e9b404eec.zip
Move SCEVExpander::getOrInsertCanonicalInductionVariable out of line.
llvm-svn: 72949
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index 7ba8268b508..ef77e46fc99 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -644,3 +644,16 @@ Value *SCEVExpander::expand(const SCEV *S) {
InsertedExpressions[S] = V;
return V;
}
+
+/// getOrInsertCanonicalInductionVariable - This method returns the
+/// canonical induction variable of the specified type for the specified
+/// loop (inserting one if there is none). A canonical induction variable
+/// starts at zero and steps by one on each iteration.
+Value *
+SCEVExpander::getOrInsertCanonicalInductionVariable(const Loop *L,
+ const Type *Ty) {
+ assert(Ty->isInteger() && "Can only insert integer induction variables!");
+ SCEVHandle H = SE.getAddRecExpr(SE.getIntegerSCEV(0, Ty),
+ SE.getIntegerSCEV(1, Ty), L);
+ return expand(H);
+}
OpenPOWER on IntegriCloud