//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
+#include "llvm/Analysis/LoopInfo.h"
using namespace llvm;
/// InsertCastOfTo - Insert a cast of V to the specified type, doing what
UI != E; ++UI) {
if ((*UI)->getType() == Ty)
if (CastInst *CI = dyn_cast<CastInst>(cast<Instruction>(*UI))) {
- // If the cast isn't in the first instruction of the function,
- // move it.
+ // If the cast isn't the first instruction of the function, move it.
if (BasicBlock::iterator(CI) !=
A->getParent()->getEntryBlock().begin()) {
CI->moveBefore(A->getParent()->getEntryBlock().begin());
return CI;
}
}
- return new CastInst(V, Ty, V->getName(),
- A->getParent()->getEntryBlock().begin());
+ return CastInst::createInferredCast(
+ V, Ty, V->getName(), A->getParent()->getEntryBlock().begin());
}
Instruction *I = cast<Instruction>(V);
if (InvokeInst *II = dyn_cast<InvokeInst>(I))
IP = II->getNormalDest()->begin();
while (isa<PHINode>(IP)) ++IP;
- return new CastInst(V, Ty, V->getName(), IP);
+ return CastInst::createInferredCast(V, Ty, V->getName(), IP);
}
Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) {
// IF the step is by one, just return the inserted IV.
if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(F))
- if (CI->getRawValue() == 1)
+ if (CI->getZExtValue() == 1)
return I;
// If the insert point is directly inside of the loop, emit the multiply at
SCEVHandle IH = SCEVUnknown::get(I); // Get I as a "symbolic" SCEV.
SCEVHandle V = S->evaluateAtIteration(IH);
- //std::cerr << "Evaluated: " << *this << "\n to: " << *V << "\n";
+ //cerr << "Evaluated: " << *this << "\n to: " << *V << "\n";
return expandInTy(V, Ty);
}