summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/LowerInvoke.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-03 18:34:29 +0000
committerChris Lattner <sabre@nondot.org>2005-08-03 18:34:29 +0000
commit6e459bf0a7a2a98c459916178fa58550de009b28 (patch)
treeb8d69eb4b9abca5c60ced78a707e90cfd560a8e8 /lib/Transforms/Utils/LowerInvoke.cpp
parent522611095df7245b917e5a47c7de1df4f990ea1d (diff)
downloadllvm-6e459bf0a7a2a98c459916178fa58550de009b28.tar.gz
llvm-6e459bf0a7a2a98c459916178fa58550de009b28.tar.bz2
llvm-6e459bf0a7a2a98c459916178fa58550de009b28.tar.xz
When inserting code, make sure not to insert it before PHI nodes. This
fixes PR612 and Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LowerInvoke.cpp')
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index fe22b4be84..96d5b98c6b 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -283,7 +283,9 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
// Create the receiver block if there is a critical edge to the normal
// destination.
SplitCriticalEdge(II, 0, this);
- Instruction *InsertLoc = II->getNormalDest()->begin();
+ BasicBlock::iterator InsertLoc = II->getNormalDest()->begin();
+ while (isa<PHINode>(InsertLoc)) ++InsertLoc;
+
// Insert a normal call instruction on the normal execution path.
std::string Name = II->getName(); II->setName("");