[llvm] 2ac53ff - [AMDGPU] Avoid processing functions in amdgpu-propagate-attributes pass for shaders

Piotr Sobczak via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 07:47:23 PDT 2021


Author: Piotr Sobczak
Date: 2021-09-23T16:46:56+02:00
New Revision: 2ac53fffaeda809df34e3fb2c442b0fd85d4b0ff

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

LOG: [AMDGPU] Avoid processing functions in amdgpu-propagate-attributes pass for shaders

The pass amdgpu-propagate-attributes ("Early/Late propagate attributes
from kernels to functions") is currently run also for shaders, where
it does nothing. Modify the check so the pass only processes functions
for kernels.

Differential Revision: https://reviews.llvm.org/D109961

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
index 963551416175..cfa4492f616e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
@@ -212,10 +212,10 @@ AMDGPUPropagateAttributes::findFunction(const FnProperties &PropsNeeded,
 
 bool AMDGPUPropagateAttributes::process(Module &M) {
   for (auto &F : M.functions())
-    if (AMDGPU::isEntryFunctionCC(F.getCallingConv()))
+    if (AMDGPU::isKernel(F.getCallingConv()))
       Roots.insert(&F);
 
-  return process();
+  return Roots.empty() ? false : process();
 }
 
 bool AMDGPUPropagateAttributes::process(Function &F) {
@@ -228,8 +228,7 @@ bool AMDGPUPropagateAttributes::process() {
   SmallSet<Function *, 32> NewRoots;
   SmallSet<Function *, 32> Replaced;
 
-  if (Roots.empty())
-    return false;
+  assert(!Roots.empty());
   Module &M = *(*Roots.begin())->getParent();
 
   do {
@@ -383,7 +382,7 @@ bool AMDGPUPropagateAttributesEarly::runOnFunction(Function &F) {
     TM = &TPC->getTM<TargetMachine>();
   }
 
-  if (!AMDGPU::isEntryFunctionCC(F.getCallingConv()))
+  if (!AMDGPU::isKernel(F.getCallingConv()))
     return false;
 
   return AMDGPUPropagateAttributes(TM, false).process(F);


        


More information about the llvm-commits mailing list