[llvm] 8ed1636 - [llvm] Use isa instead of dyn_cast (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 23:24:02 PST 2021
Author: Kazu Hirata
Date: 2021-01-29T23:23:37-08:00
New Revision: 8ed163618478dd4e7e03e34a029256b47a95d85c
URL: https://github.com/llvm/llvm-project/commit/8ed163618478dd4e7e03e34a029256b47a95d85c
DIFF: https://github.com/llvm/llvm-project/commit/8ed163618478dd4e7e03e34a029256b47a95d85c.diff
LOG: [llvm] Use isa instead of dyn_cast (NFC)
Added:
Modified:
llvm/lib/Target/AVR/AVRISelLowering.cpp
llvm/lib/Target/BPF/BPFAdjustOpt.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/VE/VEISelDAGToDAG.cpp
llvm/lib/Transforms/IPO/MergeFunctions.cpp
llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
llvm/lib/Transforms/Scalar/LoopSink.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AVR/AVRISelLowering.cpp b/llvm/lib/Target/AVR/AVRISelLowering.cpp
index 944f7b681b5c..2085acb7f23c 100644
--- a/llvm/lib/Target/AVR/AVRISelLowering.cpp
+++ b/llvm/lib/Target/AVR/AVRISelLowering.cpp
@@ -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));
diff --git a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp
index da543e7eba53..f40d8ac03e49 100644
--- a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp
+++ b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp
@@ -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;
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 929a72ac687e..e9a0d0570e93 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -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
diff --git a/llvm/lib/Target/VE/VEISelDAGToDAG.cpp b/llvm/lib/Target/VE/VEISelDAGToDAG.cpp
index 761baa79b4ab..e2608e82c9d4 100644
--- a/llvm/lib/Target/VE/VEISelDAGToDAG.cpp
+++ b/llvm/lib/Target/VE/VEISelDAGToDAG.cpp
@@ -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 ||
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index ec5d86b72a1f..b3427741903d 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -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");
diff --git a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
index 55a93b6152dc..40d41cb024d3 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
@@ -245,7 +245,7 @@ class MemOPSizeOpt : public InstVisitor<MemOPSizeOpt> {
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));
}
diff --git a/llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc b/llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
index 8d0cf5843ebc..6a2c473a596a 100644
--- a/llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
+++ b/llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
@@ -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;
diff --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp b/llvm/lib/Transforms/Scalar/LoopSink.cpp
index 47698fdde69f..58815a1c4fa6 100644
--- a/llvm/lib/Transforms/Scalar/LoopSink.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp
@@ -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())))
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index 390925a03b73..dc985ed94381 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -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)) {
diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
index 01b39df055ad..e4ecb5dd7c90 100644
--- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
+++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp
@@ -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;
More information about the llvm-commits
mailing list