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-attributor %s | FileCheck %s
3
4@x = global i32 0
5
6; Propagate the uniform-work-group-attribute from the kernel to callee if it doesn't have it
7;.
8; CHECK: @[[X:[a-zA-Z0-9_$"\\.-]+]] = global i32 0
9;.
10define void @func() #0 {
11; CHECK-LABEL: define {{[^@]+}}@func
12; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
13; CHECK-NEXT:    store i32 0, i32* @x, align 4
14; CHECK-NEXT:    ret void
15;
16  store i32 0, i32* @x
17  ret void
18}
19
20define amdgpu_kernel void @kernel1() #1 {
21; CHECK-LABEL: define {{[^@]+}}@kernel1
22; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
23; CHECK-NEXT:    call void @func()
24; CHECK-NEXT:    ret void
25;
26  call void @func()
27  ret void
28}
29
30; External declaration of a function
31define weak_odr void @weak_func() #0 {
32; CHECK-LABEL: define {{[^@]+}}@weak_func
33; CHECK-SAME: () #[[ATTR0]] {
34; CHECK-NEXT:    store i32 0, i32* @x, align 4
35; CHECK-NEXT:    ret void
36;
37  store i32 0, i32* @x
38  ret void
39}
40
41define amdgpu_kernel void @kernel2() #2 {
42; CHECK-LABEL: define {{[^@]+}}@kernel2
43; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
44; CHECK-NEXT:    call void @weak_func()
45; CHECK-NEXT:    ret void
46;
47  call void @weak_func()
48  ret void
49}
50
51attributes #0 = { nounwind }
52attributes #1 = { "uniform-work-group-size"="false" }
53attributes #2 = { "uniform-work-group-size"="true" }
54