1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[llvm] Use isa instead of dyn_cast (NFC)

This commit is contained in:
Kazu Hirata 2021-01-29 23:23:37 -08:00
parent 95dfb94fbd
commit ab8cd6c8fd
10 changed files with 15 additions and 16 deletions

View File

@ -521,7 +521,7 @@ SDValue AVRTargetLowering::getAVRCmp(SDValue LHS, SDValue RHS,
SDValue Cmp;
if (LHS.getSimpleValueType() == MVT::i16 && dyn_cast<ConstantSDNode>(RHS)) {
if (LHS.getSimpleValueType() == MVT::i16 && isa<ConstantSDNode>(RHS)) {
// Generate a CPI/CPC pair if RHS is a 16-bit constant.
SDValue LHSlo = DAG.getNode(ISD::EXTRACT_ELEMENT, DL, MVT::i8, LHS,
DAG.getIntPtrConstant(0, DL));

View File

@ -268,9 +268,9 @@ bool BPFAdjustOptImpl::avoidSpeculation(Instruction &I) {
// load/store insn before this instruction in this basic
// block. Most likely it cannot be hoisted out. Skip it.
for (auto &I2 : *Inst->getParent()) {
if (dyn_cast<CallInst>(&I2))
if (isa<CallInst>(&I2))
return false;
if (dyn_cast<LoadInst>(&I2) || dyn_cast<StoreInst>(&I2))
if (isa<LoadInst>(&I2) || isa<StoreInst>(&I2))
return false;
if (&I2 == Inst)
break;

View File

@ -4924,7 +4924,7 @@ static bool isIndirectCall(const SDValue &Callee, SelectionDAG &DAG,
if (isPatchPoint)
return false;
if (isFunctionGlobalAddress(Callee) || dyn_cast<ExternalSymbolSDNode>(Callee))
if (isFunctionGlobalAddress(Callee) || isa<ExternalSymbolSDNode>(Callee))
return false;
// Darwin, and 32-bit ELF can use a BLA. The descriptor based ABIs can not

View File

@ -180,7 +180,7 @@ bool VEDAGToDAGISel::selectADDRrri(SDValue Addr, SDValue &Base, SDValue &Index,
// %dest, #FI, %reg, offset
// In the eliminateFrameIndex, above MI is converted to the following.
// %dest, %fp, %reg, fi_offset + offset
if (dyn_cast<FrameIndexSDNode>(RHS))
if (isa<FrameIndexSDNode>(RHS))
std::swap(LHS, RHS);
if (matchADDRri(RHS, Index, Offset)) {
@ -220,9 +220,8 @@ bool VEDAGToDAGISel::selectADDRzri(SDValue Addr, SDValue &Base, SDValue &Index,
bool VEDAGToDAGISel::selectADDRzii(SDValue Addr, SDValue &Base, SDValue &Index,
SDValue &Offset) {
if (dyn_cast<FrameIndexSDNode>(Addr)) {
if (isa<FrameIndexSDNode>(Addr))
return false;
}
if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
Addr.getOpcode() == ISD::TargetGlobalAddress ||
Addr.getOpcode() == ISD::TargetGlobalTLSAddress)
@ -252,7 +251,7 @@ bool VEDAGToDAGISel::selectADDRri(SDValue Addr, SDValue &Base,
bool VEDAGToDAGISel::selectADDRzi(SDValue Addr, SDValue &Base,
SDValue &Offset) {
if (dyn_cast<FrameIndexSDNode>(Addr))
if (isa<FrameIndexSDNode>(Addr))
return false;
if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
Addr.getOpcode() == ISD::TargetGlobalAddress ||
@ -271,7 +270,7 @@ bool VEDAGToDAGISel::selectADDRzi(SDValue Addr, SDValue &Base,
}
bool VEDAGToDAGISel::matchADDRrr(SDValue Addr, SDValue &Base, SDValue &Index) {
if (dyn_cast<FrameIndexSDNode>(Addr))
if (isa<FrameIndexSDNode>(Addr))
return false;
if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
Addr.getOpcode() == ISD::TargetGlobalAddress ||

View File

@ -585,7 +585,7 @@ void MergeFunctions::filterInstsUnrelatedToPDI(
for (User *U : AI->users()) {
if (StoreInst *SI = dyn_cast<StoreInst>(U)) {
if (Value *Arg = SI->getValueOperand()) {
if (dyn_cast<Argument>(Arg)) {
if (isa<Argument>(Arg)) {
LLVM_DEBUG(dbgs() << " Include: ");
LLVM_DEBUG(AI->print(dbgs()));
LLVM_DEBUG(dbgs() << "\n");

View File

@ -245,7 +245,7 @@ public:
void visitMemIntrinsic(MemIntrinsic &MI) {
Value *Length = MI.getLength();
// Not perform on constant length calls.
if (dyn_cast<ConstantInt>(Length))
if (isa<ConstantInt>(Length))
return;
WorkList.push_back(MemOp(&MI));
}

View File

@ -42,7 +42,7 @@ public:
void visitMemIntrinsic(MemIntrinsic &MI) {
Value *Length = MI.getLength();
// Not instrument constant length calls.
if (dyn_cast<ConstantInt>(Length))
if (isa<ConstantInt>(Length))
return;
Instruction *InsertPt = &MI;
@ -60,7 +60,7 @@ public:
(Func == LibFunc_memcmp || Func == LibFunc_bcmp)) {
Value *Length = CI.getArgOperand(2);
// Not instrument constant length calls.
if (dyn_cast<ConstantInt>(Length))
if (isa<ConstantInt>(Length))
return;
Instruction *InsertPt = &CI;
Instruction *AnnotatedInst = &CI;

View File

@ -191,7 +191,7 @@ static bool sinkInstruction(
for (auto &U : I.uses()) {
Instruction *UI = cast<Instruction>(U.getUser());
// We cannot sink I to PHI-uses.
if (dyn_cast<PHINode>(UI))
if (isa<PHINode>(UI))
return false;
// We cannot sink I if it has uses outside of the loop.
if (!L.contains(LI.getLoopFor(UI->getParent())))

View File

@ -333,7 +333,7 @@ void CodeExtractorAnalysisCache::findSideEffectInfoForBlock(BasicBlock &BB) {
MemAddr = LI->getPointerOperand();
}
// Global variable can not be aliased with locals.
if (dyn_cast<Constant>(MemAddr))
if (isa<Constant>(MemAddr))
break;
Value *Base = MemAddr->stripInBoundsConstantOffsets();
if (!isa<AllocaInst>(Base)) {

View File

@ -1250,7 +1250,7 @@ bool FilterChooser::doesOpcodeNeedPredicate(unsigned Opc) const {
if (!Pred->getValue("AssemblerMatcherPredicate"))
continue;
if (dyn_cast<DagInit>(Pred->getValue("AssemblerCondDag")->getValue()))
if (isa<DagInit>(Pred->getValue("AssemblerCondDag")->getValue()))
return true;
}
return false;