Change some dyn_cast to more apropriate isa. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357773 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fangrui Song 2019-04-05 16:16:23 +00:00
parent ca728263d8
commit 360e56327d
10 changed files with 13 additions and 13 deletions

View File

@ -1231,7 +1231,7 @@ static bool isGOTEquivalentCandidate(const GlobalVariable *GV,
// GlobalVariable or Function, i.e., as GlobalValue.
if (!GV->hasGlobalUnnamedAddr() || !GV->hasInitializer() ||
!GV->isConstant() || !GV->isDiscardableIfUnused() ||
!dyn_cast<GlobalValue>(GV->getOperand(0)))
!isa<GlobalValue>(GV->getOperand(0)))
return false;
// To be a got equivalent, at least one of its users need to be a constant

View File

@ -514,7 +514,7 @@ BasicBlock *StackProtector::CreateFailBB() {
}
bool StackProtector::shouldEmitSDCheck(const BasicBlock &BB) const {
return HasPrologue && !HasIRCheck && dyn_cast<ReturnInst>(BB.getTerminator());
return HasPrologue && !HasIRCheck && isa<ReturnInst>(BB.getTerminator());
}
void StackProtector::copyToMachineFrameInfo(MachineFrameInfo &MFI) const {

View File

@ -125,7 +125,7 @@ public:
bool isMem() const override { return false; }
bool isConstantImm() const {
return isImm() && dyn_cast<MCConstantExpr>(getImm());
return isImm() && isa<MCConstantExpr>(getImm());
}
int64_t getConstantImm() const {

View File

@ -278,7 +278,7 @@ class Su_ni1<PatFrag Op>
if (hasOneUse(N)){
// Check if Op1 is an immediate operand.
SDValue Op1 = N->getOperand(1);
return !dyn_cast<ConstantSDNode>(Op1);
return !isa<ConstantSDNode>(Op1);
}
return false;}],
Op.OperandTransform>;

View File

@ -2129,7 +2129,7 @@ bool X86DAGToDAGISel::selectLEA64_32Addr(SDValue N, SDValue &Base,
RegisterSDNode *RN = dyn_cast<RegisterSDNode>(Base);
if (RN && RN->getReg() == 0)
Base = CurDAG->getRegister(0, MVT::i64);
else if (Base.getValueType() == MVT::i32 && !dyn_cast<FrameIndexSDNode>(Base)) {
else if (Base.getValueType() == MVT::i32 && !isa<FrameIndexSDNode>(Base)) {
// Base could already be %rip, particularly in the x32 ABI.
SDValue ImplDef = SDValue(CurDAG->getMachineNode(X86::IMPLICIT_DEF, DL,
MVT::i64), 0);

View File

@ -1329,7 +1329,7 @@ void SampleProfileLoader::propagateWeights(Function &F) {
annotateValueSite(*I.getParent()->getParent()->getParent(), I,
SortedCallTargets, Sum, IPVK_IndirectCallTarget,
SortedCallTargets.size());
} else if (!dyn_cast<IntrinsicInst>(&I)) {
} else if (!isa<IntrinsicInst>(&I)) {
I.setMetadata(LLVMContext::MD_prof,
MDB.createBranchWeights(
{static_cast<uint32_t>(BlockWeights[BB])}));

View File

@ -238,7 +238,7 @@ ICallPromotionFunc::getPromotionCandidatesForCallSite(
LLVM_DEBUG(dbgs() << " Candidate " << I << " Count=" << Count
<< " Target_func: " << Target << "\n");
if (ICPInvokeOnly && dyn_cast<CallInst>(Inst)) {
if (ICPInvokeOnly && isa<CallInst>(Inst)) {
LLVM_DEBUG(dbgs() << " Not promote: User options.\n");
ORE.emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "UserOptions", Inst)
@ -246,7 +246,7 @@ ICallPromotionFunc::getPromotionCandidatesForCallSite(
});
break;
}
if (ICPCallOnly && dyn_cast<InvokeInst>(Inst)) {
if (ICPCallOnly && isa<InvokeInst>(Inst)) {
LLVM_DEBUG(dbgs() << " Not promote: User option.\n");
ORE.emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "UserOptions", Inst)

View File

@ -1369,7 +1369,7 @@ void MemIntrinsicVisitor::instrumentOneMemIntrinsic(MemIntrinsic &MI) {
Type *Int64Ty = Builder.getInt64Ty();
Type *I8PtrTy = Builder.getInt8PtrTy();
Value *Length = MI.getLength();
assert(!dyn_cast<ConstantInt>(Length));
assert(!isa<ConstantInt>(Length));
Builder.CreateCall(
Intrinsic::getDeclaration(M, Intrinsic::instrprof_value_profile),
{ConstantExpr::getBitCast(FuncNameVar, I8PtrTy),

View File

@ -329,7 +329,7 @@ bool CodeExtractor::isLegalToShrinkwrapLifetimeMarkers(
if (dyn_cast<Constant>(MemAddr))
break;
Value *Base = MemAddr->stripInBoundsConstantOffsets();
if (!dyn_cast<AllocaInst>(Base) || Base == AI)
if (!isa<AllocaInst>(Base) || Base == AI)
return false;
break;
}

View File

@ -129,7 +129,7 @@ FunctionImportGlobalProcessing::getLinkage(const GlobalValue *SGV,
// definitions upon import, so that they are available for inlining
// and/or optimization, but are turned into declarations later
// during the EliminateAvailableExternally pass.
if (doImportAsDefinition(SGV) && !dyn_cast<GlobalAlias>(SGV))
if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV))
return GlobalValue::AvailableExternallyLinkage;
// An imported external declaration stays external.
return SGV->getLinkage();
@ -158,7 +158,7 @@ FunctionImportGlobalProcessing::getLinkage(const GlobalValue *SGV,
// equivalent, so the issue described above for weak_any does not exist,
// and the definition can be imported. It can be treated similarly
// to an imported externally visible global value.
if (doImportAsDefinition(SGV) && !dyn_cast<GlobalAlias>(SGV))
if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV))
return GlobalValue::AvailableExternallyLinkage;
else
return GlobalValue::ExternalLinkage;
@ -176,7 +176,7 @@ FunctionImportGlobalProcessing::getLinkage(const GlobalValue *SGV,
// If we are promoting the local to global scope, it is handled
// similarly to a normal externally visible global.
if (DoPromote) {
if (doImportAsDefinition(SGV) && !dyn_cast<GlobalAlias>(SGV))
if (doImportAsDefinition(SGV) && !isa<GlobalAlias>(SGV))
return GlobalValue::AvailableExternallyLinkage;
else
return GlobalValue::ExternalLinkage;