[llvm] 0446b40 - [NFC][AMDGPU][Attributor] Only iterate over filtered functions when creating AAs (#108417)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 10:41:18 PDT 2024


Author: Shilei Tian
Date: 2024-09-12T13:41:15-04:00
New Revision: 0446b403b04ad3df709f23a63c2e1cea087459b3

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

LOG: [NFC][AMDGPU][Attributor] Only iterate over filtered functions when creating AAs (#108417)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
index ffeec31bb930ab..687a7339da379d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
@@ -1065,19 +1065,16 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
 
   Attributor A(Functions, InfoCache, AC);
 
-  for (Function &F : M) {
-    if (F.isIntrinsic())
-      continue;
-
-    A.getOrCreateAAFor<AAAMDAttributes>(IRPosition::function(F));
-    A.getOrCreateAAFor<AAUniformWorkGroupSize>(IRPosition::function(F));
-    A.getOrCreateAAFor<AAAMDGPUNoAGPR>(IRPosition::function(F));
-    CallingConv::ID CC = F.getCallingConv();
+  for (auto *F : Functions) {
+    A.getOrCreateAAFor<AAAMDAttributes>(IRPosition::function(*F));
+    A.getOrCreateAAFor<AAUniformWorkGroupSize>(IRPosition::function(*F));
+    A.getOrCreateAAFor<AAAMDGPUNoAGPR>(IRPosition::function(*F));
+    CallingConv::ID CC = F->getCallingConv();
     if (!AMDGPU::isEntryFunctionCC(CC)) {
-      A.getOrCreateAAFor<AAAMDFlatWorkGroupSize>(IRPosition::function(F));
-      A.getOrCreateAAFor<AAAMDWavesPerEU>(IRPosition::function(F));
+      A.getOrCreateAAFor<AAAMDFlatWorkGroupSize>(IRPosition::function(*F));
+      A.getOrCreateAAFor<AAAMDWavesPerEU>(IRPosition::function(*F));
     } else if (CC == CallingConv::AMDGPU_KERNEL) {
-      addPreloadKernArgHint(F, TM);
+      addPreloadKernArgHint(*F, TM);
     }
 
     for (auto &I : instructions(F)) {


        


More information about the llvm-commits mailing list