Skip to content

Commit 886f119

Browse files
authored
[AMDGPU] Use variadic isa<>. NFC. (#137016)
1 parent 7af555e commit 886f119

8 files changed

+11
-17
lines changed

llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,7 @@ static bool isPtrKnownNeverNull(const Value *V, const DataLayout &DL,
21232123
// Pointer cannot be null if it's a block address, GV or alloca.
21242124
// NOTE: We don't support extern_weak, but if we did, we'd need to check for
21252125
// it as the symbol could be null in such cases.
2126-
if (isa<BlockAddress>(V) || isa<GlobalValue>(V) || isa<AllocaInst>(V))
2126+
if (isa<BlockAddress, GlobalValue, AllocaInst>(V))
21272127
return true;
21282128

21292129
// Check nonnull arguments.

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static bool canSafelyConvertTo16Bit(Value &V, bool IsFloat) {
103103
// Convert a value to 16-bit.
104104
static Value *convertTo16Bit(Value &V, InstCombiner::BuilderTy &Builder) {
105105
Type *VTy = V.getType();
106-
if (isa<FPExtInst>(&V) || isa<SExtInst>(&V) || isa<ZExtInst>(&V))
106+
if (isa<FPExtInst, SExtInst, ZExtInst>(&V))
107107
return cast<Instruction>(&V)->getOperand(0);
108108
if (VTy->isIntegerTy())
109109
return Builder.CreateIntCast(&V, Type::getInt16Ty(V.getContext()), false);

llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ bool AMDGPUInstrInfo::isUniformMMO(const MachineMemOperand *MMO) {
3838
// Sometimes LDS instructions have constant pointers.
3939
// If Ptr is null, then that means this mem operand contains a
4040
// PseudoSourceValue like GOT.
41-
if (!Ptr || isa<UndefValue>(Ptr) ||
42-
isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
41+
if (!Ptr || isa<UndefValue, Constant, GlobalValue>(Ptr))
4342
return true;
4443

4544
if (MMO->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT)

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,8 +2946,7 @@ bool AMDGPUInstructionSelector::isInstrUniform(const MachineInstr &MI) const {
29462946
// Sometimes LDS instructions have constant pointers.
29472947
// If Ptr is null, then that means this mem operand contains a
29482948
// PseudoSourceValue like GOT.
2949-
if (!Ptr || isa<UndefValue>(Ptr) || isa<Argument>(Ptr) ||
2950-
isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
2949+
if (!Ptr || isa<UndefValue, Argument, Constant, GlobalValue>(Ptr))
29512950
return true;
29522951

29532952
if (MMO->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT)

llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ class LiveRegOptimizer {
127127
return LK.first != TargetLoweringBase::TypeLegal;
128128
}
129129

130-
bool isOpLegal(Instruction *I) {
131-
return isa<StoreInst>(I) || isa<IntrinsicInst>(I);
132-
}
130+
bool isOpLegal(Instruction *I) { return isa<StoreInst, IntrinsicInst>(I); }
133131

134132
bool isCoercionProfitable(Instruction *II) {
135133
SmallPtrSet<Instruction *, 4> CVisited;
@@ -144,9 +142,8 @@ class LiveRegOptimizer {
144142
auto IsLookThru = [](Instruction *II) {
145143
if (const auto *Intr = dyn_cast<IntrinsicInst>(II))
146144
return Intr->getIntrinsicID() == Intrinsic::amdgcn_perm;
147-
return isa<PHINode>(II) || isa<ShuffleVectorInst>(II) ||
148-
isa<InsertElementInst>(II) || isa<ExtractElementInst>(II) ||
149-
isa<CastInst>(II);
145+
return isa<PHINode, ShuffleVectorInst, InsertElementInst,
146+
ExtractElementInst, CastInst>(II);
150147
};
151148

152149
while (!UserList.empty()) {

llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2408,7 +2408,7 @@ bool AMDGPULowerBufferFatPointers::run(Module &M, const TargetMachine &TM) {
24082408
for (Function &F : M.functions())
24092409
for (Instruction &I : instructions(F))
24102410
for (Value *Op : I.operands())
2411-
if (isa<ConstantExpr>(Op) || isa<ConstantAggregate>(Op))
2411+
if (isa<ConstantExpr, ConstantAggregate>(Op))
24122412
Worklist.push_back(cast<Constant>(Op));
24132413

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

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ bool GCNTTIImpl::isSourceOfDivergence(const Value *V) const {
941941
// atomic operation refers to the same address in each thread, then each
942942
// thread after the first sees the value written by the previous thread as
943943
// original value.
944-
if (isa<AtomicRMWInst>(V) || isa<AtomicCmpXchgInst>(V))
944+
if (isa<AtomicRMWInst, AtomicCmpXchgInst>(V))
945945
return true;
946946

947947
if (const IntrinsicInst *Intrinsic = dyn_cast<IntrinsicInst>(V)) {

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7370,8 +7370,7 @@ SDValue SITargetLowering::getSegmentAperture(unsigned AS, const SDLoc &DL,
73707370
/// not necessary.
73717371
static bool isKnownNonNull(SDValue Val, SelectionDAG &DAG,
73727372
const AMDGPUTargetMachine &TM, unsigned AddrSpace) {
7373-
if (isa<FrameIndexSDNode>(Val) || isa<GlobalAddressSDNode>(Val) ||
7374-
isa<BasicBlockSDNode>(Val))
7373+
if (isa<FrameIndexSDNode, GlobalAddressSDNode, BasicBlockSDNode>(Val))
73757374
return true;
73767375

73777376
if (auto *ConstVal = dyn_cast<ConstantSDNode>(Val))

0 commit comments

Comments
 (0)