diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | 1 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 42 |
4 files changed, 2 insertions, 50 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 3b09f258952..de923e95a56 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1230,8 +1230,8 @@ void SelectionDAGBuilder::visitCleanupPad(const CleanupPadInst &CPI) { /// When an invoke or a cleanupret unwinds to the next EH pad, there are /// many places it could ultimately go. In the IR, we have a single unwind /// destination, but in the machine CFG, we enumerate all the possible blocks. -/// This function skips over imaginary basic blocks that hold catchswitch or -/// terminatepad instructions, and finds all the "real" machine +/// This function skips over imaginary basic blocks that hold catchswitch +/// instructions, and finds all the "real" machine /// basic block destinations. As those destinations may not be successors of /// EHPadBB, here we also calculate the edge probability to those destinations. /// The passed-in Prob is the edge probability to EHPadBB. @@ -1300,10 +1300,6 @@ void SelectionDAGBuilder::visitCleanupRet(const CleanupReturnInst &I) { DAG.setRoot(Ret); } -void SelectionDAGBuilder::visitTerminatePad(const TerminatePadInst &TPI) { - report_fatal_error("visitTerminatePad not yet implemented!"); -} - void SelectionDAGBuilder::visitCatchSwitch(const CatchSwitchInst &CSI) { report_fatal_error("visitCatchSwitch not yet implemented!"); } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index 4f8e8132c4a..49a3872d20c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -740,7 +740,6 @@ private: void visitCatchSwitch(const CatchSwitchInst &I); void visitCatchRet(const CatchReturnInst &I); void visitCatchPad(const CatchPadInst &I); - void visitTerminatePad(const TerminatePadInst &TPI); void visitCleanupPad(const CleanupPadInst &CPI); BranchProbability getEdgeProbability(const MachineBasicBlock *Src, diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 74a42f8ee34..b12a37129e3 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -1574,7 +1574,6 @@ int TargetLoweringBase::InstructionOpcodeToISD(unsigned Opcode) const { case CatchRet: return 0; case CatchPad: return 0; case CatchSwitch: return 0; - case TerminatePad: return 0; case CleanupPad: return 0; case Add: return ISD::ADD; case FAdd: return ISD::FADD; diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 9f199a15718..3ac5d8a7c3b 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -70,7 +70,6 @@ private: void replaceUseWithLoad(Value *V, Use &U, AllocaInst *&SpillSlot, DenseMap<BasicBlock *, Value *> &Loads, Function &F); bool prepareExplicitEH(Function &F); - void replaceTerminatePadWithCleanup(Function &F); void colorFunclets(Function &F); void demotePHIsOnFunclets(Function &F); @@ -523,45 +522,6 @@ void llvm::calculateClrEHStateNumbers(const Function *Fn, calculateStateNumbersForInvokes(Fn, FuncInfo); } -void WinEHPrepare::replaceTerminatePadWithCleanup(Function &F) { - if (Personality != EHPersonality::MSVC_CXX) - return; - for (BasicBlock &BB : F) { - Instruction *First = BB.getFirstNonPHI(); - auto *TPI = dyn_cast<TerminatePadInst>(First); - if (!TPI) - continue; - - if (TPI->getNumArgOperands() != 1) - report_fatal_error( - "Expected a unary terminatepad for MSVC C++ personalities!"); - - auto *TerminateFn = dyn_cast<Function>(TPI->getArgOperand(0)); - if (!TerminateFn) - report_fatal_error("Function operand expected in terminatepad for MSVC " - "C++ personalities!"); - - // Insert the cleanuppad instruction. - auto *CPI = - CleanupPadInst::Create(TPI->getParentPad(), {}, - Twine("terminatepad.for.", BB.getName()), &BB); - - // Insert the call to the terminate instruction. - auto *CallTerminate = CallInst::Create(TerminateFn, {}, &BB); - CallTerminate->setDoesNotThrow(); - CallTerminate->setDoesNotReturn(); - CallTerminate->setCallingConv(TerminateFn->getCallingConv()); - - // Insert a new terminator for the cleanuppad using the same successor as - // the terminatepad. - CleanupReturnInst::Create(CPI, TPI->getUnwindDest(), &BB); - - // Let's remove the terminatepad now that we've inserted the new - // instructions. - TPI->eraseFromParent(); - } -} - void WinEHPrepare::colorFunclets(Function &F) { BlockColors = colorEHFunclets(F); @@ -885,8 +845,6 @@ bool WinEHPrepare::prepareExplicitEH(Function &F) { // not. removeUnreachableBlocks(F); - replaceTerminatePadWithCleanup(F); - // Determine which blocks are reachable from which funclet entries. colorFunclets(F); |