From 0ba0398517778514eb44cb7ba9bf9d4d20a856e0 Mon Sep 17 00:00:00 2001 From: Jon Chesterfield Date: Wed, 9 Nov 2022 16:45:02 +0000 Subject: [PATCH] [amdgpu][lds] Use the same isKernel predicate consistently 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. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D136599 --- llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp | 2 +- llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp index be5ac67..81222a2 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp @@ -259,7 +259,7 @@ public: 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; diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp index b141825..65722dd 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp @@ -41,7 +41,7 @@ static bool shouldLowerLDSToStruct(const GlobalVariable &GV, SmallPtrSet Visited; SmallVector 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 @@ static bool shouldLowerLDSToStruct(const GlobalVariable &GV, } 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; } -- 2.7.4