diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp index bbf998d790c..3eadfa7694a 100644 --- a/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/lib/Transforms/Utils/DemoteRegToStack.cpp @@ -77,6 +77,7 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads) { BasicBlock::iterator InsertPt; if (!isa(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(InsertPt); ++InsertPt) + for (; isa(InsertPt); ++InsertPt) /* empty */; // Don't insert before any PHI nodes. new StoreInst(&I, Slot, InsertPt);