Fix DemoteRegToStack on an invoke. This fixes PR634.

llvm-svn: 23618
This commit is contained in:
Chris Lattner 2005-10-04 00:44:01 +00:00
parent 54fb5002e5
commit 20b0754c41
1 changed files with 2 additions and 1 deletions

View File

@ -77,6 +77,7 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads) {
BasicBlock::iterator InsertPt;
if (!isa<TerminatorInst>(I)) {
InsertPt = &I;
++InsertPt;
} else {
// We cannot demote invoke instructions to the stack if their normal edge
// is critical.
@ -86,7 +87,7 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads) {
InsertPt = II.getNormalDest()->begin();
}
for (++InsertPt; isa<PHINode>(InsertPt); ++InsertPt)
for (; isa<PHINode>(InsertPt); ++InsertPt)
/* empty */; // Don't insert before any PHI nodes.
new StoreInst(&I, Slot, InsertPt);