[llvm] [AMDGPU] Add test for failure with function !dbg info in amdgpu-lower-kernel-arguments (PR #126146)
Scott Linder via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 14:53:02 PST 2025
https://github.com/slinder1 updated https://github.com/llvm/llvm-project/pull/126146
>From 8a4643735efc54b68e888c6a2167d717765fddb8 Mon Sep 17 00:00:00 2001
From: Scott Linder <Scott.Linder at amd.com>
Date: Thu, 6 Feb 2025 22:11:45 +0000
Subject: [PATCH 1/2] [AMDGPU] Add test for failure with function !dbg info in
amdgpu-lower-kernel-arguments
---
.../preload-implicit-kernargs-debug-info.ll | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
diff --git a/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll b/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
new file mode 100644
index 000000000000000..fe110cbcafc465d
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
@@ -0,0 +1,27 @@
+; RUN: not --crash opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -passes='amdgpu-attributor,function(amdgpu-lower-kernel-arguments)' -amdgpu-kernarg-preload-count=16 -S < %s 2>&1 | FileCheck %s
+
+; CHECK: function declaration may only have a unique !dbg attachment
+; CHECK-NEXT: ptr @0
+
+define amdgpu_kernel void @preload_block_count_x(ptr addrspace(1) %out) !dbg !4 {
+ %imp_arg_ptr = call ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr()
+ %load = load i32, ptr addrspace(4) %imp_arg_ptr, align 4
+ store i32 %load, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
+declare noundef align 4 ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() #0
+
+attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_OpenCL, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
+!1 = !DIFile(filename: "<stdin>", directory: "/")
+!2 = !{i32 7, !"Dwarf Version", i32 5}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !5, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
+!5 = !DISubroutineType(cc: DW_CC_LLVM_OpenCLKernel, types: !6)
+!6 = !{null}
>From 4335b38966ce7c992eedbfc2bdd4539bb9febeec Mon Sep 17 00:00:00 2001
From: Scott Linder <Scott.Linder at amd.com>
Date: Fri, 7 Feb 2025 19:18:14 +0000
Subject: [PATCH 2/2] Add !max_work_group_size metadata to test
---
.../CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll b/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
index fe110cbcafc465d..a6a0b88dce125eb 100644
--- a/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
+++ b/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
@@ -3,14 +3,13 @@
; CHECK: function declaration may only have a unique !dbg attachment
; CHECK-NEXT: ptr @0
-define amdgpu_kernel void @preload_block_count_x(ptr addrspace(1) %out) !dbg !4 {
+define amdgpu_kernel void @preload_block_count_x(ptr addrspace(1) %out) !dbg !4 !max_work_group_size !7 {
%imp_arg_ptr = call ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr()
%load = load i32, ptr addrspace(4) %imp_arg_ptr, align 4
store i32 %load, ptr addrspace(1) %out, align 4
ret void
}
-; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare noundef align 4 ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr() #0
attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
@@ -25,3 +24,4 @@ attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memo
!4 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !5, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
!5 = !DISubroutineType(cc: DW_CC_LLVM_OpenCLKernel, types: !6)
!6 = !{null}
+!7 = !{i32 1024, i32 1, i32 1}
More information about the llvm-commits
mailing list