1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
2 ; RUN: opt -S -mtriple=amdgcn-amd- -amdgpu-annotate-kernel-features %s | FileCheck -check-prefixes=CHECK,AKF_CHECK %s
3 ; RUN: opt -S -mtriple=amdgcn-amd- -amdgpu-attributor %s | FileCheck -check-prefixes=CHECK,ATTRIBUTOR_CHECK %s
7 ; Propagate the uniform-work-group-attribute from the kernel to callee if it doesn't have it
9 ; CHECK: @[[X:[a-zA-Z0-9_$"\\.-]+]] = global i32 0
11 define void @func() #0 {
12 ; CHECK-LABEL: define {{[^@]+}}@func
13 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
14 ; CHECK-NEXT: store i32 0, i32* @x, align 4
15 ; CHECK-NEXT: ret void
21 define amdgpu_kernel void @kernel1() #1 {
22 ; AKF_CHECK-LABEL: define {{[^@]+}}@kernel1
23 ; AKF_CHECK-SAME: () #[[ATTR1:[0-9]+]] {
24 ; AKF_CHECK-NEXT: call void @func()
25 ; AKF_CHECK-NEXT: ret void
27 ; ATTRIBUTOR_CHECK-LABEL: define {{[^@]+}}@kernel1
28 ; ATTRIBUTOR_CHECK-SAME: () #[[ATTR1:[0-9]+]] {
29 ; ATTRIBUTOR_CHECK-NEXT: call void @func() #[[ATTR4:[0-9]+]]
30 ; ATTRIBUTOR_CHECK-NEXT: ret void
36 ; External declaration of a function
37 define weak_odr void @weak_func() #0 {
38 ; AKF_CHECK-LABEL: define {{[^@]+}}@weak_func
39 ; AKF_CHECK-SAME: () #[[ATTR0]] {
40 ; AKF_CHECK-NEXT: store i32 0, i32* @x, align 4
41 ; AKF_CHECK-NEXT: ret void
43 ; ATTRIBUTOR_CHECK-LABEL: define {{[^@]+}}@weak_func
44 ; ATTRIBUTOR_CHECK-SAME: () #[[ATTR2:[0-9]+]] {
45 ; ATTRIBUTOR_CHECK-NEXT: store i32 0, i32* @x, align 4
46 ; ATTRIBUTOR_CHECK-NEXT: ret void
52 define amdgpu_kernel void @kernel2() #2 {
53 ; AKF_CHECK-LABEL: define {{[^@]+}}@kernel2
54 ; AKF_CHECK-SAME: () #[[ATTR2:[0-9]+]] {
55 ; AKF_CHECK-NEXT: call void @weak_func()
56 ; AKF_CHECK-NEXT: ret void
58 ; ATTRIBUTOR_CHECK-LABEL: define {{[^@]+}}@kernel2
59 ; ATTRIBUTOR_CHECK-SAME: () #[[ATTR3:[0-9]+]] {
60 ; ATTRIBUTOR_CHECK-NEXT: call void @weak_func() #[[ATTR5:[0-9]+]]
61 ; ATTRIBUTOR_CHECK-NEXT: ret void
63 call void @weak_func()
67 attributes #0 = { nounwind }
68 attributes #1 = { "uniform-work-group-size"="false" }
69 attributes #2 = { "uniform-work-group-size"="true" }
71 ; AKF_CHECK: attributes #[[ATTR0]] = { nounwind "uniform-work-group-size"="false" }
72 ; AKF_CHECK: attributes #[[ATTR1]] = { "amdgpu-calls" "uniform-work-group-size"="false" }
73 ; AKF_CHECK: attributes #[[ATTR2]] = { "amdgpu-calls" "uniform-work-group-size"="true" }
75 ; ATTRIBUTOR_CHECK: attributes #[[ATTR0]] = { nounwind writeonly "uniform-work-group-size"="false" }
76 ; ATTRIBUTOR_CHECK: attributes #[[ATTR1]] = { "amdgpu-calls" "uniform-work-group-size"="false" }
77 ; ATTRIBUTOR_CHECK: attributes #[[ATTR2]] = { nounwind "uniform-work-group-size"="false" }
78 ; ATTRIBUTOR_CHECK: attributes #[[ATTR3]] = { "amdgpu-calls" "uniform-work-group-size"="true" }
79 ; ATTRIBUTOR_CHECK: attributes #[[ATTR4]] = { nounwind writeonly }
80 ; ATTRIBUTOR_CHECK: attributes #[[ATTR5]] = { nounwind }