aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-04 00:44:01 +0000
committerChris Lattner <sabre@nondot.org>2005-10-04 00:44:01 +0000
commit20b0754c414546b9a06a74d409160ebc4a473aab (patch)
tree95934661a74fe4fc7eb522cb707447dc45a89326 /llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
parent54fb5002e5f98e601a187e2cfca0233eec8bd00e (diff)
downloadllvm-20b0754c414546b9a06a74d409160ebc4a473aab.zip
llvm-20b0754c414546b9a06a74d409160ebc4a473aab.tar.gz
llvm-20b0754c414546b9a06a74d409160ebc4a473aab.tar.bz2
Fix DemoteRegToStack on an invoke. This fixes PR634.
llvm-svn: 23618
Diffstat (limited to 'llvm/lib/Transforms/Utils/DemoteRegToStack.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/DemoteRegToStack.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
index bbf998d..3eadfa7 100644
--- a/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
+++ b/llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
@@ -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);