summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/EHPersonalities.cpp5
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp2
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp1
-rw-r--r--llvm/lib/AsmParser/LLLexer.cpp1
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp38
-rw-r--r--llvm/lib/AsmParser/LLParser.h1
-rw-r--r--llvm/lib/AsmParser/LLToken.h2
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp34
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp15
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp8
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h1
-rw-r--r--llvm/lib/CodeGen/TargetLoweringBase.cpp1
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp42
-rw-r--r--llvm/lib/IR/AsmWriter.cpp15
-rw-r--r--llvm/lib/IR/Instruction.cpp5
-rw-r--r--llvm/lib/IR/Instructions.cpp58
-rw-r--r--llvm/lib/IR/Verifier.cpp38
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp5
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp15
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp7
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp2
21 files changed, 10 insertions, 286 deletions
diff --git a/llvm/lib/Analysis/EHPersonalities.cpp b/llvm/lib/Analysis/EHPersonalities.cpp
index 3704d49c91d..01be8b38fad 100644
--- a/llvm/lib/Analysis/EHPersonalities.cpp
+++ b/llvm/lib/Analysis/EHPersonalities.cpp
@@ -57,9 +57,8 @@ DenseMap<BasicBlock *, ColorVector> llvm::colorEHFunclets(Function &F) {
// contain" is used to distinguish from being "transitively contained" in
// a nested funclet).
//
- // Note: Despite not being funclets in the truest sense, terminatepad and
- // catchswitch are considered to belong to their own funclet for the purposes
- // of coloring.
+ // Note: Despite not being a funclet in the truest sense, a catchswitch is
+ // considered to belong to its own funclet for the purposes of coloring.
DEBUG_WITH_TYPE("winehprepare-coloring", dbgs() << "\nColoring funclets for "
<< F.getName() << "\n");
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index bcbf35b046b..2a374587a7a 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -98,8 +98,6 @@ static BasicBlock::iterator findInsertPointAfter(Instruction *I,
while (IP->isEHPad()) {
if (isa<FuncletPadInst>(IP) || isa<LandingPadInst>(IP)) {
++IP;
- } else if (auto *TPI = dyn_cast<TerminatePadInst>(IP)) {
- IP = TPI->getUnwindDest()->getFirstNonPHI()->getIterator();
} else if (isa<CatchSwitchInst>(IP)) {
IP = MustDominate->getFirstInsertionPt();
} else {
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 4a228c30a93..358aa8ed895 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3436,7 +3436,6 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V,
case Instruction::CatchRet:
case Instruction::CleanupPad:
case Instruction::CleanupRet:
- case Instruction::TerminatePad:
return false; // Misc instructions which have effects
}
}
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index 59b7db0ea4c..aef0585f87b 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/lib/AsmParser/LLLexer.cpp
@@ -763,7 +763,6 @@ lltok::Kind LLLexer::LexIdentifier() {
INSTKEYWORD(catchret, CatchRet);
INSTKEYWORD(catchswitch, CatchSwitch);
INSTKEYWORD(catchpad, CatchPad);
- INSTKEYWORD(terminatepad, TerminatePad);
INSTKEYWORD(cleanuppad, CleanupPad);
#undef INSTKEYWORD
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 2e411733e27..3d43f81f49a 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -4723,7 +4723,6 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
case lltok::kw_catchret: return ParseCatchRet(Inst, PFS);
case lltok::kw_catchswitch: return ParseCatchSwitch(Inst, PFS);
case lltok::kw_catchpad: return ParseCatchPad(Inst, PFS);
- case lltok::kw_terminatepad:return ParseTerminatePad(Inst, PFS);
case lltok::kw_cleanuppad: return ParseCleanupPad(Inst, PFS);
// Binary Operators.
case lltok::kw_add:
@@ -5285,43 +5284,6 @@ bool LLParser::ParseCatchPad(Instruction *&Inst, PerFunctionState &PFS) {
return false;
}
-/// ParseTerminatePad
-/// ::= 'terminatepad' within Parent ParamList 'to' TypeAndValue
-bool LLParser::ParseTerminatePad(Instruction *&Inst, PerFunctionState &PFS) {
- Value *ParentPad = nullptr;
-
- if (ParseToken(lltok::kw_within, "expected 'within' after terminatepad"))
- return true;
-
- if (Lex.getKind() != lltok::kw_none && Lex.getKind() != lltok::LocalVar &&
- Lex.getKind() != lltok::LocalVarID)
- return TokError("expected scope value for terminatepad");
-
- if (ParseValue(Type::getTokenTy(Context), ParentPad, PFS))
- return true;
-
- SmallVector<Value *, 8> Args;
- if (ParseExceptionArgs(Args, PFS))
- return true;
-
- if (ParseToken(lltok::kw_unwind, "expected 'unwind' in terminatepad"))
- return true;
-
- BasicBlock *UnwindBB = nullptr;
- if (Lex.getKind() == lltok::kw_to) {
- Lex.Lex();
- if (ParseToken(lltok::kw_caller, "expected 'caller' in terminatepad"))
- return true;
- } else {
- if (ParseTypeAndBasicBlock(UnwindBB, PFS)) {
- return true;
- }
- }
-
- Inst = TerminatePadInst::Create(ParentPad, UnwindBB, Args);
- return false;
-}
-
/// ParseCleanupPad
/// ::= 'cleanuppad' within Parent ParamList
bool LLParser::ParseCleanupPad(Instruction *&Inst, PerFunctionState &PFS) {
diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h
index 97a13f1a057..f61a5e5e3a3 100644
--- a/llvm/lib/AsmParser/LLParser.h
+++ b/llvm/lib/AsmParser/LLParser.h
@@ -465,7 +465,6 @@ namespace llvm {
bool ParseCatchRet(Instruction *&Inst, PerFunctionState &PFS);
bool ParseCatchSwitch(Instruction *&Inst, PerFunctionState &PFS);
bool ParseCatchPad(Instruction *&Inst, PerFunctionState &PFS);
- bool ParseTerminatePad(Instruction *&Inst, PerFunctionState &PFS);
bool ParseCleanupPad(Instruction *&Inst, PerFunctionState &PFS);
bool ParseArithmetic(Instruction *&I, PerFunctionState &PFS, unsigned Opc,
diff --git a/llvm/lib/AsmParser/LLToken.h b/llvm/lib/AsmParser/LLToken.h
index b35aae5f570..d86001a9dc9 100644
--- a/llvm/lib/AsmParser/LLToken.h
+++ b/llvm/lib/AsmParser/LLToken.h
@@ -185,7 +185,7 @@ namespace lltok {
kw_ret, kw_br, kw_switch, kw_indirectbr, kw_invoke, kw_resume,
kw_unreachable, kw_cleanupret, kw_catchswitch, kw_catchret, kw_catchpad,
- kw_terminatepad, kw_cleanuppad,
+ kw_cleanuppad,
kw_alloca, kw_load, kw_store, kw_fence, kw_cmpxchg, kw_atomicrmw,
kw_getelementptr,
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index e85cf4d8ebd..210ffd8d912 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4484,40 +4484,6 @@ std::error_code BitcodeReader::parseFunctionBody(Function *F) {
InstructionList.push_back(I);
break;
}
- case bitc::FUNC_CODE_INST_TERMINATEPAD: { // TERMINATEPAD: [tok,bb#,num,(ty,val)*]
- // We must have, at minimum, the outer scope and the number of arguments.
- if (Record.size() < 2)
- return error("Invalid record");
-
- unsigned Idx = 0;
-
- Value *ParentPad =
- getValue(Record, Idx++, NextValueNo, Type::getTokenTy(Context));
-
- unsigned NumArgOperands = Record[Idx++];
-
- SmallVector<Value *, 2> Args;
- for (unsigned Op = 0; Op != NumArgOperands; ++Op) {
- Value *Val;
- if (getValueTypePair(Record, Idx, NextValueNo, Val))
- return error("Invalid record");
- Args.push_back(Val);
- }
-
- BasicBlock *UnwindDest = nullptr;
- if (Idx + 1 == Record.size()) {
- UnwindDest = getBasicBlock(Record[Idx++]);
- if (!UnwindDest)
- return error("Invalid record");
- }
-
- if (Record.size() != Idx)
- return error("Invalid record");
-
- I = TerminatePadInst::Create(ParentPad, UnwindDest, Args);
- InstructionList.push_back(I);
- break;
- }
case bitc::FUNC_CODE_INST_CATCHPAD:
case bitc::FUNC_CODE_INST_CLEANUPPAD: { // [tok,num,(ty,val)*]
// We must have, at minimum, the outer scope and the number of arguments.
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index bc6f0edafac..dd4a16d985f 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -2025,21 +2025,6 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
Vals.push_back(VE.getValueID(CatchSwitch.getUnwindDest()));
break;
}
- case Instruction::TerminatePad: {
- Code = bitc::FUNC_CODE_INST_TERMINATEPAD;
- const auto &TPI = cast<TerminatePadInst>(I);
-
- pushValue(TPI.getParentPad(), InstID, Vals, VE);
-
- unsigned NumArgOperands = TPI.getNumArgOperands();
- Vals.push_back(NumArgOperands);
- for (unsigned Op = 0; Op != NumArgOperands; ++Op)
- PushValueAndType(TPI.getArgOperand(Op), InstID, Vals, VE);
-
- if (TPI.hasUnwindDest())
- Vals.push_back(VE.getValueID(TPI.getUnwindDest()));
- break;
- }
case Instruction::Unreachable:
Code = bitc::FUNC_CODE_INST_UNREACHABLE;
AbbrevToUse = FUNCTION_INST_UNREACHABLE_ABBREV;
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);
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index fbb27773c11..51a0faee81c 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -2917,21 +2917,6 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
writeOperand(FPI->getArgOperand(Op), /*PrintType=*/true);
}
Out << ']';
- } else if (const auto *TPI = dyn_cast<TerminatePadInst>(&I)) {
- Out << " within ";
- writeOperand(TPI->getParentPad(), /*PrintType=*/false);
- Out << " [";
- for (unsigned Op = 0, NumOps = TPI->getNumArgOperands(); Op < NumOps;
- ++Op) {
- if (Op > 0)
- Out << ", ";
- writeOperand(TPI->getArgOperand(Op), /*PrintType=*/true);
- }
- Out << "] unwind ";
- if (TPI->hasUnwindDest())
- writeOperand(TPI->getUnwindDest(), /*PrintType=*/true);
- else
- Out << "to caller";
} else if (isa<ReturnInst>(I) && !Operand) {
Out << " void";
} else if (const auto *CRI = dyn_cast<CatchReturnInst>(&I)) {
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index ce2e1d8c02b..c219121104b 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -206,7 +206,6 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
case CatchRet: return "catchret";
case CatchPad: return "catchpad";
case CatchSwitch: return "catchswitch";
- case TerminatePad: return "terminatepad";
// Standard binary operators...
case Add: return "add";
@@ -421,7 +420,6 @@ bool Instruction::mayReadFromMemory() const {
case Instruction::AtomicRMW:
case Instruction::CatchPad:
case Instruction::CatchRet:
- case Instruction::TerminatePad:
return true;
case Instruction::Call:
return !cast<CallInst>(this)->doesNotAccessMemory();
@@ -444,7 +442,6 @@ bool Instruction::mayWriteToMemory() const {
case Instruction::AtomicRMW:
case Instruction::CatchPad:
case Instruction::CatchRet:
- case Instruction::TerminatePad:
return true;
case Instruction::Call:
return !cast<CallInst>(this)->onlyReadsMemory();
@@ -477,8 +474,6 @@ bool Instruction::mayThrow() const {
return CRI->unwindsToCaller();
if (const auto *CatchSwitch = dyn_cast<CatchSwitchInst>(this))
return CatchSwitch->unwindsToCaller();
- if (const auto *TPI = dyn_cast<TerminatePadInst>(this))
- return TPI->unwindsToCaller();
return isa<ResumeInst>(this);
}
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 82eb1e0f2f7..5863456adfc 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -981,60 +981,6 @@ FuncletPadInst::FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
}
//===----------------------------------------------------------------------===//
-// TerminatePadInst Implementation
-//===----------------------------------------------------------------------===//
-void TerminatePadInst::init(Value *ParentPad, BasicBlock *BB,
- ArrayRef<Value *> Args) {
- if (BB) {
- setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
- setUnwindDest(BB);
- }
- std::copy(Args.begin(), Args.end(), arg_begin());
- setParentPad(ParentPad);
-}
-
-TerminatePadInst::TerminatePadInst(const TerminatePadInst &TPI)
- : TerminatorInst(TPI.getType(), Instruction::TerminatePad,
- OperandTraits<TerminatePadInst>::op_end(this) -
- TPI.getNumOperands(),
- TPI.getNumOperands()) {
- setInstructionSubclassData(TPI.getSubclassDataFromInstruction());
- std::copy(TPI.op_begin(), TPI.op_end(), op_begin());
-}
-
-TerminatePadInst::TerminatePadInst(Value *ParentPad, BasicBlock *BB,
- ArrayRef<Value *> Args, unsigned Values,
- Instruction *InsertBefore)
- : TerminatorInst(Type::getVoidTy(ParentPad->getContext()),
- Instruction::TerminatePad,
- OperandTraits<TerminatePadInst>::op_end(this) - Values,
- Values, InsertBefore) {
- init(ParentPad, BB, Args);
-}
-
-TerminatePadInst::TerminatePadInst(Value *ParentPad, BasicBlock *BB,
- ArrayRef<Value *> Args, unsigned Values,
- BasicBlock *InsertAtEnd)
- : TerminatorInst(Type::getVoidTy(ParentPad->getContext()),
- Instruction::TerminatePad,
- OperandTraits<TerminatePadInst>::op_end(this) - Values,
- Values, InsertAtEnd) {
- init(ParentPad, BB, Args);
-}
-
-BasicBlock *TerminatePadInst::getSuccessorV(unsigned Idx) const {
- assert(Idx == 0);
- return getUnwindDest();
-}
-unsigned TerminatePadInst::getNumSuccessorsV() const {
- return getNumSuccessors();
-}
-void TerminatePadInst::setSuccessorV(unsigned Idx, BasicBlock *B) {
- assert(Idx == 0);
- return setUnwindDest(B);
-}
-
-//===----------------------------------------------------------------------===//
// UnreachableInst Implementation
//===----------------------------------------------------------------------===//
@@ -4025,10 +3971,6 @@ FuncletPadInst *FuncletPadInst::cloneImpl() const {
return new (getNumOperands()) FuncletPadInst(*this);
}
-TerminatePadInst *TerminatePadInst::cloneImpl() const {
- return new (getNumOperands()) TerminatePadInst(*this);
-}
-
UnreachableInst *UnreachableInst::cloneImpl() const {
LLVMContext &Context = getContext();
return new UnreachableInst(Context);
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 9862bfcc4fa..234ab29d8ed 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -403,7 +403,6 @@ private:
void visitCleanupPadInst(CleanupPadInst &CPI);
void visitCatchSwitchInst(CatchSwitchInst &CatchSwitch);
void visitCleanupReturnInst(CleanupReturnInst &CRI);
- void visitTerminatePadInst(TerminatePadInst &TPI);
void VerifyCallSite(CallSite CS);
void verifyMustTailCall(CallInst &CI);
@@ -2899,8 +2898,7 @@ void Verifier::visitEHPadPredecessors(Instruction &I) {
if (auto *II = dyn_cast<InvokeInst>(TI)) {
Assert(II->getUnwindDest() == BB && II->getNormalDest() != BB,
"EH pad must be jumped to via an unwind edge", &I, II);
- } else if (!isa<CleanupReturnInst>(TI) && !isa<TerminatePadInst>(TI) &&
- !isa<CatchSwitchInst>(TI)) {
+ } else if (!isa<CleanupReturnInst>(TI) && !isa<CatchSwitchInst>(TI)) {
Assert(false, "EH pad must be jumped to via an unwind edge", &I, TI);
}
}
@@ -3002,8 +3000,7 @@ void Verifier::visitCleanupPadInst(CleanupPadInst &CPI) {
BasicBlock *UnwindDest;
if (CleanupReturnInst *CRI = dyn_cast<CleanupReturnInst>(U)) {
UnwindDest = CRI->getUnwindDest();
- } else if (isa<CleanupPadInst>(U) || isa<CatchSwitchInst>(U) ||
- isa<TerminatePadInst>(U)) {
+ } else if (isa<CleanupPadInst>(U) || isa<CatchSwitchInst>(U)) {
continue;
} else {
Assert(false, "bogus cleanuppad use", &CPI);
@@ -3072,37 +3069,6 @@ void Verifier::visitCleanupReturnInst(CleanupReturnInst &CRI) {
visitTerminatorInst(CRI);
}
-void Verifier::visitTerminatePadInst(TerminatePadInst &TPI) {
- visitEHPadPredecessors(TPI);
-
- BasicBlock *BB = TPI.getParent();
- Function *F = BB->getParent();
- Assert(F->hasPersonalityFn(),
- "TerminatePadInst needs to be in a function with a personality.",
- &TPI);
-
- // The terminatepad instruction must be the first non-PHI instruction in the
- // block.
- Assert(BB->getFirstNonPHI() == &TPI,
- "TerminatePadInst not the first non-PHI instruction in the block.",
- &TPI);
-
- if (BasicBlock *UnwindDest = TPI.getUnwindDest()) {
- Instruction *I = UnwindDest->getFirstNonPHI();
- Assert(I->isEHPad() && !isa<LandingPadInst>(I),
- "TerminatePadInst must unwind to an EH block which is not a "
- "landingpad.",
- &TPI);
- }
-
- auto *ParentPad = TPI.getParentPad();
- Assert(isa<CatchSwitchInst>(ParentPad) || isa<ConstantTokenNone>(ParentPad) ||
- isa<CleanupPadInst>(ParentPad) || isa<CatchPadInst>(ParentPad),
- "TerminatePadInst has an invalid parent.", ParentPad);
-
- visitTerminatorInst(TPI);
-}
-
void Verifier::verifyDominatesUse(Instruction &I, unsigned i) {
Instruction *Op = cast<Instruction>(I.getOperand(i));
// If the we have an invalid invoke, don't try to compute the dominance.
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 10f5099193f..5a7bce5a541 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2695,11 +2695,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
setOrigin(&I, getCleanOrigin());
}
- void visitTerminatePad(TerminatePadInst &I) {
- DEBUG(dbgs() << "TerminatePad: " << I << "\n");
- // Nothing to do here.
- }
-
void visitGetElementPtrInst(GetElementPtrInst &I) {
handleShadowOr(I);
}
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 74ece385581..b0d99a8e830 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -343,15 +343,7 @@ static void HandleInlinedEHPad(InvokeInst *II, BasicBlock *FirstNewBlock,
continue;
Instruction *Replacement = nullptr;
- if (auto *TPI = dyn_cast<TerminatePadInst>(I)) {
- if (TPI->unwindsToCaller()) {
- SmallVector<Value *, 3> TerminatePadArgs;
- for (Value *ArgOperand : TPI->arg_operands())
- TerminatePadArgs.push_back(ArgOperand);
- Replacement = TerminatePadInst::Create(TPI->getParentPad(), UnwindDest,
- TerminatePadArgs, TPI);
- }
- } else if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
+ if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
if (CatchSwitch->unwindsToCaller()) {
auto *NewCatchSwitch = CatchSwitchInst::Create(
CatchSwitch->getParentPad(), UnwindDest,
@@ -1441,10 +1433,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
if (!I->isEHPad())
continue;
- if (auto *TPI = dyn_cast<TerminatePadInst>(I)) {
- if (isa<ConstantTokenNone>(TPI->getParentPad()))
- TPI->setParentPad(CallSiteEHPad);
- } else if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
+ if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
if (isa<ConstantTokenNone>(CatchSwitch->getParentPad()))
CatchSwitch->setParentPad(CallSiteEHPad);
} else {
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index cb17b603ae5..24f88179c90 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1338,13 +1338,6 @@ void llvm::removeUnwindEdge(BasicBlock *BB) {
if (auto *CRI = dyn_cast<CleanupReturnInst>(TI)) {
NewTI = CleanupReturnInst::Create(CRI->getCleanupPad(), nullptr, CRI);
UnwindDest = CRI->getUnwindDest();
- } else if (auto *TPI = dyn_cast<TerminatePadInst>(TI)) {
- SmallVector<Value *, 3> TerminatePadArgs;
- for (Value *Operand : TPI->arg_operands())
- TerminatePadArgs.push_back(Operand);
- NewTI = TerminatePadInst::Create(TPI->getParentPad(), nullptr,
- TerminatePadArgs, TPI);
- UnwindDest = TPI->getUnwindDest();
} else if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(TI)) {
auto *NewCatchSwitch = CatchSwitchInst::Create(
CatchSwitch->getParentPad(), nullptr, CatchSwitch->getNumHandlers(),
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 78088e72009..74b7c0602b3 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3498,7 +3498,7 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) {
}
} else if ((isa<InvokeInst>(TI) &&
cast<InvokeInst>(TI)->getUnwindDest() == BB) ||
- isa<TerminatePadInst>(TI) || isa<CatchSwitchInst>(TI)) {
+ isa<CatchSwitchInst>(TI)) {
removeUnwindEdge(TI->getParent());
Changed = true;
} else if (isa<CleanupReturnInst>(TI)) {
OpenPOWER on IntegriCloud