Change SCEVExpander's expandCodeFor to provide more flexibility

with the persistent insertion point, and change IndVars to make
use of it. This fixes a bug where IndVars was holding on to a
stale insertion point and forcing the SCEVExpander to continue to
use it.

This fixes PR4038.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69892 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2009-04-23 15:16:49 +00:00
parent b1f321b553
commit 752ec7da50
4 changed files with 48 additions and 19 deletions

View File

@@ -71,13 +71,23 @@ namespace llvm {
InsertedInstructions.insert(I);
}
void setInsertionPoint(BasicBlock::iterator NewIP) { InsertPt = NewIP; }
BasicBlock::iterator getInsertionPoint() const { return InsertPt; }
/// expandCodeFor - Insert code to directly compute the specified SCEV
/// expression into the program. The inserted code is inserted into the
/// SCEVExpander's current insertion point.
Value *expandCodeFor(SCEVHandle SH, const Type *Ty);
/// expandCodeFor - Insert code to directly compute the specified SCEV
/// expression into the program. The inserted code is inserted into the
/// specified block.
Value *expandCodeFor(SCEVHandle SH, const Type *Ty,
BasicBlock::iterator IP);
BasicBlock::iterator IP) {
setInsertionPoint(IP);
return expandCodeFor(SH, Ty);
}
/// InsertCastOfTo - Insert a cast of V to the specified type, doing what
/// we can to share the casts.