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("");