CRI.getNumOperands(),
CRI.getNumOperands()) {
SubclassOptionalData = CRI.SubclassOptionalData;
+ setInstructionSubclassData(CRI.getSubclassDataFromInstruction());
if (Value *RetVal = CRI.getReturnValue())
setReturnValue(RetVal);
if (BasicBlock *UnwindDest = CRI.getUnwindDest())
CRI.getNumOperands(),
CRI.getNumOperands()) {
SubclassOptionalData = CRI.SubclassOptionalData;
+ setInstructionSubclassData(CRI.getSubclassDataFromInstruction());
if (BasicBlock *UnwindDest = CRI.getUnwindDest())
setUnwindDest(UnwindDest);
}
// TerminatePadInst Implementation
//===----------------------------------------------------------------------===//
void TerminatePadInst::init(BasicBlock *BB, ArrayRef<Value *> Args,
- const Twine &NameStr) {
+ const Twine &NameStr) {
SubclassOptionalData = 0;
if (BB)
setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
TPI.getNumOperands(),
TPI.getNumOperands()) {
SubclassOptionalData = TPI.SubclassOptionalData;
+ setInstructionSubclassData(TPI.getSubclassDataFromInstruction());
std::copy(TPI.op_begin(), TPI.op_end(), op_begin());
}
}
if (ShouldExtractLoop) {
- // We must omit landing pads. Landing pads must accompany the invoke
+ // We must omit EH pads. EH pads must accompany the invoke
// instruction. But this would result in a loop in the extracted
// function. An infinite cycle occurs when it tries to extract that loop as
// well.
SmallVector<BasicBlock*, 8> ExitBlocks;
L->getExitBlocks(ExitBlocks);
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i)
- if (ExitBlocks[i]->isLandingPad()) {
+ if (ExitBlocks[i]->isEHPad()) {
ShouldExtractLoop = false;
break;
}
return false;
}
- if (LoadBB->isLandingPad()) {
+ if (LoadBB->isEHPad()) {
DEBUG(dbgs()
- << "COULD NOT PRE LOAD BECAUSE OF LANDING PAD CRITICAL EDGE '"
+ << "COULD NOT PRE LOAD BECAUSE OF AN EH PAD CRITICAL EDGE '"
<< Pred->getName() << "': " << *LI << '\n');
return false;
}
if (CurrentBlock == &F.getEntryBlock())
continue;
- // Don't perform PRE on a landing pad.
- if (CurrentBlock->isLandingPad())
+ // Don't perform PRE on an EH pad.
+ if (CurrentBlock->isEHPad())
continue;
for (BasicBlock::iterator BI = CurrentBlock->begin(),
if (LoadBB->getSinglePredecessor())
return false;
- // If the load is defined in a landing pad, it can't be partially redundant,
- // because the edges between the invoke and the landing pad cannot have other
+ // If the load is defined in an EH pad, it can't be partially redundant,
+ // because the edges between the invoke and the EH pad cannot have other
// instructions between them.
- if (LoadBB->isLandingPad())
+ if (LoadBB->isEHPad())
return false;
Value *LoadedPtr = LI->getOperand(0);
void visitExtractValueInst(ExtractValueInst &EVI);
void visitInsertValueInst(InsertValueInst &IVI);
void visitLandingPadInst(LandingPadInst &I) { markAnythingOverdefined(&I); }
+ void visitCleanupPadInst(CleanupPadInst &CPI) { markAnythingOverdefined(&CPI); }
+ void visitCatchPadInst(CatchPadInst &CPI) {
+ markAnythingOverdefined(&CPI);
+ visitTerminatorInst(CPI);
+ }
// Instructions that cannot be folded away.
void visitStoreInst (StoreInst &I);
Instruction *Inst = --I;
if (!Inst->use_empty())
Inst->replaceAllUsesWith(UndefValue::get(Inst->getType()));
- if (isa<LandingPadInst>(Inst)) {
+ if (Inst->isEHPad()) {
EndInst = Inst;
continue;
}
BasicBlock *TIBB = TI->getParent();
BasicBlock *DestBB = TI->getSuccessor(SuccNum);
- // Splitting the critical edge to a landing pad block is non-trivial. Don't do
+ // Splitting the critical edge to a pad block is non-trivial. Don't do
// it in this generic function.
- if (DestBB->isLandingPad()) return nullptr;
+ if (DestBB->isEHPad()) return nullptr;
// Create a new basic block, linking it into the CFG.
BasicBlock *NewBB = BasicBlock::Create(TI->getContext(),
LoopPreds.push_back(P);
}
if (!LoopPreds.empty()) {
- assert(!DestBB->isLandingPad() &&
- "We don't split edges to landing pads!");
+ assert(!DestBB->isEHPad() && "We don't split edges to EH pads!");
BasicBlock *NewExitBB = SplitBlockPredecessors(
DestBB, LoopPreds, "split", DT, LI, Options.PreserveLCSSA);
if (Options.PreserveLCSSA)
/// \brief Test whether a block is valid for extraction.
static bool isBlockValidForExtraction(const BasicBlock &BB) {
// Landing pads must be in the function where they were inserted for cleanup.
- if (BB.isLandingPad())
+ if (BB.isEHPad())
return false;
// Don't hoist code containing allocas, invokes, or vastarts.
if (!isa<TerminatorInst>(I)) {
InsertPt = &I;
++InsertPt;
- for (; isa<PHINode>(InsertPt) || isa<LandingPadInst>(InsertPt); ++InsertPt)
+ for (; isa<PHINode>(InsertPt) || InsertPt->isEHPad(); ++InsertPt)
/* empty */; // Don't insert before PHI nodes or landingpad instrs.
} else {
InvokeInst &II = cast<InvokeInst>(I);
// The header is not a landing pad; preheader insertion should ensure this.
BasicBlock *Header = L->getHeader();
- assert(!Header->isLandingPad() && "Can't insert backedge to landing pad");
- if (!Header->canSplitPredecessors())
- return nullptr;
+ assert(!Header->isEHPad() && "Can't insert backedge to EH pad");
PHINode *PN = findPHIToPartitionLoops(L, DT, AC);
if (!PN) return nullptr; // No known way to partition.
if (!Preheader)
return nullptr;
- // The header is not a landing pad; preheader insertion should ensure this.
- assert(!Header->isLandingPad() && "Can't insert backedge to landing pad");
+ // The header is not an EH pad; preheader insertion should ensure this.
+ assert(!Header->isEHPad() && "Can't insert backedge to EH pad");
// Figure out which basic blocks contain back-edges to the loop header.
std::vector<BasicBlock*> BackedgeBlocks;