summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/LowerInvoke.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-29 17:44:20 +0000
committerChris Lattner <sabre@nondot.org>2005-09-29 17:44:20 +0000
commit93e50ce04cc30fd4dc6e211bbfc536b9e6373905 (patch)
tree1f75ef28040750f1a901ecee9413c51fd20878fe /lib/Transforms/Utils/LowerInvoke.cpp
parent52897f827e6604b9ec0d351b81b3b9df9fb4274f (diff)
downloadllvm-93e50ce04cc30fd4dc6e211bbfc536b9e6373905.tar.gz
llvm-93e50ce04cc30fd4dc6e211bbfc536b9e6373905.tar.bz2
llvm-93e50ce04cc30fd4dc6e211bbfc536b9e6373905.tar.xz
Insert stores after phi nodes in the normal dest. This fixes
LowerInvoke/2005-08-03-InvokeWithPHI.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LowerInvoke.cpp')
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index d74633b82b..2b0e16c17b 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -259,8 +259,11 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
// Insert a store of the invoke num before the invoke and store zero into the
// location afterward.
new StoreInst(InvokeNoC, InvokeNum, true, II); // volatile
- new StoreInst(Constant::getNullValue(Type::UIntTy), InvokeNum, false,
- II->getNormalDest()->begin()); // nonvolatile.
+
+ BasicBlock::iterator NI = II->getNormalDest()->begin();
+ while (isa<PHINode>(NI)) ++NI;
+ // nonvolatile.
+ new StoreInst(Constant::getNullValue(Type::UIntTy), InvokeNum, false, NI);
// Add a switch case to our unwind block.
CatchSwitch->addCase(InvokeNoC, II->getUnwindDest());