summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
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
commitf8a81a98868b2b901c16188bec66f887e27c6294 (patch)
tree6a61d23b681be06841ae2f8449e5a11253b7fae4 /llvm/lib/Transforms
parent89ba7922f4fc9310d7142d83e5eb0973b3099946 (diff)
downloadbcm5719-llvm-f8a81a98868b2b901c16188bec66f887e27c6294.tar.gz
bcm5719-llvm-f8a81a98868b2b901c16188bec66f887e27c6294.zip
When inserting code, make sure not to insert it before PHI nodes. This
fixes PR612 and Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll llvm-svn: 22626
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LowerInvoke.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LowerInvoke.cpp b/llvm/lib/Transforms/Scalar/LowerInvoke.cpp
index fe22b4be847..96d5b98c6bd 100644
--- a/llvm/lib/Transforms/Scalar/LowerInvoke.cpp
+++ b/llvm/lib/Transforms/Scalar/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("");
OpenPOWER on IntegriCloud