aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
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
commit5f21f3adbfc57f5249e1220696a78c3360385955 (patch)
tree13b940423fa34908bfad4f1e971c1904eb576681 /lib/Analysis
parent27c2daf02027f431d63995f947294e71b9ba384b (diff)
downloadexternal_llvm-5f21f3adbfc57f5249e1220696a78c3360385955.zip
external_llvm-5f21f3adbfc57f5249e1220696a78c3360385955.tar.gz
external_llvm-5f21f3adbfc57f5249e1220696a78c3360385955.tar.bz2
Move SCEVExpander::getOrInsertCanonicalInductionVariable out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index 7ba8268..ef77e46 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/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);
+}