diff options
Diffstat (limited to 'lib/Transforms/Utils/LowerInvoke.cpp')
-rw-r--r-- | lib/Transforms/Utils/LowerInvoke.cpp | 7 |
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()); |