[PATCH] D136599: [amdgpu][lds] Use the same isKernel predicate consistently

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 07:22:11 PDT 2022


JonChesterfield created this revision.
JonChesterfield added reviewers: arsenm, rampitec.
Herald added subscribers: kosarev, foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
JonChesterfield requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

isKernelCC != isKernel(F->getCallingConv())
There's a test case (lower-kernel-lds.ll) that explicitly skips amdgpu_ps
so this change picks the isKernel predicate that continues to skip that
calling convention.

isKernel returns true for AMDGPU_KERNEL and SPIR_KERNEL. isKernelCC also
returns true for other calling conventions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136599

Files:
  llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
  llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp


Index: llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp
+++ llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp
@@ -41,7 +41,7 @@
   SmallPtrSet<const User *, 8> Visited;
   SmallVector<const User *, 16> Stack(GV.users());
 
-  assert(!F || isKernelCC(F));
+  assert(!F || isKernel(F->getCallingConv()));
 
   while (!Stack.empty()) {
     const User *V = Stack.pop_back_val();
@@ -62,7 +62,7 @@
       } else if (!F) {
         // For module LDS lowering, lowering is required if the user instruction
         // is from non-kernel function.
-        Ret |= !isKernelCC(UF);
+        Ret |= !isKernel(UF->getCallingConv());
       }
       continue;
     }
Index: llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
@@ -259,7 +259,7 @@
 
       IRBuilder<> Builder(Ctx);
       for (Function &Func : M.functions()) {
-        if (!Func.isDeclaration() && AMDGPU::isKernelCC(&Func)) {
+        if (!Func.isDeclaration() && AMDGPU::isKernel(Func.getCallingConv())) {
           const CallGraphNode *N = CG[&Func];
           const bool CalleesRequireModuleLDS = N->size() > 0;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136599.470141.patch
Type: text/x-patch
Size: 1382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221024/e3523839/attachment.bin>


More information about the llvm-commits mailing list