[clang] Fix crashes when passing VLA to va_arg (#119563)
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / uniform-work-group-multistep.ll
blobda0234c90363d35ac17ddab56b64f4facc2f9ff3
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
4 ;.
5 ; CHECK: @G1 = global ptr null
6 ; CHECK: @G2 = global i32 0
7 ;.
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()
15   ret void
18 @G1 = global ptr null
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
28   store i32 0, ptr %1
29   ret void
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
38   call void @weak()
39   ret void
42 @G2 = global i32 0
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:%.*]]
50 ; CHECK:       3:
51 ; CHECK-NEXT:    call void @internal4()
52 ; CHECK-NEXT:    call void @internal3()
53 ; CHECK-NEXT:    br label [[TMP4]]
54 ; CHECK:       4:
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()
63   br label %4
65   ret void
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
75   ret void
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()
85   ret void
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()
95   ret void
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" }