/// 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 = SCEVAddRecExpr::get(SCEVUnknown::getIntegerSCEV(0, Ty),
- SCEVUnknown::getIntegerSCEV(1, Ty), L);
+ SCEVHandle H = SE.getAddRecExpr(SE.getIntegerSCEV(0, Ty),
+ SE.getIntegerSCEV(1, Ty), L);
return expand(H);
}
static Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
Value *RHS, Instruction *&InsertPt);
protected:
- Value *expand(SCEV *S) {
- // Check to see if we already expanded this.
- std::map<SCEVHandle, Value*>::iterator I = InsertedExpressions.find(S);
- if (I != InsertedExpressions.end())
- return I->second;
-
- Value *V = visit(S);
- InsertedExpressions[S] = V;
- return V;
- }
-
+ Value *expand(SCEV *S);
+
Value *visitConstant(SCEVConstant *S) {
return S->getValue();
}