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=AKF_CHECK %s
3 ; RUN: opt -S -mtriple=amdgcn-amd- -amdgpu-attributor < %s | FileCheck -check-prefixes=ATTRIBUTOR_CHECK %s
5 ; Test to verify if the attribute gets propagated across nested function calls
7 ; Added to prevent Attributor from deleting calls.
11 ; AKF_CHECK: @[[X:[a-zA-Z0-9_$"\\.-]+]] = global i32 0
13 ; ATTRIBUTOR_CHECK: @[[X:[a-zA-Z0-9_$"\\.-]+]] = global i32 0
15 define void @func1() #0 {
16 ; AKF_CHECK-LABEL: define {{[^@]+}}@func1
17 ; AKF_CHECK-SAME: () #[[ATTR0:[0-9]+]] {
18 ; AKF_CHECK-NEXT: store i32 0, i32* @x, align 4
19 ; AKF_CHECK-NEXT: ret void
21 ; ATTRIBUTOR_CHECK-LABEL: define {{[^@]+}}@func1
22 ; ATTRIBUTOR_CHECK-SAME: () #[[ATTR0:[0-9]+]] {
23 ; ATTRIBUTOR_CHECK-NEXT: store i32 0, i32* @x, align 4
24 ; ATTRIBUTOR_CHECK-NEXT: ret void
30 define void @func2() #1 {
31 ; AKF_CHECK-LABEL: define {{[^@]+}}@func2
32 ; AKF_CHECK-SAME: () #[[ATTR0]] {
33 ; AKF_CHECK-NEXT: call void @func1()
34 ; AKF_CHECK-NEXT: ret void
36 ; ATTRIBUTOR_CHECK-LABEL: define {{[^@]+}}@func2
37 ; ATTRIBUTOR_CHECK-SAME: () #[[ATTR0]] {
38 ; ATTRIBUTOR_CHECK-NEXT: call void @func1() #[[ATTR2:[0-9]+]]
39 ; ATTRIBUTOR_CHECK-NEXT: ret void
45 define amdgpu_kernel void @kernel3() #2 {
46 ; AKF_CHECK-LABEL: define {{[^@]+}}@kernel3
47 ; AKF_CHECK-SAME: () #[[ATTR1:[0-9]+]] {
48 ; AKF_CHECK-NEXT: call void @func2()
49 ; AKF_CHECK-NEXT: ret void
51 ; ATTRIBUTOR_CHECK-LABEL: define {{[^@]+}}@kernel3
52 ; ATTRIBUTOR_CHECK-SAME: () #[[ATTR1:[0-9]+]] {
53 ; ATTRIBUTOR_CHECK-NEXT: call void @func2() #[[ATTR2]]
54 ; ATTRIBUTOR_CHECK-NEXT: ret void
60 attributes #2 = { "uniform-work-group-size"="true" }
62 ; AKF_CHECK: attributes #[[ATTR0]] = { "uniform-work-group-size"="true" }
63 ; AKF_CHECK: attributes #[[ATTR1]] = { "amdgpu-calls" "uniform-work-group-size"="true" }
65 ; ATTRIBUTOR_CHECK: attributes #[[ATTR0]] = { nounwind writeonly "uniform-work-group-size"="false" }
66 ; ATTRIBUTOR_CHECK: attributes #[[ATTR1]] = { "amdgpu-calls" "uniform-work-group-size"="true" }
67 ; ATTRIBUTOR_CHECK: attributes #[[ATTR2]] = { nounwind writeonly }