[llvm] ad715be - [AMDGPU] Remove HasSampler variable. NFC. (#146682)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 07:44:35 PDT 2025


Author: Jay Foad
Date: 2025-07-02T15:44:32+01:00
New Revision: ad715beca18469a483d14df3462446d37c039ac8

URL: https://github.com/llvm/llvm-project/commit/ad715beca18469a483d14df3462446d37c039ac8
DIFF: https://github.com/llvm/llvm-project/commit/ad715beca18469a483d14df3462446d37c039ac8.diff

LOG: [AMDGPU] Remove HasSampler variable. NFC. (#146682)

Putting the complex condition in a variable does not help readability.
It is simpler to use separate `if`s.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 571a31f465763..7ce1359f03da6 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -202,12 +202,17 @@ VmemType getVmemType(const MachineInstr &Inst) {
   const AMDGPU::MIMGInfo *Info = AMDGPU::getMIMGInfo(Inst.getOpcode());
   const AMDGPU::MIMGBaseOpcodeInfo *BaseInfo =
       AMDGPU::getMIMGBaseOpcodeInfo(Info->BaseOpcode);
+
+  if (BaseInfo->BVH)
+    return VMEM_BVH;
+
   // We have to make an additional check for isVSAMPLE here since some
   // instructions don't have a sampler, but are still classified as sampler
   // instructions for the purposes of e.g. waitcnt.
-  bool HasSampler =
-      BaseInfo->Sampler || BaseInfo->MSAA || SIInstrInfo::isVSAMPLE(Inst);
-  return BaseInfo->BVH ? VMEM_BVH : HasSampler ? VMEM_SAMPLER : VMEM_NOSAMPLER;
+  if (BaseInfo->Sampler || BaseInfo->MSAA || SIInstrInfo::isVSAMPLE(Inst))
+    return VMEM_SAMPLER;
+
+  return VMEM_NOSAMPLER;
 }
 
 unsigned &getCounterRef(AMDGPU::Waitcnt &Wait, InstCounterType T) {


        


More information about the llvm-commits mailing list