From 6e459bf0a7a2a98c459916178fa58550de009b28 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 3 Aug 2005 18:34:29 +0000 Subject: [PATCH] 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 --- lib/Transforms/Utils/LowerInvoke.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index fe22b4be847..96d5b98c6bd 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(InsertLoc)) ++InsertLoc; + // Insert a normal call instruction on the normal execution path. std::string Name = II->getName(); II->setName(""); -- 2.34.1