Skip to content

[AMDGPU] Use variadic isa<>. NFC. #137016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2123,7 +2123,7 @@ static bool isPtrKnownNeverNull(const Value *V, const DataLayout &DL,
// Pointer cannot be null if it's a block address, GV or alloca.
// NOTE: We don't support extern_weak, but if we did, we'd need to check for
// it as the symbol could be null in such cases.
if (isa<BlockAddress>(V) || isa<GlobalValue>(V) || isa<AllocaInst>(V))
if (isa<BlockAddress, GlobalValue, AllocaInst>(V))
return true;

// Check nonnull arguments.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static bool canSafelyConvertTo16Bit(Value &V, bool IsFloat) {
// Convert a value to 16-bit.
static Value *convertTo16Bit(Value &V, InstCombiner::BuilderTy &Builder) {
Type *VTy = V.getType();
if (isa<FPExtInst>(&V) || isa<SExtInst>(&V) || isa<ZExtInst>(&V))
if (isa<FPExtInst, SExtInst, ZExtInst>(&V))
return cast<Instruction>(&V)->getOperand(0);
if (VTy->isIntegerTy())
return Builder.CreateIntCast(&V, Type::getInt16Ty(V.getContext()), false);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ bool AMDGPUInstrInfo::isUniformMMO(const MachineMemOperand *MMO) {
// Sometimes LDS instructions have constant pointers.
// If Ptr is null, then that means this mem operand contains a
// PseudoSourceValue like GOT.
if (!Ptr || isa<UndefValue>(Ptr) ||
isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
if (!Ptr || isa<UndefValue, Constant, GlobalValue>(Ptr))
return true;

if (MMO->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2946,8 +2946,7 @@ bool AMDGPUInstructionSelector::isInstrUniform(const MachineInstr &MI) const {
// Sometimes LDS instructions have constant pointers.
// If Ptr is null, then that means this mem operand contains a
// PseudoSourceValue like GOT.
if (!Ptr || isa<UndefValue>(Ptr) || isa<Argument>(Ptr) ||
isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
if (!Ptr || isa<UndefValue, Argument, Constant, GlobalValue>(Ptr))
return true;

if (MMO->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
Expand Down
9 changes: 3 additions & 6 deletions llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ class LiveRegOptimizer {
return LK.first != TargetLoweringBase::TypeLegal;
}

bool isOpLegal(Instruction *I) {
return isa<StoreInst>(I) || isa<IntrinsicInst>(I);
}
bool isOpLegal(Instruction *I) { return isa<StoreInst, IntrinsicInst>(I); }

bool isCoercionProfitable(Instruction *II) {
SmallPtrSet<Instruction *, 4> CVisited;
Expand All @@ -144,9 +142,8 @@ class LiveRegOptimizer {
auto IsLookThru = [](Instruction *II) {
if (const auto *Intr = dyn_cast<IntrinsicInst>(II))
return Intr->getIntrinsicID() == Intrinsic::amdgcn_perm;
return isa<PHINode>(II) || isa<ShuffleVectorInst>(II) ||
isa<InsertElementInst>(II) || isa<ExtractElementInst>(II) ||
isa<CastInst>(II);
return isa<PHINode, ShuffleVectorInst, InsertElementInst,
ExtractElementInst, CastInst>(II);
};

while (!UserList.empty()) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,7 @@ bool AMDGPULowerBufferFatPointers::run(Module &M, const TargetMachine &TM) {
for (Function &F : M.functions())
for (Instruction &I : instructions(F))
for (Value *Op : I.operands())
if (isa<ConstantExpr>(Op) || isa<ConstantAggregate>(Op))
if (isa<ConstantExpr, ConstantAggregate>(Op))
Worklist.push_back(cast<Constant>(Op));

// Recursively look for any referenced buffer pointer constants.
Expand All @@ -2421,7 +2421,7 @@ bool AMDGPULowerBufferFatPointers::run(Module &M, const TargetMachine &TM) {
if (isBufferFatPtrOrVector(C->getType()))
BufferFatPtrConsts.insert(C);
for (Value *Op : C->operands())
if (isa<ConstantExpr>(Op) || isa<ConstantAggregate>(Op))
if (isa<ConstantExpr, ConstantAggregate>(Op))
Worklist.push_back(cast<Constant>(Op));
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ bool GCNTTIImpl::isSourceOfDivergence(const Value *V) const {
// atomic operation refers to the same address in each thread, then each
// thread after the first sees the value written by the previous thread as
// original value.
if (isa<AtomicRMWInst>(V) || isa<AtomicCmpXchgInst>(V))
if (isa<AtomicRMWInst, AtomicCmpXchgInst>(V))
return true;

if (const IntrinsicInst *Intrinsic = dyn_cast<IntrinsicInst>(V)) {
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7370,8 +7370,7 @@ SDValue SITargetLowering::getSegmentAperture(unsigned AS, const SDLoc &DL,
/// not necessary.
static bool isKnownNonNull(SDValue Val, SelectionDAG &DAG,
const AMDGPUTargetMachine &TM, unsigned AddrSpace) {
if (isa<FrameIndexSDNode>(Val) || isa<GlobalAddressSDNode>(Val) ||
isa<BasicBlockSDNode>(Val))
if (isa<FrameIndexSDNode, GlobalAddressSDNode, BasicBlockSDNode>(Val))
return true;

if (auto *ConstVal = dyn_cast<ConstantSDNode>(Val))
Expand Down
Loading