diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 13 | 
2 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 6785d6943e1..24c325e0002 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4403,7 +4403,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {    }    case Intrinsic::eh_sjlj_dispatch_setup: {      DAG.setRoot(DAG.getNode(ISD::EH_SJLJ_DISPATCHSETUP, dl, MVT::Other, -                            getRoot(), getValue(I.getArgOperand(0)))); +                            getRoot()));      return 0;    } diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index 13e1454fa5f..aaa8568c2f2 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -442,14 +442,6 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) {    BasicBlock *DispatchBlock =      BasicBlock::Create(F.getContext(), "eh.sjlj.setjmp.catch", &F); -  // Add a call to dispatch_setup at the start of the dispatch block. This is -  // expanded to any target-specific setup that needs to be done. -  Value *SetupArg = -    CastInst::Create(Instruction::BitCast, FunctionContext, -                     Type::getInt8PtrTy(F.getContext()), "", -                     DispatchBlock); -  CallInst::Create(DispatchSetupFn, SetupArg, "", DispatchBlock); -    // Insert a load of the callsite in the dispatch block, and a switch on its    // value.  By default, we go to a block that just does an unwind (which is the    // correct action for a standard call). @@ -524,6 +516,11 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) {    Value *DispatchVal = CallInst::Create(BuiltinSetjmpFn, SetjmpArg,                                          "dispatch",                                          EntryBB->getTerminator()); + +  // Add a call to dispatch_setup after the setjmp call. This is expanded to any +  // target-specific setup that needs to be done. +  CallInst::Create(DispatchSetupFn, "", EntryBB->getTerminator()); +    // check the return value of the setjmp. non-zero goes to dispatcher.    Value *IsNormal = new ICmpInst(EntryBB->getTerminator(),                                   ICmpInst::ICMP_EQ, DispatchVal, Zero,  | 

