1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
2 ; RUN: opt -S -mtriple=amdgcn-unknown-unknown -passes=amdgpu-attributor < %s | FileCheck %s
5 ; CHECK: @G1 = global ptr null
6 ; CHECK: @G2 = global i32 0
8 define weak void @weak() {
9 ; CHECK-LABEL: define {{[^@]+}}@weak
10 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
11 ; CHECK-NEXT: call void @internal1()
12 ; CHECK-NEXT: ret void
14 call void @internal1()
20 define internal void @internal1() {
21 ; CHECK-LABEL: define {{[^@]+}}@internal1
22 ; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
23 ; CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @G1, align 8
24 ; CHECK-NEXT: store i32 0, ptr [[TMP1]], align 4
25 ; CHECK-NEXT: ret void
27 %1 = load ptr, ptr @G1
32 define amdgpu_kernel void @kernel1() #0 {
33 ; CHECK-LABEL: define {{[^@]+}}@kernel1
34 ; CHECK-SAME: () #[[ATTR2:[0-9]+]] {
35 ; CHECK-NEXT: call void @weak()
36 ; CHECK-NEXT: ret void
44 define internal void @internal3() {
45 ; CHECK-LABEL: define {{[^@]+}}@internal3
46 ; CHECK-SAME: () #[[ATTR3:[0-9]+]] {
47 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @G2, align 4
48 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
49 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
51 ; CHECK-NEXT: call void @internal4()
52 ; CHECK-NEXT: call void @internal3()
53 ; CHECK-NEXT: br label [[TMP4]]
55 ; CHECK-NEXT: ret void
57 %1 = load i32, ptr @G2, align 4
58 %2 = icmp eq i32 %1, 0
59 br i1 %2, label %3, label %4
61 call void @internal4()
62 call void @internal3()
68 define internal void @internal4() {
69 ; CHECK-LABEL: define {{[^@]+}}@internal4
70 ; CHECK-SAME: () #[[ATTR3]] {
71 ; CHECK-NEXT: store i32 1, ptr @G2, align 4
72 ; CHECK-NEXT: ret void
74 store i32 1, ptr @G2, align 4
78 define internal void @internal2() {
79 ; CHECK-LABEL: define {{[^@]+}}@internal2
80 ; CHECK-SAME: () #[[ATTR3]] {
81 ; CHECK-NEXT: call void @internal3()
82 ; CHECK-NEXT: ret void
84 call void @internal3()
88 define amdgpu_kernel void @kernel2() #0 {
89 ; CHECK-LABEL: define {{[^@]+}}@kernel2
90 ; CHECK-SAME: () #[[ATTR4:[0-9]+]] {
91 ; CHECK-NEXT: call void @internal2()
92 ; CHECK-NEXT: ret void
94 call void @internal2()
98 attributes #0 = { "uniform-work-group-size"="true" }
100 ; CHECK: attributes #[[ATTR0]] = { "uniform-work-group-size"="false" }
101 ; CHECK: attributes #[[ATTR1]] = { "amdgpu-no-agpr" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "uniform-work-group-size"="false" }
102 ; CHECK: attributes #[[ATTR2]] = { "uniform-work-group-size"="true" }
103 ; CHECK: attributes #[[ATTR3]] = { "amdgpu-no-agpr" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "uniform-work-group-size"="true" }
104 ; CHECK: attributes #[[ATTR4]] = { "amdgpu-no-agpr" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "amdgpu-waves-per-eu"="4,10" "uniform-work-group-size"="true" }