[llvm] [AMDGPU] Infer amdgpu-no-flat-scratch-init attribute in AMDGPUAttributor (PR #94647)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 11:20:30 PDT 2024
================
@@ -0,0 +1,914 @@
+; Test the generation of the attribute amdgpu-no-flat-scratch-init
+; RUN: llc -march=amdgcn -mcpu=gfx900 -stop-after=amdgpu-attributor < %s | FileCheck -check-prefixes=GFX9 %s
+; RUN: llc -march=amdgcn -mcpu=gfx1010 -stop-after=amdgpu-attributor < %s | FileCheck -check-prefixes=GFX10 %s
+
+;; tests of alloca
+
+define void @without_alloca(i1 %arg0) {
+; GFX9-LABEL: define void @without_alloca(i1 %arg0)
+; GFX9-SAME: #[[ATTR_GFX9_NOFSI:[0-9]+]]
+;
+; GFX10-LABEL: define void @without_alloca(i1 %arg0)
+; GFX10-SAME: #[[ATTR_GFX10_NOFSI:[0-9]+]]
+ store volatile i1 %arg0, ptr addrspace(1) undef
+ ret void
+}
+
+define void @with_alloca() {
+; GFX9-LABEL: define void @with_alloca()
+; GFX9-SAME: #[[ATTR_GFX9_NO_NOFSI:[0-9]+]]
+;
+; GFX10-LABEL: define void @with_alloca()
+; GFX10-SAME: #[[ATTR_GFX10_NO_NOFSI:[0-9]+]]
+ %temp = alloca i32, addrspace(5)
+ store volatile i32 0, ptr addrspace(5) %temp, align 4
+ ret void
+}
+
+define amdgpu_kernel void @without_alloca_cc_kernel(i1 %arg0) {
+; GFX9-LABEL: define amdgpu_kernel void @without_alloca_cc_kernel(i1 %arg0)
+; GFX9-SAME: #[[ATTR_GFX9_NOFSI2:[0-9]+]]
+;
+; GFX10-LABEL: define amdgpu_kernel void @without_alloca_cc_kernel(i1 %arg0)
+; GFX10-SAME: #[[ATTR_GFX10_NOFSI2:[0-9]+]]
+ store volatile i1 %arg0, ptr addrspace(1) undef
----------------
arsenm wrote:
Don't use undef, use null instead
https://github.com/llvm/llvm-project/pull/94647
More information about the llvm-commits
mailing list