[llvm] 9dc2636 - [AMDGPU] Disable LDS lowering for GFX shaders
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 20 02:55:37 PDT 2021
Author: Stanislav Mekhanoshin
Date: 2021-07-20T02:55:25-07:00
New Revision: 9dc26366230447179ce28ba503b66767373124ec
URL: https://github.com/llvm/llvm-project/commit/9dc26366230447179ce28ba503b66767373124ec
DIFF: https://github.com/llvm/llvm-project/commit/9dc26366230447179ce28ba503b66767373124ec.diff
LOG: [AMDGPU] Disable LDS lowering for GFX shaders
Apparently these need external LDS symbols to remain.
Fixes: SC1-3279
Differential Revision: https://reviews.llvm.org/D106288
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
index f5cd3d1ede708..70ecea8dbc3e2 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
@@ -162,7 +162,8 @@ class AMDGPULowerModuleLDS : public ModulePass {
bool Changed = processUsedLDS(M);
for (Function &F : M.functions()) {
- if (!AMDGPU::isKernelCC(&F))
+ // Only lower compute kernels' LDS.
+ if (!AMDGPU::isKernel(F.getCallingConv()))
continue;
Changed |= processUsedLDS(M, &F);
}
diff --git a/llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll b/llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
index d22e417c90bf0..c8592c7a52b5b 100644
--- a/llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
+++ b/llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
@@ -12,6 +12,7 @@
;.
; CHECK: @lds.size.8.align.8 = internal unnamed_addr addrspace(3) global [8 x i8] undef, align 8
+; CHECK: @lds.k2 = addrspace(3) global [1 x i8] undef, align 1
; CHECK: @llvm.amdgcn.kernel.k0.lds = internal addrspace(3) global %llvm.amdgcn.kernel.k0.lds.t undef, align 16
; CHECK: @llvm.amdgcn.kernel.k1.lds = internal addrspace(3) global %llvm.amdgcn.kernel.k1.lds.t undef, align 16
;.
@@ -63,3 +64,19 @@ define amdgpu_kernel void @k1() {
ret void
}
+
+; Do not lower LDS for graphics shaders.
+
+ at lds.k2 = addrspace(3) global [1 x i8] undef, align 1
+
+define amdgpu_ps void @k2() {
+; CHECK-LABEL: @k2(
+; CHECK-NEXT: %lds.k2.bc = bitcast [1 x i8] addrspace(3)* @lds.k2 to i8 addrspace(3)*
+; CHECK-NEXT: store i8 1, i8 addrspace(3)* %lds.k2.bc, align 1
+; CHECK-NEXT: ret void
+;
+ %lds.k2.bc = bitcast [1 x i8] addrspace(3)* @lds.k2 to i8 addrspace(3)*
+ store i8 1, i8 addrspace(3)* %lds.k2.bc, align 1
+
+ ret void
+}
More information about the llvm-commits
mailing list