mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-02 16:56:39 +00:00
[IR] Replace isa<TerminatorInst>
with isTerminator()
.
This is a bit awkward in a handful of places where we didn't even have an instruction and now we have to see if we can build one. But on the whole, this seems like a win and at worst a reasonable cost for removing `TerminatorInst`. All of this is part of the removal of `TerminatorInst` from the `Instruction` type hierarchy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340701 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8c9f47fdf1
commit
9179aee2c1
@ -955,7 +955,7 @@ exit from a function, consider this "bad" code:
|
||||
.. code-block:: c++
|
||||
|
||||
Value *doSomething(Instruction *I) {
|
||||
if (!isa<TerminatorInst>(I) &&
|
||||
if (!I->isTerminator() &&
|
||||
I->hasOneUse() && doOtherThing(I)) {
|
||||
... some long code ....
|
||||
}
|
||||
@ -980,7 +980,7 @@ It is much preferred to format the code like this:
|
||||
|
||||
Value *doSomething(Instruction *I) {
|
||||
// Terminators never need 'something' done to them because ...
|
||||
if (isa<TerminatorInst>(I))
|
||||
if (I->isTerminator())
|
||||
return 0;
|
||||
|
||||
// We conservatively avoid transforming instructions with multiple uses
|
||||
|
@ -49,8 +49,13 @@ class PredIterator : public std::iterator<std::forward_iterator_tag,
|
||||
|
||||
inline void advancePastNonTerminators() {
|
||||
// Loop to ignore non-terminator uses (for example BlockAddresses).
|
||||
while (!It.atEnd() && !isa<TerminatorInst>(*It))
|
||||
while (!It.atEnd()) {
|
||||
if (auto *Inst = dyn_cast<Instruction>(*It))
|
||||
if (Inst->isTerminator())
|
||||
break;
|
||||
|
||||
++It;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -594,7 +594,7 @@ template <typename CFLAA> class CFLGraphBuilder {
|
||||
// Determines whether or not we an instruction is useless to us (e.g.
|
||||
// FenceInst)
|
||||
static bool hasUsefulEdges(Instruction *Inst) {
|
||||
bool IsNonInvokeRetTerminator = isa<TerminatorInst>(Inst) &&
|
||||
bool IsNonInvokeRetTerminator = Inst->isTerminator() &&
|
||||
!isa<InvokeInst>(Inst) &&
|
||||
!isa<ReturnInst>(Inst);
|
||||
return !isa<CmpInst>(Inst) && !isa<FenceInst>(Inst) &&
|
||||
|
@ -78,8 +78,8 @@ void DemandedBitsWrapperPass::print(raw_ostream &OS, const Module *M) const {
|
||||
}
|
||||
|
||||
static bool isAlwaysLive(Instruction *I) {
|
||||
return isa<TerminatorInst>(I) || isa<DbgInfoIntrinsic>(I) ||
|
||||
I->isEHPad() || I->mayHaveSideEffects();
|
||||
return I->isTerminator() || isa<DbgInfoIntrinsic>(I) || I->isEHPad() ||
|
||||
I->mayHaveSideEffects();
|
||||
}
|
||||
|
||||
void DemandedBits::determineLiveOperandBits(
|
||||
|
@ -5165,7 +5165,7 @@ static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV,
|
||||
|
||||
// Gracefully handle edge cases where the instruction is not wired into any
|
||||
// parent block.
|
||||
if (I->getParent() && !I->isEHPad() && !isa<TerminatorInst>(I) &&
|
||||
if (I->getParent() && !I->isEHPad() && !I->isTerminator() &&
|
||||
!I->mayHaveSideEffects())
|
||||
I->eraseFromParent();
|
||||
} else {
|
||||
@ -5194,7 +5194,7 @@ static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV,
|
||||
|
||||
// Gracefully handle edge cases where the instruction is not wired into any
|
||||
// parent block.
|
||||
if (I->getParent() && !I->isEHPad() && !isa<TerminatorInst>(I) &&
|
||||
if (I->getParent() && !I->isEHPad() && !I->isTerminator() &&
|
||||
!I->mayHaveSideEffects())
|
||||
I->eraseFromParent();
|
||||
}
|
||||
|
@ -1572,7 +1572,7 @@ void MemoryDependenceResults::removeInstruction(Instruction *RemInst) {
|
||||
ReverseDepMapType::iterator ReverseDepIt = ReverseLocalDeps.find(RemInst);
|
||||
if (ReverseDepIt != ReverseLocalDeps.end()) {
|
||||
// RemInst can't be the terminator if it has local stuff depending on it.
|
||||
assert(!ReverseDepIt->second.empty() && !isa<TerminatorInst>(RemInst) &&
|
||||
assert(!ReverseDepIt->second.empty() && !RemInst->isTerminator() &&
|
||||
"Nothing can locally depend on a terminator");
|
||||
|
||||
for (Instruction *InstDependingOnRemInst : ReverseDepIt->second) {
|
||||
|
@ -5444,7 +5444,7 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
|
||||
|
||||
// Set the name on the instruction.
|
||||
if (PFS.SetInstName(NameID, NameStr, NameLoc, Inst)) return true;
|
||||
} while (!isa<TerminatorInst>(Inst));
|
||||
} while (!Inst->isTerminator());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -4620,7 +4620,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
|
||||
CurBB->getInstList().push_back(I);
|
||||
|
||||
// If this was a terminator instruction, move to the next block.
|
||||
if (isa<TerminatorInst>(I)) {
|
||||
if (I->isTerminator()) {
|
||||
++CurBBNo;
|
||||
CurBB = CurBBNo < FunctionBBs.size() ? FunctionBBs[CurBBNo] : nullptr;
|
||||
}
|
||||
|
@ -1577,7 +1577,7 @@ bool FastISel::selectInstruction(const Instruction *I) {
|
||||
MachineInstr *SavedLastLocalValue = getLastLocalValue();
|
||||
// Just before the terminator instruction, insert instructions to
|
||||
// feed PHI nodes in successor blocks.
|
||||
if (isa<TerminatorInst>(I)) {
|
||||
if (I->isTerminator()) {
|
||||
if (!handlePHINodesInSuccessorBlocks(I->getParent())) {
|
||||
// PHI node handling may have generated local value instructions,
|
||||
// even though it failed to handle all PHI nodes.
|
||||
@ -1641,7 +1641,7 @@ bool FastISel::selectInstruction(const Instruction *I) {
|
||||
|
||||
DbgLoc = DebugLoc();
|
||||
// Undo phi node updates, because they will be added again by SelectionDAG.
|
||||
if (isa<TerminatorInst>(I)) {
|
||||
if (I->isTerminator()) {
|
||||
// PHI node handling may have generated local value instructions.
|
||||
// We remove them because SelectionDAGISel will generate them again.
|
||||
removeDeadLocalValueCode(SavedLastLocalValue);
|
||||
|
@ -1054,7 +1054,7 @@ SDValue SelectionDAGBuilder::getControlRoot() {
|
||||
|
||||
void SelectionDAGBuilder::visit(const Instruction &I) {
|
||||
// Set up outgoing PHI node register values before emitting the terminator.
|
||||
if (isa<TerminatorInst>(&I)) {
|
||||
if (I.isTerminator()) {
|
||||
HandlePHINodesInSuccessorBlocks(I.getParent());
|
||||
}
|
||||
|
||||
@ -1082,7 +1082,7 @@ void SelectionDAGBuilder::visit(const Instruction &I) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!isa<TerminatorInst>(&I) && !HasTailCall &&
|
||||
if (!I.isTerminator() && !HasTailCall &&
|
||||
!isStatepoint(&I)) // statepoints handle their exports internally
|
||||
CopyToExportRegsIfNeeded(&I);
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ bool SelectionDAGISel::PrepareEHLandingPad() {
|
||||
static bool isFoldedOrDeadInstruction(const Instruction *I,
|
||||
FunctionLoweringInfo *FuncInfo) {
|
||||
return !I->mayWriteToMemory() && // Side-effecting instructions aren't folded.
|
||||
!isa<TerminatorInst>(I) && // Terminators aren't folded.
|
||||
!I->isTerminator() && // Terminators aren't folded.
|
||||
!isa<DbgInfoIntrinsic>(I) && // Debug instructions aren't folded.
|
||||
!I->isEHPad() && // EH pad instructions aren't folded.
|
||||
!FuncInfo->isExportedInst(I); // Exported instrs must be computed.
|
||||
@ -1688,7 +1688,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
||||
Inst->getDebugLoc(), LLVMBB);
|
||||
|
||||
bool ShouldAbort = EnableFastISelAbort;
|
||||
if (isa<TerminatorInst>(Inst)) {
|
||||
if (Inst->isTerminator()) {
|
||||
// Use a different message for terminator misses.
|
||||
R << "FastISel missed terminator";
|
||||
// Don't abort for terminator unless the level is really high
|
||||
|
@ -1074,7 +1074,7 @@ AllocaInst *WinEHPrepare::insertPHILoads(PHINode *PN, Function &F) {
|
||||
AllocaInst *SpillSlot = nullptr;
|
||||
Instruction *EHPad = PHIBlock->getFirstNonPHI();
|
||||
|
||||
if (!isa<TerminatorInst>(EHPad)) {
|
||||
if (!EHPad->isTerminator()) {
|
||||
// If the EHPad isn't a terminator, then we can insert a load in this block
|
||||
// that will dominate all uses.
|
||||
SpillSlot = new AllocaInst(PN->getType(), DL->getAllocaAddrSpace(), nullptr,
|
||||
@ -1148,8 +1148,7 @@ void WinEHPrepare::insertPHIStore(
|
||||
BasicBlock *PredBlock, Value *PredVal, AllocaInst *SpillSlot,
|
||||
SmallVectorImpl<std::pair<BasicBlock *, Value *>> &Worklist) {
|
||||
|
||||
if (PredBlock->isEHPad() &&
|
||||
isa<TerminatorInst>(PredBlock->getFirstNonPHI())) {
|
||||
if (PredBlock->isEHPad() && PredBlock->getFirstNonPHI()->isTerminator()) {
|
||||
// Pred is unsplittable, so we need to queue it on the worklist.
|
||||
Worklist.push_back({PredBlock, PredVal});
|
||||
return;
|
||||
|
@ -136,7 +136,7 @@ Value *RandomIRBuilder::findPointer(BasicBlock &BB,
|
||||
auto IsMatchingPtr = [&Srcs, &Pred](Instruction *Inst) {
|
||||
// Invoke instructions sometimes produce valid pointers but currently
|
||||
// we can't insert loads or stores from them
|
||||
if (isa<TerminatorInst>(Inst))
|
||||
if (Inst->isTerminator())
|
||||
return false;
|
||||
|
||||
if (auto PtrTy = dyn_cast<PointerType>(Inst->getType())) {
|
||||
|
@ -592,7 +592,7 @@ bool Instruction::mayThrow() const {
|
||||
|
||||
bool Instruction::isSafeToRemove() const {
|
||||
return (!isa<CallInst>(this) || !this->mayHaveSideEffects()) &&
|
||||
!isa<TerminatorInst>(this);
|
||||
!this->isTerminator();
|
||||
}
|
||||
|
||||
const Instruction *Instruction::getNextNonDebugInstruction() const {
|
||||
|
@ -546,7 +546,8 @@ static Instruction *insertSpills(SpillInfo &Spills, coro::Shape &Shape) {
|
||||
} else {
|
||||
// For all other values, the spill is placed immediately after
|
||||
// the definition.
|
||||
assert(!isa<TerminatorInst>(E.def()) && "unexpected terminator");
|
||||
assert(!cast<Instruction>(E.def())->isTerminator() &&
|
||||
"unexpected terminator");
|
||||
InsertPt = cast<Instruction>(E.def())->getNextNode();
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ static bool simplifyTerminatorLeadingToRet(Instruction *InitialInst) {
|
||||
DenseMap<Value *, Value *> ResolvedValues;
|
||||
|
||||
Instruction *I = InitialInst;
|
||||
while (isa<TerminatorInst>(I)) {
|
||||
while (I->isTerminator()) {
|
||||
if (isa<ReturnInst>(I)) {
|
||||
if (I != InitialInst)
|
||||
ReplaceInstWithInst(InitialInst, I->clone());
|
||||
|
@ -255,7 +255,7 @@ static void DeleteBasicBlock(BasicBlock *BB, CallGraph &CG) {
|
||||
}
|
||||
|
||||
if (TokenInst) {
|
||||
if (!isa<TerminatorInst>(TokenInst))
|
||||
if (!TokenInst->isTerminator())
|
||||
changeToUnreachable(TokenInst->getNextNode(), /*UseLLVMTrap=*/false);
|
||||
} else {
|
||||
// Get the list of successors of this block.
|
||||
|
@ -222,8 +222,11 @@ Instruction *InstCombiner::FoldIntegerTypedPHI(PHINode &PN) {
|
||||
// instruction, do not do it.
|
||||
if (std::any_of(AvailablePtrVals.begin(), AvailablePtrVals.end(),
|
||||
[&](Value *V) {
|
||||
return (V->getType() != IntToPtr->getType()) &&
|
||||
isa<TerminatorInst>(V);
|
||||
if (V->getType() == IntToPtr->getType())
|
||||
return false;
|
||||
|
||||
auto *Inst = dyn_cast<Instruction>(V);
|
||||
return Inst && Inst->isTerminator();
|
||||
}))
|
||||
return nullptr;
|
||||
|
||||
|
@ -2902,7 +2902,7 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
|
||||
|
||||
// Cannot move control-flow-involving, volatile loads, vaarg, etc.
|
||||
if (isa<PHINode>(I) || I->isEHPad() || I->mayHaveSideEffects() ||
|
||||
isa<TerminatorInst>(I))
|
||||
I->isTerminator())
|
||||
return false;
|
||||
|
||||
// Do not sink alloca instructions out of the entry block.
|
||||
|
@ -925,7 +925,7 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
|
||||
Instruction *Next = Inst->getNextNode();
|
||||
// DFSanVisitor may delete Inst, so keep track of whether it was a
|
||||
// terminator.
|
||||
bool IsTerminator = isa<TerminatorInst>(Inst);
|
||||
bool IsTerminator = Inst->isTerminator();
|
||||
if (!DFSF.SkipInsts.count(Inst))
|
||||
DFSanVisitor(DFSF).visit(Inst);
|
||||
if (IsTerminator)
|
||||
|
@ -331,7 +331,7 @@ bool AggressiveDeadCodeElimination::isAlwaysLive(Instruction &I) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (!isa<TerminatorInst>(I))
|
||||
if (!I.isTerminator())
|
||||
return false;
|
||||
if (RemoveControlFlowFlag && (isa<BranchInst>(I) || isa<SwitchInst>(I)))
|
||||
return false;
|
||||
|
@ -1933,7 +1933,7 @@ bool GVN::processInstruction(Instruction *I) {
|
||||
|
||||
// Allocations are always uniquely numbered, so we can save time and memory
|
||||
// by fast failing them.
|
||||
if (isa<AllocaInst>(I) || isa<TerminatorInst>(I) || isa<PHINode>(I)) {
|
||||
if (isa<AllocaInst>(I) || I->isTerminator() || isa<PHINode>(I)) {
|
||||
addToLeaderTable(Num, I, I->getParent());
|
||||
return false;
|
||||
}
|
||||
@ -2139,7 +2139,7 @@ bool GVN::performScalarPREInsertion(Instruction *Instr, BasicBlock *Pred,
|
||||
}
|
||||
|
||||
bool GVN::performScalarPRE(Instruction *CurInst) {
|
||||
if (isa<AllocaInst>(CurInst) || isa<TerminatorInst>(CurInst) ||
|
||||
if (isa<AllocaInst>(CurInst) || CurInst->isTerminator() ||
|
||||
isa<PHINode>(CurInst) || CurInst->getType()->isVoidTy() ||
|
||||
CurInst->mayReadFromMemory() || CurInst->mayHaveSideEffects() ||
|
||||
isa<DbgInfoIntrinsic>(CurInst))
|
||||
|
@ -1100,7 +1100,7 @@ private:
|
||||
break;
|
||||
|
||||
// Do not value number terminator instructions.
|
||||
if (isa<TerminatorInst>(&I1))
|
||||
if (I1.isTerminator())
|
||||
break;
|
||||
|
||||
if (auto *Load = dyn_cast<LoadInst>(&I1))
|
||||
|
@ -1978,7 +1978,7 @@ bool JumpThreadingPass::ThreadEdge(BasicBlock *BB,
|
||||
|
||||
// Clone the non-phi instructions of BB into NewBB, keeping track of the
|
||||
// mapping and using it to remap operands in the cloned instructions.
|
||||
for (; !isa<TerminatorInst>(BI); ++BI) {
|
||||
for (; !BI->isTerminator(); ++BI) {
|
||||
Instruction *New = BI->clone();
|
||||
New->setName(BI->getName());
|
||||
NewBB->getInstList().push_back(New);
|
||||
|
@ -398,7 +398,7 @@ Instruction *MemCpyOptPass::tryMergingIntoMemset(Instruction *StartInst,
|
||||
MemsetRanges Ranges(DL);
|
||||
|
||||
BasicBlock::iterator BI(StartInst);
|
||||
for (++BI; !isa<TerminatorInst>(BI); ++BI) {
|
||||
for (++BI; !BI->isTerminator(); ++BI) {
|
||||
if (!isa<StoreInst>(BI) && !isa<MemSetInst>(BI)) {
|
||||
// If the instruction is readnone, ignore it, otherwise bail out. We
|
||||
// don't even allow readonly here because we don't want something like:
|
||||
|
@ -2925,7 +2925,7 @@ void NewGVN::initializeCongruenceClasses(Function &F) {
|
||||
PHINodeUses.insert(UInst);
|
||||
// Don't insert void terminators into the class. We don't value number
|
||||
// them, and they just end up sitting in TOP.
|
||||
if (isa<TerminatorInst>(I) && I.getType()->isVoidTy())
|
||||
if (I.isTerminator() && I.getType()->isVoidTy())
|
||||
continue;
|
||||
TOPClass->insert(&I);
|
||||
ValueToClass[&I] = TOPClass;
|
||||
|
@ -1784,7 +1784,7 @@ static bool runSCCP(Function &F, const DataLayout &DL,
|
||||
// constants if we have found them to be of constant values.
|
||||
for (BasicBlock::iterator BI = BB.begin(), E = BB.end(); BI != E;) {
|
||||
Instruction *Inst = &*BI++;
|
||||
if (Inst->getType()->isVoidTy() || isa<TerminatorInst>(Inst))
|
||||
if (Inst->getType()->isVoidTy() || Inst->isTerminator())
|
||||
continue;
|
||||
|
||||
if (tryToReplaceWithConstant(Solver, Inst)) {
|
||||
|
@ -72,7 +72,7 @@ static bool isSafeToMove(Instruction *Inst, AliasAnalysis &AA,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isa<TerminatorInst>(Inst) || isa<PHINode>(Inst) || Inst->isEHPad() ||
|
||||
if (Inst->isTerminator() || isa<PHINode>(Inst) || Inst->isEHPad() ||
|
||||
Inst->mayThrow())
|
||||
return false;
|
||||
|
||||
|
@ -90,7 +90,7 @@ AllocaInst *llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
|
||||
// careful if I is an invoke instruction, because we can't insert the store
|
||||
// AFTER the terminator instruction.
|
||||
BasicBlock::iterator InsertPt;
|
||||
if (!isa<TerminatorInst>(I)) {
|
||||
if (!I.isTerminator()) {
|
||||
InsertPt = ++I.getIterator();
|
||||
for (; isa<PHINode>(InsertPt) || InsertPt->isEHPad(); ++InsertPt)
|
||||
/* empty */; // Don't insert before PHI nodes or landingpad instrs.
|
||||
|
@ -578,7 +578,7 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst,
|
||||
<< "Successfully evaluated function. Result: 0\n\n");
|
||||
}
|
||||
}
|
||||
} else if (isa<TerminatorInst>(CurInst)) {
|
||||
} else if (CurInst->isTerminator()) {
|
||||
LLVM_DEBUG(dbgs() << "Found a terminator instruction.\n");
|
||||
|
||||
if (BranchInst *BI = dyn_cast<BranchInst>(CurInst)) {
|
||||
|
@ -354,7 +354,7 @@ bool llvm::isInstructionTriviallyDead(Instruction *I,
|
||||
|
||||
bool llvm::wouldInstructionBeTriviallyDead(Instruction *I,
|
||||
const TargetLibraryInfo *TLI) {
|
||||
if (isa<TerminatorInst>(I))
|
||||
if (I->isTerminator())
|
||||
return false;
|
||||
|
||||
// We don't want the landingpad-like instructions removed by anything this
|
||||
|
@ -326,7 +326,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
|
||||
// something that might trap, but isn't safe to hoist something that reads
|
||||
// memory (without proving that the loop doesn't write).
|
||||
if (L->hasLoopInvariantOperands(Inst) && !Inst->mayReadFromMemory() &&
|
||||
!Inst->mayWriteToMemory() && !isa<TerminatorInst>(Inst) &&
|
||||
!Inst->mayWriteToMemory() && !Inst->isTerminator() &&
|
||||
!isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst)) {
|
||||
Inst->moveBefore(LoopEntryBranch);
|
||||
continue;
|
||||
|
@ -951,7 +951,7 @@ NextIteration:
|
||||
if (!Visited.insert(BB).second)
|
||||
return;
|
||||
|
||||
for (BasicBlock::iterator II = BB->begin(); !isa<TerminatorInst>(II);) {
|
||||
for (BasicBlock::iterator II = BB->begin(); !II->isTerminator();) {
|
||||
Instruction *I = &*II++; // get the instruction, increment iterator
|
||||
|
||||
if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
|
||||
|
@ -1270,7 +1270,7 @@ static bool HoistThenElseCodeToIf(BranchInst *BI,
|
||||
do {
|
||||
// If we are hoisting the terminator instruction, don't move one (making a
|
||||
// broken BB), instead clone it, and remove BI.
|
||||
if (isa<TerminatorInst>(I1))
|
||||
if (I1->isTerminator())
|
||||
goto HoistTerminator;
|
||||
|
||||
// If we're going to hoist a call, make sure that the two instructions we're
|
||||
@ -2336,8 +2336,7 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
|
||||
IfBlock1 = nullptr;
|
||||
} else {
|
||||
DomBlock = *pred_begin(IfBlock1);
|
||||
for (BasicBlock::iterator I = IfBlock1->begin(); !isa<TerminatorInst>(I);
|
||||
++I)
|
||||
for (BasicBlock::iterator I = IfBlock1->begin(); !I->isTerminator(); ++I)
|
||||
if (!AggressiveInsts.count(&*I) && !isa<DbgInfoIntrinsic>(I)) {
|
||||
// This is not an aggressive instruction that we can promote.
|
||||
// Because of this, we won't be able to get rid of the control flow, so
|
||||
@ -2350,8 +2349,7 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
|
||||
IfBlock2 = nullptr;
|
||||
} else {
|
||||
DomBlock = *pred_begin(IfBlock2);
|
||||
for (BasicBlock::iterator I = IfBlock2->begin(); !isa<TerminatorInst>(I);
|
||||
++I)
|
||||
for (BasicBlock::iterator I = IfBlock2->begin(); !I->isTerminator(); ++I)
|
||||
if (!AggressiveInsts.count(&*I) && !isa<DbgInfoIntrinsic>(I)) {
|
||||
// This is not an aggressive instruction that we can promote.
|
||||
// Because of this, we won't be able to get rid of the control flow, so
|
||||
@ -2922,7 +2920,7 @@ static bool mergeConditionalStoreToAddress(BasicBlock *PTB, BasicBlock *PFB,
|
||||
isa<StoreInst>(I))
|
||||
++N;
|
||||
// Free instructions.
|
||||
else if (isa<TerminatorInst>(I) || IsaBitcastOfPointerType(I))
|
||||
else if (I.isTerminator() || IsaBitcastOfPointerType(I))
|
||||
continue;
|
||||
else
|
||||
return false;
|
||||
|
@ -703,7 +703,7 @@ bool ReduceCrashingInstructions::TestInsts(
|
||||
// Convert list to set for fast lookup...
|
||||
SmallPtrSet<Instruction *, 32> Instructions;
|
||||
for (unsigned i = 0, e = Insts.size(); i != e; ++i) {
|
||||
assert(!isa<TerminatorInst>(Insts[i]));
|
||||
assert(!Insts[i]->isTerminator());
|
||||
Instructions.insert(cast<Instruction>(VMap[Insts[i]]));
|
||||
}
|
||||
|
||||
@ -717,7 +717,7 @@ bool ReduceCrashingInstructions::TestInsts(
|
||||
for (Function::iterator FI = MI->begin(), FE = MI->end(); FI != FE; ++FI)
|
||||
for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E;) {
|
||||
Instruction *Inst = &*I++;
|
||||
if (!Instructions.count(Inst) && !isa<TerminatorInst>(Inst) &&
|
||||
if (!Instructions.count(Inst) && !Inst->isTerminator() &&
|
||||
!Inst->isEHPad() && !Inst->getType()->isTokenTy() &&
|
||||
!Inst->isSwiftError()) {
|
||||
if (!Inst->getType()->isVoidTy())
|
||||
@ -950,7 +950,7 @@ static Error ReduceInsts(BugDriver &BD, BugTester TestFn) {
|
||||
for (const Function &F : BD.getProgram())
|
||||
for (const BasicBlock &BB : F)
|
||||
for (const Instruction &I : BB)
|
||||
if (!isa<TerminatorInst>(&I))
|
||||
if (!I.isTerminator())
|
||||
Insts.push_back(&I);
|
||||
|
||||
Expected<bool> Result =
|
||||
|
@ -552,7 +552,7 @@ struct SalvageDebugInfoTest : ::testing::Test {
|
||||
auto DI = dyn_cast<DbgValueInst>(&I);
|
||||
if (!DI) {
|
||||
// The function should only contain debug values and a terminator.
|
||||
ASSERT_TRUE(isa<TerminatorInst>(&I));
|
||||
ASSERT_TRUE(I.isTerminator());
|
||||
continue;
|
||||
}
|
||||
EXPECT_EQ(DI->getVariable()->getName(), "x");
|
||||
|
Loading…
Reference in New Issue
Block a user