1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[Statepoint] Replace uses of isX functions with idiomatic isa<X>

Now that all of the statepoint related routines have classes with isa support, let's cleanup.

I'm leaving the (dead) utitilities in tree for a few days so that I can do the same cleanup downstream without breakage.
This commit is contained in:
Philip Reames 2020-05-27 18:31:00 -07:00
parent ea75ead8b0
commit 0fc6f7056b
9 changed files with 14 additions and 12 deletions

View File

@ -576,7 +576,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
SmallVector<Instruction *, 2> Statepoints;
for (BasicBlock &BB : F)
for (Instruction &I : BB)
if (isStatepoint(I))
if (isa<GCStatepointInst>(I))
Statepoints.push_back(&I);
for (auto &I : Statepoints)
EverMadeChange |= simplifyOffsetableRelocate(*I);

View File

@ -1134,7 +1134,7 @@ void SelectionDAGBuilder::visit(const Instruction &I) {
}
if (!I.isTerminator() && !HasTailCall &&
!isStatepoint(&I)) // statepoints handle their exports internally
!isa<GCStatepointInst>(I)) // statepoints handle their exports internally
CopyToExportRegsIfNeeded(&I);
CurInst = nullptr;
@ -2827,7 +2827,7 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) {
// available as a virtual register.
// We already took care of the exported value for the statepoint instruction
// during call to the LowerStatepoint.
if (!isStatepoint(I)) {
if (!isa<GCStatepointInst>(I)) {
CopyToExportRegsIfNeeded(&I);
}

View File

@ -1518,8 +1518,8 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
// to keep track of gc-relocates for a particular gc-statepoint. This is
// done by SelectionDAGBuilder::LowerAsSTATEPOINT, called before
// visitGCRelocate.
if (isa<CallInst>(Inst) && !isStatepoint(Inst) && !isGCRelocate(Inst) &&
!isGCResult(Inst)) {
if (isa<CallInst>(Inst) && !isa<GCStatepointInst>(Inst) &&
!isa<GCRelocateInst>(Inst) && !isa<GCResultInst>(Inst)) {
OptimizationRemarkMissed R("sdagisel", "FastISelFailure",
Inst->getDebugLoc(), LLVMBB);

View File

@ -783,7 +783,7 @@ void GCPtrTracker::transferBlock(const BasicBlock *BB, BasicBlockState &BBS,
void GCPtrTracker::transferInstruction(const Instruction &I, bool &Cleared,
AvailableValueSet &Available) {
if (isStatepoint(I)) {
if (isa<GCStatepointInst>(I)) {
Cleared = true;
Available.clear();
} else if (containsGCPtrType(I.getType()))

View File

@ -4702,14 +4702,14 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
LandingPad->getParent());
Assert(InvokeBB->getTerminator(), "safepoint block should be well formed",
InvokeBB);
Assert(isStatepoint(InvokeBB->getTerminator()),
Assert(isa<GCStatepointInst>(InvokeBB->getTerminator()),
"gc relocate should be linked to a statepoint", InvokeBB);
} else {
// In all other cases relocate should be tied to the statepoint directly.
// This covers relocates on a normal return path of invoke statepoint and
// relocates of a call statepoint.
auto Token = Call.getArgOperand(0);
Assert(isa<Instruction>(Token) && isStatepoint(cast<Instruction>(Token)),
Assert(isa<GCStatepointInst>(Token),
"gc relocate is incorrectly tied to the statepoint", Call, Token);
}

View File

@ -4387,7 +4387,8 @@ static bool isSafeToEliminateVarargsCast(const CallBase &Call,
// TODO: This is probably something which should be expanded to all
// intrinsics since the entire point of intrinsics is that
// they are understandable by the optimizer.
if (isStatepoint(&Call) || isGCRelocate(&Call) || isGCResult(&Call))
if (isa<GCStatepointInst>(Call) || isa<GCRelocateInst>(Call) ||
isa<GCResultInst>(Call))
return false;
// The size of ByVal or InAlloca arguments is derived from the type, so we

View File

@ -189,7 +189,8 @@ static bool needsStatepoint(CallBase *Call, const TargetLibraryInfo &TLI) {
return false;
}
return !(isStatepoint(Call) || isGCRelocate(Call) || isGCResult(Call));
return !(isa<GCStatepointInst>(Call) || isa<GCRelocateInst>(Call) ||
isa<GCResultInst>(Call));
}
/// Returns true if this loop is known to contain a call safepoint which

View File

@ -2586,7 +2586,7 @@ bool RewriteStatepointsForGC::runOnFunction(Function &F, DominatorTree &DT,
auto NeedsRewrite = [&TLI](Instruction &I) {
if (const auto *Call = dyn_cast<CallBase>(&I))
return !callsGCLeafFunction(Call, TLI) && !isStatepoint(Call);
return !callsGCLeafFunction(Call, TLI) && !isa<GCStatepointInst>(Call);
return false;
};

View File

@ -48,7 +48,7 @@ bool StripGCRelocates::runOnFunction(Function &F) {
// i.e. not bound to a single statepoint token.
for (Instruction &I : instructions(F)) {
if (auto *GCR = dyn_cast<GCRelocateInst>(&I))
if (isStatepoint(GCR->getOperand(0)))
if (isa<GCStatepointInst>(GCR->getOperand(0)))
GCRelocates.push_back(GCR);
}
// All gc.relocates are bound to a single statepoint token. The order of