[clang] Fix crashes when passing VLA to va_arg (#119563)
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / hsa-metadata-enqueue-kernel-.ll
blob3d0e061d33286ef24ea5c1a81a217c064f5d72af
1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readelf --notes - | FileCheck --check-prefix=CHECK %s
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-dump-hsa-metadata -amdgpu-verify-hsa-metadata -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
4 ; CHECK:              ---
5 ; CHECK:      amdhsa.kernels:
6 ; CHECK:        - .args:
7 ; CHECK-NEXT:       - .name:           a
8 ; CHECK-NEXT:         .offset:         0
9 ; CHECK-NEXT:         .size:           1
10 ; CHECK-NEXT:         .type_name:      char
11 ; CHECK-NEXT:         .value_kind:     by_value
12 ; CHECK-NEXT:       - .offset:         8
13 ; CHECK-NEXT:         .size:           8
14 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_x
15 ; CHECK-NEXT:       - .offset:         16
16 ; CHECK-NEXT:         .size:           8
17 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_y
18 ; CHECK-NEXT:       - .offset:         24
19 ; CHECK-NEXT:         .size:           8
20 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_z
21 ; CHECK-NOT:        .value_kind:    hidden_default_queue
22 ; CHECK-NOT:        .value_kind:    hidden_completion_action
23 ; CHECK:          .language:       OpenCL C
24 ; CHECK-NEXT:     .language_version:
25 ; CHECK-NEXT:       - 2
26 ; CHECK-NEXT:       - 0
27 ; CHECK:          .name:           test_non_enqueue_kernel_caller
28 ; CHECK:          .symbol:         test_non_enqueue_kernel_caller.kd
29 define amdgpu_kernel void @test_non_enqueue_kernel_caller(i8 %a) #0
30     !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
31     !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
32   ret void
35 ; CHECK:        - .args:
36 ; CHECK-NEXT:       - .name:           a
37 ; CHECK-NEXT:         .offset:         0
38 ; CHECK-NEXT:         .size:           1
39 ; CHECK-NEXT:         .type_name:      char
40 ; CHECK-NEXT:         .value_kind:     by_value
41 ; CHECK-NEXT:       - .offset:         8
42 ; CHECK-NEXT:         .size:           8
43 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_x
44 ; CHECK-NEXT:       - .offset:         16
45 ; CHECK-NEXT:         .size:           8
46 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_y
47 ; CHECK-NEXT:       - .offset:         24
48 ; CHECK-NEXT:         .size:           8
49 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_z
50 ; CHECK-NEXT:       - .offset:         32
51 ; CHECK-NEXT:         .size:           8
52 ; CHECK-NEXT:         .value_kind:     hidden_hostcall_buffer
53 ; CHECK-NEXT:       - .offset:         40
54 ; CHECK-NEXT:         .size:           8
55 ; CHECK-NEXT:         .value_kind:     hidden_default_queue
56 ; CHECK-NEXT:       - .offset:         48
57 ; CHECK-NEXT:         .size:           8
58 ; CHECK-NEXT:         .value_kind:     hidden_completion_action
59 ; CHECK:          .language:       OpenCL C
60 ; CHECK-NEXT:     .language_version:
61 ; CHECK-NEXT:       - 2
62 ; CHECK-NEXT:       - 0
63 ; CHECK:          .name:           test_enqueue_kernel_caller
64 ; CHECK:          .symbol:         test_enqueue_kernel_caller.kd
65 define amdgpu_kernel void @test_enqueue_kernel_caller(i8 %a) #1
66     !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
67     !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
68   ret void
71 ; CHECK:        - .args:
72 ; CHECK-NEXT:       - .name:           a
73 ; CHECK-NEXT:         .offset:         0
74 ; CHECK-NEXT:         .size:           1
75 ; CHECK-NEXT:         .type_name:      char
76 ; CHECK-NEXT:         .value_kind:     by_value
77 ; CHECK-NEXT:       - .offset:         8
78 ; CHECK-NEXT:         .size:           8
79 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_x
80 ; CHECK-NEXT:       - .offset:         16
81 ; CHECK-NEXT:         .size:           8
82 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_y
83 ; CHECK-NEXT:       - .offset:         24
84 ; CHECK-NEXT:         .size:           8
85 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_z
86 ; CHECK-NEXT:       - .offset:         32
87 ; CHECK-NEXT:         .size:           8
88 ; CHECK-NEXT:         .value_kind:     hidden_hostcall_buffer
89 ; CHECK-NEXT:       - .offset:         40
90 ; CHECK-NEXT:         .size:           8
91 ; CHECK-NEXT:         .value_kind:     hidden_default_queue
92 ; CHECK-NEXT:       - .offset:         48
93 ; CHECK-NEXT:         .size:           8
94 ; CHECK-NEXT:         .value_kind:     hidden_none
95 ; CHECK:          .language:       OpenCL C
96 ; CHECK-NEXT:     .language_version:
97 ; CHECK-NEXT:       - 2
98 ; CHECK-NEXT:       - 0
99 ; CHECK:          .name:           test_no_completion_action
100 ; CHECK:          .symbol:         test_no_completion_action.kd
101 define amdgpu_kernel void @test_no_completion_action(i8 %a) #2
102     !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
103     !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
104   ret void
107 ; CHECK:        - .args:
108 ; CHECK-NEXT:       - .name:           a
109 ; CHECK-NEXT:         .offset:         0
110 ; CHECK-NEXT:         .size:           1
111 ; CHECK-NEXT:         .type_name:      char
112 ; CHECK-NEXT:         .value_kind:     by_value
113 ; CHECK-NEXT:       - .offset:         8
114 ; CHECK-NEXT:         .size:           8
115 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_x
116 ; CHECK-NEXT:       - .offset:         16
117 ; CHECK-NEXT:         .size:           8
118 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_y
119 ; CHECK-NEXT:       - .offset:         24
120 ; CHECK-NEXT:         .size:           8
121 ; CHECK-NEXT:         .value_kind:     hidden_global_offset_z
122 ; CHECK-NEXT:       - .offset:         32
123 ; CHECK-NEXT:         .size:           8
124 ; CHECK-NEXT:         .value_kind:     hidden_hostcall_buffer
125 ; CHECK-NEXT:       - .offset:         40
126 ; CHECK-NEXT:         .size:           8
127 ; CHECK-NEXT:         .value_kind:     hidden_none
128 ; CHECK-NEXT:       - .offset:         48
129 ; CHECK-NEXT:         .size:           8
130 ; CHECK-NEXT:         .value_kind:     hidden_completion_action
131 ; CHECK:          .language:       OpenCL C
132 ; CHECK-NEXT:     .language_version:
133 ; CHECK-NEXT:       - 2
134 ; CHECK-NEXT:       - 0
135 ; CHECK:          .name:           test_no_default_queue
136 ; CHECK:          .symbol:         test_no_default_queue.kd
137 define amdgpu_kernel void @test_no_default_queue(i8 %a) #3
138     !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
139     !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
140   ret void
143 ; CHECK:  amdhsa.version:
144 ; CHECK-NEXT: - 1
145 ; CHECK-NEXT: - 1
146 ; CHECK-NOT:  amdhsa.printf:
148 attributes #0 = { optnone noinline "amdgpu-no-default-queue" "amdgpu-no-completion-action" "amdgpu-implicitarg-num-bytes"="48" }
149 attributes #1 = { optnone noinline "amdgpu-implicitarg-num-bytes"="48" }
150 attributes #2 = { optnone noinline "amdgpu-no-completion-action" "amdgpu-implicitarg-num-bytes"="48" }
151 attributes #3 = { optnone noinline "amdgpu-no-default-queue" "amdgpu-implicitarg-num-bytes"="48" }
153 !llvm.module.flags = !{!0}
154 !0 = !{i32 1, !"amdhsa_code_object_version", i32 400}
156 !1 = !{i32 0}
157 !2 = !{!"none"}
158 !3 = !{!"char"}
159 !4 = !{!""}
161 !opencl.ocl.version = !{!90}
162 !90 = !{i32 2, i32 0}
164 ; PARSER: AMDGPU HSA Metadata Parser Test: PASS