diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index c10c7401..9630ba4 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -435,6 +435,10 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) { // where to look for it. Builder.CreateCall(FuncCtxFn, FuncCtx); + // Register the function context and make sure it's known to not throw. + CallInst *Register = Builder.CreateCall(RegisterFn, FuncCtx, ""); + Register->setDoesNotThrow(); + // At this point, we are all set up, update the invoke instructions to mark // their call_site values. for (unsigned I = 0, E = Invokes.size(); I != E; ++I) { @@ -457,15 +461,10 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) { if (&BB == &F.front()) continue; for (Instruction &I : BB) - if (I.mayThrow()) + if (!isa<InvokeInst>(I) && I.mayThrow()) insertCallSiteStore(&I, -1); } - // Register the function context and make sure it's known to not throw - CallInst *Register = CallInst::Create( - RegisterFn, FuncCtx, "", EntryBB->getTerminator()->getIterator()); - Register->setDoesNotThrow(); - // Following any allocas not in the entry block, update the saved SP in the // jmpbuf to the new value. for (BasicBlock &BB : F) { |