summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR')
-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
4 files changed, 2 insertions, 114 deletions
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.
OpenPOWER on IntegriCloud