aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-07-30 05:42:50 +0000
committerBill Wendling <isanbard@gmail.com>2011-07-30 05:42:50 +0000
commit10c6d12a9fd4dab411091f64db4db69670b88850 (patch)
tree629a8bff765bcf0baa378c7367ab1d903f3910fc /lib
parentefd7919618d59bd0e3fcf861cc0d1eacbbed0ac6 (diff)
Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444, r136445, r136446, r136253 pending review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AsmParser/LLLexer.cpp8
-rw-r--r--lib/AsmParser/LLParser.cpp65
-rw-r--r--lib/AsmParser/LLParser.h2
-rw-r--r--lib/AsmParser/LLToken.h8
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp40
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp18
-rw-r--r--lib/CodeGen/DwarfEHPrepare.cpp58
-rw-r--r--lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp34
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp44
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h2
-rw-r--r--lib/CodeGen/ShadowStackGC.cpp6
-rw-r--r--lib/Target/CBackend/CBackend.cpp4
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp8
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp2
-rw-r--r--lib/Transforms/InstCombine/InstCombineCalls.cpp8
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp2
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp161
-rw-r--r--lib/VMCore/AsmWriter.cpp30
-rw-r--r--lib/VMCore/Core.cpp23
-rw-r--r--lib/VMCore/Instruction.cpp2
-rw-r--r--lib/VMCore/Instructions.cpp122
-rw-r--r--lib/VMCore/Verifier.cpp69
22 files changed, 44 insertions, 672 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp
index d16cac1af2..95b40c9838 100644
--- a/lib/AsmParser/LLLexer.cpp
+++ b/lib/AsmParser/LLLexer.cpp
@@ -584,11 +584,6 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(x);
KEYWORD(blockaddress);
-
- KEYWORD(personality);
- KEYWORD(cleanup);
- KEYWORD(catch);
- KEYWORD(filter);
#undef KEYWORD
// Keywords for types.
@@ -641,7 +636,6 @@ lltok::Kind LLLexer::LexIdentifier() {
INSTKEYWORD(switch, Switch);
INSTKEYWORD(indirectbr, IndirectBr);
INSTKEYWORD(invoke, Invoke);
- INSTKEYWORD(resume, Resume);
INSTKEYWORD(unwind, Unwind);
INSTKEYWORD(unreachable, Unreachable);
@@ -658,7 +652,6 @@ lltok::Kind LLLexer::LexIdentifier() {
INSTKEYWORD(shufflevector, ShuffleVector);
INSTKEYWORD(extractvalue, ExtractValue);
INSTKEYWORD(insertvalue, InsertValue);
- INSTKEYWORD(landingpad, LandingPad);
#undef INSTKEYWORD
// Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by
@@ -686,6 +679,7 @@ lltok::Kind LLLexer::LexIdentifier() {
return lltok::Error;
}
+
/// Lex0x: Handle productions that start with 0x, knowing that it matches and
/// that this is not a label:
/// HexFPConstant 0x[0-9A-Fa-f]+
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index f412c1c89a..4727fac8ef 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -2885,7 +2885,6 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
case lltok::kw_switch: return ParseSwitch(Inst, PFS);
case lltok::kw_indirectbr: return ParseIndirectBr(Inst, PFS);
case lltok::kw_invoke: return ParseInvoke(Inst, PFS);
- case lltok::kw_resume: return ParseResume(Inst, PFS);
// Binary Operators.
case lltok::kw_add:
case lltok::kw_sub:
@@ -2945,7 +2944,6 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
case lltok::kw_insertelement: return ParseInsertElement(Inst, PFS);
case lltok::kw_shufflevector: return ParseShuffleVector(Inst, PFS);
case lltok::kw_phi: return ParsePHI(Inst, PFS);
- case lltok::kw_landingpad: return ParseLandingPad(Inst, PFS);
case lltok::kw_call: return ParseCall(Inst, PFS, false);
case lltok::kw_tail: return ParseCall(Inst, PFS, true);
// Memory.
@@ -3255,18 +3253,7 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
return false;
}
-/// ParseResume
-/// ::= 'resume' TypeAndValue
-bool LLParser::ParseResume(Instruction *&Inst, PerFunctionState &PFS) {
- Value *Exn; LocTy ExnLoc;
- LocTy Loc = Lex.getLoc();
- if (ParseTypeAndValue(Exn, ExnLoc, PFS))
- return true;
- ResumeInst *RI = ResumeInst::Create(Context, Exn);
- Inst = RI;
- return false;
-}
//===----------------------------------------------------------------------===//
// Binary Operators.
@@ -3514,58 +3501,6 @@ int LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) {
return AteExtraComma ? InstExtraComma : InstNormal;
}
-/// ParseLandingPad
-/// ::= 'landingpad' Type 'personality' TypeAndValue 'cleanup'?
-/// (ClauseID ClauseList)+
-/// ClauseID
-/// ::= 'catch'
-/// ::= 'filter'
-/// ClauseList
-/// ::= TypeAndValue (',' TypeAndValue)*
-bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
- Type *Ty = 0; LocTy TyLoc;
- Value *PersFn; LocTy PersFnLoc;
- LocTy LPLoc = Lex.getLoc();
-
- if (ParseType(Ty, TyLoc) ||
- ParseToken(lltok::kw_personality, "expected 'personality'") ||
- ParseTypeAndValue(PersFn, PersFnLoc, PFS))
- return true;
-
- bool IsCleanup = EatIfPresent(lltok::kw_cleanup);
-
- SmallVector<std::pair<LandingPadInst::ClauseType, Constant*>, 16> Clauses;
- while (Lex.getKind() == lltok::kw_catch || Lex.getKind() == lltok::kw_filter){
- LandingPadInst::ClauseType CT;
- if (Lex.getKind() == lltok::kw_catch) {
- CT = LandingPadInst::Catch;
- ParseToken(lltok::kw_catch, "expected 'catch'");
- } else {
- CT = LandingPadInst::Filter;
- ParseToken(lltok::kw_filter, "expected 'filter'");
- }
-
- do {
- Value *V; LocTy VLoc;
- if (ParseTypeAndValue(V, VLoc, PFS))
- return true;
- Clauses.push_back(std::make_pair(CT, cast<Constant>(V)));
- } while (EatIfPresent(lltok::comma));
- }
-
- LandingPadInst *LP = LandingPadInst::Create(Ty, cast<Function>(PersFn),
- Clauses.size());
- LP->setCleanup(IsCleanup);
-
- for (SmallVectorImpl<std::pair<LandingPadInst::ClauseType,
- Constant*> >::iterator
- I = Clauses.begin(), E = Clauses.end(); I != E; ++I)
- LP->addClause(I->first, I->second);
-
- Inst = LP;
- return false;
-}
-
/// ParseCall
/// ::= 'tail'? 'call' OptionalCallingConv OptionalAttrs Type Value
/// ParameterList OptionalAttrs
diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h
index 7fd01b6a21..2a7210a311 100644
--- a/lib/AsmParser/LLParser.h
+++ b/lib/AsmParser/LLParser.h
@@ -347,7 +347,6 @@ namespace llvm {
bool ParseSwitch(Instruction *&Inst, PerFunctionState &PFS);
bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS);
bool ParseInvoke(Instruction *&Inst, PerFunctionState &PFS);
- bool ParseResume(Instruction *&Inst, PerFunctionState &PFS);
bool ParseArithmetic(Instruction *&I, PerFunctionState &PFS, unsigned Opc,
unsigned OperandType);
@@ -360,7 +359,6 @@ namespace llvm {
bool ParseInsertElement(Instruction *&I, PerFunctionState &PFS);
bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS);
int ParsePHI(Instruction *&I, PerFunctionState &PFS);
- bool ParseLandingPad(Instruction *&I, PerFunctionState &PFS);
bool ParseCall(Instruction *&I, PerFunctionState &PFS, bool isTail);
int ParseAlloc(Instruction *&I, PerFunctionState &PFS);
int ParseLoad(Instruction *&I, PerFunctionState &PFS, bool isVolatile);
diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h
index a9e79c542c..75b332b6be 100644
--- a/lib/AsmParser/LLToken.h
+++ b/lib/AsmParser/LLToken.h
@@ -124,9 +124,7 @@ namespace lltok {
kw_fptoui, kw_fptosi, kw_inttoptr, kw_ptrtoint, kw_bitcast,
kw_select, kw_va_arg,
- kw_landingpad, kw_personality, kw_cleanup, kw_catch, kw_filter,
-
- kw_ret, kw_br, kw_switch, kw_indirectbr, kw_invoke, kw_unwind, kw_resume,
+ kw_ret, kw_br, kw_switch, kw_indirectbr, kw_invoke, kw_unwind,
kw_unreachable,
kw_alloca, kw_load, kw_store, kw_fence, kw_cmpxchg, kw_atomicrmw,
@@ -149,8 +147,8 @@ namespace lltok {
// Type valued tokens (TyVal).
Type,
- APFloat, // APFloatVal
- APSInt // APSInt
+ APFloat, // APFloatVal
+ APSInt // APSInt
};
} // end namespace lltok
} // end namespace llvm
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index e0af683a24..b4f47ad670 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2508,14 +2508,6 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
cast<InvokeInst>(I)->setAttributes(PAL);
break;
}
- case bitc::FUNC_CODE_INST_RESUME: { // RESUME: [opval]
- unsigned Idx = 0;
- Value *Val = 0;
- if (getValueTypePair(Record, Idx, NextValueNo, Val))
- return Error("Invalid RESUME record");
- I = ResumeInst::Create(Context, Val);
- break;
- }
case bitc::FUNC_CODE_INST_UNWIND: // UNWIND
I = new UnwindInst(Context);
InstructionList.push_back(I);
@@ -2543,38 +2535,6 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
break;
}
- case bitc::FUNC_CODE_INST_LANDINGPAD: {
- // LANDINGPAD: [ty, val, val, num, (id0,val0 ...)?]
- unsigned Idx = 0;
- if (Record.size() < 4)
- return Error("Invalid LANDINGPAD record");
- Type *Ty = getTypeByID(Record[Idx++]);
- if (!Ty) return Error("Invalid LANDINGPAD record");
- Value *PersFn = 0;
- if (getValueTypePair(Record, Idx, NextValueNo, PersFn))
- return Error("Invalid LANDINGPAD record");
-
- bool IsCleanup = !!Record[Idx++];
- unsigned NumClauses = Record[Idx++];
- LandingPadInst *LP = LandingPadInst::Create(Ty, cast<Function>(PersFn),
- NumClauses);
- LP->setCleanup(IsCleanup);
- for (unsigned J = 0; J != NumClauses; ++J) {
- LandingPadInst::ClauseType CT =
- LandingPadInst::ClauseType(Record[Idx++]);
- Value *Val = 0;
- if (getValueTypePair(Record, Idx, NextValueNo, Val)) {
- delete LP;
- return Error("Invalid LANDINGPAD record");
- }
-
- LP->addClause(CT, cast<Constant>(Val));
- }
-
- I = LP;
- break;
- }
-
case bitc::FUNC_CODE_INST_ALLOCA: { // ALLOCA: [instty, opty, op, align]
if (Record.size() != 4)
return Error("Invalid ALLOCA record");
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 8fcaf1111f..dd071d89a6 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1143,10 +1143,6 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
}
break;
}
- case Instruction::Resume:
- Code = bitc::FUNC_CODE_INST_RESUME;
- PushValueAndType(I.getOperand(0), InstID, Vals, VE);
- break;
case Instruction::Unwind:
Code = bitc::FUNC_CODE_INST_UNWIND;
break;
@@ -1166,20 +1162,6 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
break;
}
- case Instruction::LandingPad: {
- const LandingPadInst &LP = cast<LandingPadInst>(I);
- Code = bitc::FUNC_CODE_INST_LANDINGPAD;
- Vals.push_back(VE.getTypeID(LP.getType()));
- PushValueAndType(LP.getPersonalityFn(), InstID, Vals, VE);
- Vals.push_back(LP.isCleanup());
- Vals.push_back(LP.getNumClauses());
- for (unsigned I = 0, E = LP.getNumClauses(); I != E; ++I) {
- Vals.push_back(LP.getClauseType(I));
- PushValueAndType(LP.getClauseValue(I), InstID, Vals, VE);
- }
- break;
- }
-
case Instruction::Alloca:
Code = bitc::FUNC_CODE_INST_ALLOCA;
Vals.push_back(VE.getTypeID(I.getType()));
diff --git a/lib/CodeGen/DwarfEHPrepare.cpp b/lib/CodeGen/DwarfEHPrepare.cpp
index 3aa72ee196..03604b0a17 100644
--- a/lib/CodeGen/DwarfEHPrepare.cpp
+++ b/lib/CodeGen/DwarfEHPrepare.cpp
@@ -63,8 +63,6 @@ namespace {
typedef SmallPtrSet<BasicBlock*, 8> BBSet;
BBSet LandingPads;
- bool InsertUnwindResumeCalls();
-
bool NormalizeLandingPads();
bool LowerUnwindsAndResumes();
bool MoveExceptionValueCalls();
@@ -660,67 +658,13 @@ Instruction *DwarfEHPrepare::CreateExceptionValueCall(BasicBlock *BB) {
return CallInst::Create(ExceptionValueIntrinsic, "eh.value.call", Start);
}
-/// InsertUnwindResumeCalls - Convert the ResumeInsts that are still present
-/// into calls to the appropriate _Unwind_Resume function.
-bool DwarfEHPrepare::InsertUnwindResumeCalls() {
- SmallVector<ResumeInst*, 16> Resumes;
- for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
- for (BasicBlock::iterator II = I->begin(), IE = I->end(); II != IE; ++II)
- if (ResumeInst *RI = dyn_cast<ResumeInst>(II))
- Resumes.push_back(RI);
-
- if (Resumes.empty())
- return false;
-
- // Find the rewind function if we didn't already.
- if (!RewindFunction) {
- LLVMContext &Ctx = Resumes[0]->getContext();
- FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx),
- Type::getInt8PtrTy(Ctx), false);
- const char *RewindName = TLI->getLibcallName(RTLIB::UNWIND_RESUME);
- RewindFunction = F->getParent()->getOrInsertFunction(RewindName, FTy);
- }
-
- // Create the basic block where the _Unwind_Resume call will live.
- LLVMContext &Ctx = F->getContext();
- BasicBlock *UnwindBB = BasicBlock::Create(Ctx, "unwind_resume", F);
- PHINode *PN = PHINode::Create(Type::getInt8PtrTy(Ctx), Resumes.size(),
- "exn.obj", UnwindBB);
-
- // Extract the exception object from the ResumeInst and add it to the PHI node
- // that feeds the _Unwind_Resume call.
- for (SmallVectorImpl<ResumeInst*>::iterator
- I = Resumes.begin(), E = Resumes.end(); I != E; ++I) {
- ResumeInst *RI = *I;
- BranchInst::Create(UnwindBB, RI->getParent());
- ExtractValueInst *ExnObj = ExtractValueInst::Create(RI->getOperand(0),
- 0, "exn.obj", RI);
- PN->addIncoming(ExnObj, RI->getParent());
- RI->eraseFromParent();
- }
-
- // Call the function.
- CallInst *CI = CallInst::Create(RewindFunction, PN, "", UnwindBB);
- CI->setCallingConv(TLI->getLibcallCallingConv(RTLIB::UNWIND_RESUME));
-
- // We never expect _Unwind_Resume to return.
- new UnreachableInst(Ctx, UnwindBB);
- return true;
-}
-
bool DwarfEHPrepare::runOnFunction(Function &Fn) {
bool Changed = false;
// Initialize internal state.
- DT = &getAnalysis<DominatorTree>(); // FIXME: We won't need this with the new EH.
+ DT = &getAnalysis<DominatorTree>();
F = &Fn;
- if (InsertUnwindResumeCalls()) {
- // FIXME: The reset of this function can go once the new EH is done.
- LandingPads.clear();
- return true;
- }
-
// Ensure that only unwind edges end at landing pads (a landing pad is a
// basic block where an invoke unwind edge ends).
Changed |= NormalizeLandingPads();
diff --git a/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 1f41f043db..d5bf12055e 100644
--- a/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -454,37 +454,3 @@ void llvm::CopyCatchInfo(const BasicBlock *SuccBB, const BasicBlock *LPad,
break;
}
}
-
-//--------- NEW EH - Begin ---------
-
-/// AddLandingPadInfo - Extract the exception handling information from the
-/// landingpad instruction and add them to the specified machine module info.
-void llvm::AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI,
- MachineBasicBlock *MBB) {
- MMI.addPersonality(MBB, I.getPersonalityFn());
-
- if (I.isCleanup())
- MMI.addCleanup(MBB);
-
- for (unsigned i = 0, e = I.getNumClauses(); i != e; ) {
- switch (I.getClauseType(i)) {
- case LandingPadInst::Catch:
- MMI.addCatchTypeInfo(MBB, dyn_cast<GlobalVariable>(I.getClauseValue(i)));
- ++i;
- break;
- case LandingPadInst::Filter: {
- // Add filters in a list.
- SmallVector<const GlobalVariable*, 4> FilterList;
- do {
- FilterList.push_back(cast<GlobalVariable>(I.getClauseValue(i)));
- ++i;
- } while (i != e && I.getClauseType(i) == LandingPadInst::Filter);
-
- MMI.addFilterTypeInfo(MBB, FilterList);
- break;
- }
- }
- }
-}
-
-//--------- NEW EH - End ---------
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 60d4391d4c..86d32c218b 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1810,50 +1810,6 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) {
void SelectionDAGBuilder::visitUnwind(const UnwindInst &I) {
}
-void SelectionDAGBuilder::visitResume(const ResumeInst &RI) {
- llvm_unreachable("SelectionDAGBuilder shouldn't visit resume instructions!");
-}
-
-void SelectionDAGBuilder::visitLandingPad(const LandingPadInst &LP) {
- // FIXME: Handle this
- assert(FuncInfo.MBB->isLandingPad() &&
- "Call to landingpad not in landing pad!");
-
- MachineBasicBlock *MBB = FuncInfo.MBB;
- MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
- AddLandingPadInfo(LP, MMI, MBB);
-
- SmallVector<EVT, 2> ValueVTs;
- ComputeValueVTs(TLI, LP.getType(), ValueVTs);
-
- // Insert the EXCEPTIONADDR instruction.
- assert(FuncInfo.MBB->isLandingPad() &&
- "Call to eh.exception not in landing pad!");
- SDVTList VTs = DAG.getVTList(TLI.getPointerTy(), MVT::Other);
- SDValue Ops[2];
- Ops[0] = DAG.getRoot();
- SDValue Op1 = DAG.getNode(ISD::EXCEPTIONADDR, getCurDebugLoc(), VTs, Ops, 1);
- SDValue Chain = Op1.getValue(1);
-
- // Insert the EHSELECTION instruction.
- VTs = DAG.getVTList(TLI.getPointerTy(), MVT::Other);
- Ops[0] = Op1;
- Ops[1] = Chain;
- SDValue Op2 = DAG.getNode(ISD::EHSELECTION, getCurDebugLoc(), VTs, Ops, 2);
- Chain = Op2.getValue(1);
- Op2 = DAG.getSExtOrTrunc(Op2, getCurDebugLoc(), MVT::i32);
-
- Ops[0] = Op1;
- Ops[1] = Op2;
- SDValue Res = DAG.getNode(ISD::MERGE_VALUES, getCurDebugLoc(),
- DAG.getVTList(&ValueVTs[0], ValueVTs.size()),
- &Ops[0], 2);
-
- std::pair<SDValue, SDValue> RetPair = std::make_pair(Res, Chain);
- setValue(&LP, RetPair.first);
- DAG.setRoot(RetPair.second);
-}
-
/// handleSmallSwitchCaseRange - Emit a series of specific tests (suitable for
/// small case ranges).
bool SelectionDAGBuilder::handleSmallSwitchRange(CaseRec& CR,
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
index 776b07072b..aae56ba06a 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
@@ -467,7 +467,6 @@ public:
private:
// These all get lowered before this pass.
void visitInvoke(const InvokeInst &I);
- void visitResume(const ResumeInst &I);
void visitUnwind(const UnwindInst &I);
void visitBinary(const User &I, unsigned OpCode);
@@ -512,7 +511,6 @@ private:
void visitExtractValue(const ExtractValueInst &I);
void visitInsertValue(const InsertValueInst &I);
- void visitLandingPad(const LandingPadInst &I);
void visitGetElementPtr(const User &I);
void visitSelect(const User &I);
diff --git a/lib/CodeGen/ShadowStackGC.cpp b/lib/CodeGen/ShadowStackGC.cpp
index daab89b8f2..9807c8cb27 100644
--- a/lib/CodeGen/ShadowStackGC.cpp
+++ b/lib/CodeGen/ShadowStackGC.cpp
@@ -113,11 +113,9 @@ namespace {
while (StateBB != StateE) {
BasicBlock *CurBB = StateBB++;
- // Branches and invokes do not escape, only unwind, resume, and return
- // do.
+ // Branches and invokes do not escape, only unwind and return do.
TerminatorInst *TI = CurBB->getTerminator();
- if (!isa<UnwindInst>(TI) && !isa<ReturnInst>(TI) &&
- !isa<ResumeInst>(TI))
+ if (!isa<UnwindInst>(TI) && !isa<ReturnInst>(TI))
continue;
Builder.SetInsertPoint(TI->getParent(), TI);
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index eb25537548..18a27d2dc3 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -288,12 +288,10 @@ namespace {
void visitInvokeInst(InvokeInst &I) {
llvm_unreachable("Lowerinvoke pass didn't work!");
}
+
void visitUnwindInst(UnwindInst &I) {
llvm_unreachable("Lowerinvoke pass didn't work!");
}
- void visitResumeInst(ResumeInst &I) {
- llvm_unreachable("Lowerinvoke pass didn't work!");
- }
void visitUnreachableInst(UnreachableInst &I);
void visitPHINode(PHINode &I);
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index 09f7ed51a3..7f5f5e189e 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -1064,11 +1064,6 @@ void CppWriter::printInstruction(const Instruction *I,
}
break;
}
- case Instruction::Resume: {
- Out << "ResumeInst::Create(mod->getContext(), " << opNames[0]
- << ", " << bbname << ");";
- break;
- }
case Instruction::Invoke: {
const InvokeInst* inv = cast<InvokeInst>(I);
Out << "std::vector<Value*> " << iName << "_params;";
@@ -1428,9 +1423,6 @@ void CppWriter::printInstruction(const Instruction *I,
Out << "\", " << bbname << ");";
break;
}
- case Instruction::LandingPad: {
- break;
- }
}
DefinedValues.insert(I);
nl(Out);
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 771a50b49d..0283568f2c 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -2506,7 +2506,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
CallStack.pop_back(); // return from fn.
return true; // We succeeded at evaluating this ctor!
} else {
- // invoke, unwind, resume, unreachable.
+ // invoke, unwind, unreachable.
return false; // Cannot handle this terminator.
}
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 09edc41997..c33dec1740 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -732,11 +732,9 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
}
}
- // If the stack restore is in a return, resume, or unwind block and if there
- // are no allocas or calls between the restore and the return, nuke the
- // restore.
- if (!CannotRemove && (isa<ReturnInst>(TI) || isa<ResumeInst>(TI) ||
- isa<UnwindInst>(TI)))
+ // If the stack restore is in a return/unwind block and if there are no
+ // allocas or calls between the restore and the return, nuke the restore.
+ if (!CannotRemove && (isa<ReturnInst>(TI) || isa<UnwindInst>(TI)))
return EraseInstFromFunction(CI);
break;
}
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index ba6e51fbf5..749ba40a64 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -515,7 +515,6 @@ private:
void visitShuffleVectorInst(ShuffleVectorInst &I);
void visitExtractValueInst(ExtractValueInst &EVI);
void visitInsertValueInst(InsertValueInst &IVI);
- void visitLandingPadInst(LandingPadInst &I) { markAnythingOverdefined(&I); }
// Instructions that cannot be folded away.
void visitStoreInst (StoreInst &I);
@@ -529,7 +528,6 @@ private:
visitTerminatorInst(II);
}
void visitCallSite (CallSite CS);
- void visitResumeInst (TerminatorInst &I) { /*returns void*/ }
void visitUnwindInst (TerminatorInst &I) { /*returns void*/ }
void visitUnreachableInst(TerminatorInst &I) { /*returns void*/ }
void visitFenceInst (FenceInst &I) { /*returns void*/ }
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 484899f417..714b12c7d2 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -250,33 +250,20 @@ namespace {
PHINode *InnerSelectorPHI;
SmallVector<Value*, 8> UnwindDestPHIValues;
- // New EH:
- BasicBlock *OuterResumeDest; //< Destination of the invoke's unwind.
- BasicBlock *InnerResumeDest; //< Destination for the callee's resume.
- LandingPadInst *CallerLPad; //< LandingPadInst associated with the invoke.
- PHINode *InnerEHValuesPHI; //< PHI for EH values from landingpad insts.
-
public:
- InvokeInliningInfo(InvokeInst *II)
- : OuterUnwindDest(II->getUnwindDest()), OuterSelector(0),
- InnerUnwindDest(0), InnerExceptionPHI(0), InnerSelectorPHI(0),
-
- OuterResumeDest(II->getUnwindDest()), InnerResumeDest(0),
- CallerLPad(0), InnerEHValuesPHI(0) {
- // If there are PHI nodes in the unwind destination block, we need to keep
- // track of which values came into them from the invoke before removing
- // the edge from this block.
- llvm::BasicBlock *InvokeBB = II->getParent();
- BasicBlock::iterator I = OuterUnwindDest->begin();
- for (; isa<PHINode>(I); ++I) {
+ InvokeInliningInfo(InvokeInst *II) :
+ OuterUnwindDest(II->getUnwindDest()), OuterSelector(0),
+ InnerUnwindDest(0), InnerExceptionPHI(0), InnerSelectorPHI(0) {
+
+ // If there are PHI nodes in the unwind destination block, we
+ // need to keep track of which values came into them from the
+ // invoke before removing the edge from this block.
+ llvm::BasicBlock *invokeBB = II->getParent();
+ for (BasicBlock::iterator I = OuterUnwindDest->begin();
+ isa<PHINode>(I); ++I) {
// Save the value to use for this edge.
- PHINode *PHI = cast<PHINode>(I);
- UnwindDestPHIValues.push_back(PHI->getIncomingValueForBlock(InvokeBB));
- }
-
- // FIXME: With the new EH, this if/dyn_cast should be a 'cast'.
- if (LandingPadInst *LPI = dyn_cast<LandingPadInst>(I)) {
- CallerLPad = LPI;
+ PHINode *phi = cast<PHINode>(I);
+ UnwindDestPHIValues.push_back(phi->getIncomingValueForBlock(invokeBB));
}
}
@@ -293,30 +280,21 @@ namespace {
}
BasicBlock *getInnerUnwindDest();
- BasicBlock *getInnerUnwindDest_new();
-
- LandingPadInst *getLandingPadInst() const { return CallerLPad; }
bool forwardEHResume(CallInst *call, BasicBlock *src);
- /// forwardResume - Forward the 'resume' instruction to the caller's landing
- /// pad block. When the landing pad block has only one predecessor, this is
- /// a simple branch. When there is more than one predecessor, we need to
- /// split the landing pad block after the landingpad instruction and jump
- /// to there.
- void forwardResume(ResumeInst *RI);
-
- /// addIncomingPHIValuesFor - Add incoming-PHI values to the unwind
- /// destination block for the given basic block, using the values for the
- /// original invoke's source block.
+ /// Add incoming-PHI values to the unwind destination block for
+ /// the given basic block, using the values for the original
+ /// invoke's source block.
void addIncomingPHIValuesFor(BasicBlock *BB) const {
addIncomingPHIValuesForInto(BB, OuterUnwindDest);
}
+
void addIncomingPHIValuesForInto(BasicBlock *src, BasicBlock *dest) const {
BasicBlock::iterator I = dest->begin();
for (unsigned i = 0, e = UnwindDestPHIValues.size(); i != e; ++i, ++I) {
- PHINode *PHI = cast<PHINode>(I);
- PHI->addIncoming(UnwindDestPHIValues[i], src);
+ PHINode *phi = cast<PHINode>(I);
+ phi->addIncoming(UnwindDestPHIValues[i], src);
}
}
};
@@ -426,59 +404,6 @@ bool InvokeInliningInfo::forwardEHResume(CallInst *call, BasicBlock *src) {
return true;
}
-/// Get or create a target for the branch from ResumeInsts.
-BasicBlock *InvokeInliningInfo::getInnerUnwindDest_new() {
- if (InnerResumeDest) return InnerResumeDest;
-
- // Split the landing pad.
- BasicBlock::iterator SplitPoint = CallerLPad; ++SplitPoint;
- InnerResumeDest =
- OuterResumeDest->splitBasicBlock(SplitPoint,
- OuterResumeDest->getName() + ".body");
-
- // The number of incoming edges we expect to the inner landing pad.
- const unsigned PHICapacity = 2;
-
- // Create corresponding new PHIs for all the PHIs in the outer landing pad.
- BasicBlock::iterator InsertPoint = InnerResumeDest->begin();
- BasicBlock::iterator I = OuterResumeDest->begin();
- for (unsigned i = 0, e = UnwindDestPHIValues.size(); i != e; ++i, ++I) {
- PHINode *OuterPHI = cast<PHINode>(I);
- PHINode *InnerPHI = PHINode::Create(OuterPHI->getType(), PHICapacity,
- OuterPHI->getName() + ".lpad-body",
- InsertPoint);
- OuterPHI->replaceAllUsesWith(InnerPHI);
- InnerPHI->addIncoming(OuterPHI, OuterResumeDest);
- }
-
- // Create a PHI for the exception values.
- InnerEHValuesPHI = PHINode::Create(CallerLPad->getType(), PHICapacity,
- "eh.lpad-body", InsertPoint);
- CallerLPad->replaceAllUsesWith(InnerEHValuesPHI);
- InnerEHValuesPHI->addIncoming(CallerLPad, OuterResumeDest);
-
- // All done.
- return InnerResumeDest;
-}
-
-/// forwardResume - Forward the 'resume' instruction to the caller's landing pad
-/// block. When the landing pad block has only one predecessor, this is a simple
-/// branch. When there is more than one predecessor, we need to split the
-/// landing pad block after the landingpad instruction and jump to there.
-void InvokeInliningInfo::forwardResume(ResumeInst *RI) {
- BasicBlock *Dest = getInnerUnwindDest_new();
- BasicBlock *Src = RI->getParent();
-
- BranchInst::Create(Dest, Src);
-
- // Update the PHIs in the destination. They were inserted in an order which
- // makes this work.
- addIncomingPHIValue