return false;
}
- /// 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.
- PHINode *getOrInsertCanonicalInductionVariable(const Loop *L, Type *Ty);
-
/// Return the induction variable increment's IV operand.
Instruction *getIVIncOperand(Instruction *IncV, Instruction *InsertPos,
bool allowScale);
}
}
-/// 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.
-PHINode *
-SCEVExpander::getOrInsertCanonicalInductionVariable(const Loop *L,
- Type *Ty) {
- assert(Ty->isIntegerTy() && "Can only insert integer induction variables!");
-
- // Build a SCEV for {0,+,1}<L>.
- // Conservatively use FlagAnyWrap for now.
- const SCEV *H = SE.getAddRecExpr(SE.getConstant(Ty, 0),
- SE.getConstant(Ty, 1), L, SCEV::FlagAnyWrap);
-
- // Emit code for it.
- SCEVInsertPointGuard Guard(Builder, this);
- PHINode *V = cast<PHINode>(expandCodeForImpl(
- H, nullptr, &*L->getHeader()->getFirstInsertionPt(), false));
-
- return V;
-}
-
/// replaceCongruentIVs - Check for congruent phis in this loop header and
/// replace them with their most canonical representative. Return the number of
/// phis eliminated.