From 856e18c047fe7da190ffa9772ba4bc5cf83d5a36 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 5 Jun 2009 16:35:53 +0000 Subject: [PATCH] Move SCEVExpander::getOrInsertCanonicalInductionVariable out of line. llvm-svn: 72949 --- include/llvm/Analysis/ScalarEvolutionExpander.h | 7 +------ lib/Analysis/ScalarEvolutionExpander.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h index 7e0de47dc4f..b40fbf06f9c 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpander.h +++ b/include/llvm/Analysis/ScalarEvolutionExpander.h @@ -60,12 +60,7 @@ namespace llvm { /// 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 *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); - } + Value *getOrInsertCanonicalInductionVariable(const Loop *L, const Type *Ty); /// addInsertedValue - Remember the specified instruction as being the /// canonical form for the specified SCEV. diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index 7ba8268b508..ef77e46fc99 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); +}