summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-22 16:05:50 +0000
committerDan Gohman <gohman@apple.com>2009-04-22 16:05:50 +0000
commit9dd9a45e129caf7813eee690e2df06871591f43c (patch)
treef13365ab927003801609b195f59740315963d5b6 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp
parent87d138c3b95c71c3d7cdd786246e1d3ff4ec00c5 (diff)
downloadbcm5719-llvm-9dd9a45e129caf7813eee690e2df06871591f43c.tar.gz
bcm5719-llvm-9dd9a45e129caf7813eee690e2df06871591f43c.zip
Use BasicBlock::iterator instead of Instruction* for insert points,
to better handle inserting instructions at the end of a block. llvm-svn: 69807
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index e3103fa84b6..394ad6c0109 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -100,7 +100,7 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, const Type *Ty) {
/// InsertBinop - Insert the specified binary operator, doing a small amount
/// of work to avoid inserting an obviously redundant operation.
Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
- Value *RHS, Instruction *InsertPt) {
+ Value *RHS, BasicBlock::iterator InsertPt) {
// Fold a binop with constant operands.
if (Constant *CLHS = dyn_cast<Constant>(LHS))
if (Constant *CRHS = dyn_cast<Constant>(RHS))
@@ -244,7 +244,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
// the insert point. Otherwise, L is a loop that is a parent of the insert
// point loop. If we can, move the multiply to the outer most loop that it
// is safe to be in.
- Instruction *MulInsertPt = InsertPt;
+ BasicBlock::iterator MulInsertPt = getInsertionPoint();
Loop *InsertPtLoop = LI.getLoopFor(MulInsertPt->getParent());
if (InsertPtLoop != L && InsertPtLoop &&
L->contains(InsertPtLoop->getHeader())) {
@@ -284,21 +284,21 @@ Value *SCEVExpander::visitTruncateExpr(const SCEVTruncateExpr *S) {
const Type *Ty = SE.getEffectiveSCEVType(S->getType());
Value *V = expand(S->getOperand());
V = InsertNoopCastOfTo(V, SE.getEffectiveSCEVType(V->getType()));
- return CastInst::CreateTruncOrBitCast(V, Ty, "tmp.", InsertPt);
+ return new TruncInst(V, Ty, "tmp.", InsertPt);
}
Value *SCEVExpander::visitZeroExtendExpr(const SCEVZeroExtendExpr *S) {
const Type *Ty = SE.getEffectiveSCEVType(S->getType());
Value *V = expand(S->getOperand());
V = InsertNoopCastOfTo(V, SE.getEffectiveSCEVType(V->getType()));
- return CastInst::CreateZExtOrBitCast(V, Ty, "tmp.", InsertPt);
+ return new ZExtInst(V, Ty, "tmp.", InsertPt);
}
Value *SCEVExpander::visitSignExtendExpr(const SCEVSignExtendExpr *S) {
const Type *Ty = SE.getEffectiveSCEVType(S->getType());
Value *V = expand(S->getOperand());
V = InsertNoopCastOfTo(V, SE.getEffectiveSCEVType(V->getType()));
- return CastInst::CreateSExtOrBitCast(V, Ty, "tmp.", InsertPt);
+ return new SExtInst(V, Ty, "tmp.", InsertPt);
}
Value *SCEVExpander::visitSMaxExpr(const SCEVSMaxExpr *S) {
@@ -328,11 +328,11 @@ Value *SCEVExpander::visitUMaxExpr(const SCEVUMaxExpr *S) {
}
Value *SCEVExpander::expandCodeFor(SCEVHandle SH, const Type *Ty,
- Instruction *IP) {
+ BasicBlock::iterator IP) {
// Expand the code for this SCEV.
assert(SE.getTypeSizeInBits(Ty) == SE.getTypeSizeInBits(SH->getType()) &&
"non-trivial casts should be done with the SCEVs directly!");
- this->InsertPt = IP;
+ InsertPt = IP;
Value *V = expand(SH);
return InsertNoopCastOfTo(V, Ty);
}
OpenPOWER on IntegriCloud