1 // RUN: mlir-opt %s -split-input-file -verify-diagnostics
5 // expected-error@below {{"llvm.noalias" attribute attached to non-pointer LLVM type}}
6 llvm.func @invalid_noalias_arg_type(%0 : i32 {llvm.noalias})
10 // expected-error@below {{"llvm.noalias" should be a unit attribute}}
11 llvm.func @invalid_noalias_attr_type(%0 : !llvm.ptr {llvm.noalias = 10 : i32})
15 // expected-error@below {{"llvm.readonly" attribute attached to non-pointer LLVM type}}
16 llvm.func @invalid_readonly_arg_type(%0 : i32 {llvm.readonly})
20 // expected-error@below {{"llvm.readonly" should be a unit attribute}}
21 llvm.func @invalid_readonly_attr_type(%0 : i32 {llvm.readonly = i32})
25 // expected-error@below {{"llvm.nest" attribute attached to non-pointer LLVM type}}
26 llvm.func @invalid_nest_arg_type(%0 : i32 {llvm.nest})
30 // expected-error@below {{"llvm.nest" should be a unit attribute}}
31 llvm.func @invalid_nest_attr_type(%0 : i32 {llvm.nest = "foo"})
35 // expected-error@below {{"llvm.align" attribute attached to non-pointer LLVM type}}
36 llvm.func @invalid_align_arg_type(%0 : i32 {llvm.align = 10 : i32})
40 // expected-error@below {{"llvm.align" should be an integer attribute}}
41 llvm.func @invalid_align_attr_type(%0 : i32 {llvm.align = "foo"})
45 // expected-error@below {{"llvm.sret" attribute attached to non-pointer LLVM type}}
46 llvm.func @invalid_sret_arg_type(%0 : i32 {llvm.sret = !llvm.struct<(i32)>})
50 // expected-error@below {{"llvm.byval" attribute attached to non-pointer LLVM type}}
51 llvm.func @invalid_byval_arg_type(%0 : i32 {llvm.byval = !llvm.struct<(i32)>})
55 // expected-error@below {{"llvm.byref" attribute attached to non-pointer LLVM type}}
56 llvm.func @invalid_byref_arg_type(%0 : i32 {llvm.byref = !llvm.struct<(i32)>})
60 // expected-error@below {{"llvm.inalloca" attribute attached to non-pointer LLVM type}}
61 llvm.func @invalid_inalloca_arg_type(%0 : i32 {llvm.inalloca = !llvm.struct<(i32)>})
65 // expected-error@below {{"llvm.signext" attribute attached to non-integer LLVM type}}
66 llvm.func @invalid_signext_arg_type(%0 : f32 {llvm.signext})
70 // expected-error@below {{"llvm.signext" should be a unit attribute}}
71 llvm.func @invalid_signext_attr_type(%0 : i32 {llvm.signext = !llvm.struct<(i32)>})
75 // expected-error@below {{"llvm.zeroext" attribute attached to non-integer LLVM type}}
76 llvm.func @invalid_zeroext_arg_type(%0 : f32 {llvm.zeroext})
80 // expected-error@below {{"llvm.zeroext" should be a unit attribute}}
81 llvm.func @invalid_zeroext_attr_type(%0 : i32 {llvm.zeroext = !llvm.struct<(i32)>})
85 // expected-error@below {{"llvm.noundef" should be a unit attribute}}
86 llvm.func @invalid_noundef_attr_type(%0 : i32 {llvm.noundef = !llvm.ptr})
90 // expected-error@below {{"llvm.dereferenceable" attribute attached to non-pointer LLVM type}}
91 llvm.func @invalid_dereferenceable_arg_type(%0 : f32 {llvm.dereferenceable = 12 : i64})
95 // expected-error@below {{"llvm.dereferenceable" should be an integer attribute}}
96 llvm.func @invalid_dereferenceable_attr_type(%0 : !llvm.ptr {llvm.dereferenceable = !llvm.struct<(i32)>})
100 // expected-error@below {{"llvm.dereferenceable_or_null" attribute attached to non-pointer LLVM type}}
101 llvm.func @invalid_dereferenceable_or_null_arg_type(%0 : f32 {llvm.dereferenceable_or_null = 12 : i64})
105 // expected-error@below {{"llvm.dereferenceable_or_null" should be an integer attribute}}
106 llvm.func @invalid_dereferenceable_or_null_attr_type(%0 : !llvm.ptr {llvm.dereferenceable_or_null = !llvm.struct<(i32)>})
110 // expected-error@below {{"llvm.inreg" should be a unit attribute}}
111 llvm.func @invalid_inreg_attr_type(%0 : i32 {llvm.inreg = !llvm.ptr})
115 // expected-error@below {{"llvm.nocapture" attribute attached to non-pointer LLVM type}}
116 llvm.func @invalid_nocapture_arg_type(%0 : f32 {llvm.nocapture})
120 // expected-error@below {{"llvm.nocapture" should be a unit attribute}}
121 llvm.func @invalid_nocapture_attr_type(%0 : !llvm.ptr {llvm.nocapture = f32})
125 // expected-error@below {{"llvm.nofree" attribute attached to non-pointer LLVM type}}
126 llvm.func @invalid_nofree_arg_type(%0 : f32 {llvm.nofree})
130 // expected-error@below {{"llvm.nofree" should be a unit attribute}}
131 llvm.func @invalid_nofree_attr_type(%0 : !llvm.ptr {llvm.nofree = f32})
135 // expected-error@below {{"llvm.nonnull" attribute attached to non-pointer LLVM type}}
136 llvm.func @invalid_nonnull_arg_type(%0 : f32 {llvm.nonnull})
140 // expected-error@below {{"llvm.nonnull" should be a unit attribute}}
141 llvm.func @invalid_nonnull_attr_type(%0 : !llvm.ptr {llvm.nonnull = f32})
145 // expected-error@below {{"llvm.preallocated" attribute attached to non-pointer LLVM type}}
146 llvm.func @invalid_preallocated_arg_type(%0 : f32 {llvm.preallocated = i64})
150 // expected-error@below {{"llvm.preallocated" should be a type attribute}}
151 llvm.func @invalid_preallocated_attr_type(%0 : !llvm.ptr {llvm.preallocated})
155 // expected-error@below {{"llvm.returned" should be a unit attribute}}
156 llvm.func @invalid_returned_attr_type(%0 : i32 {llvm.returned = !llvm.ptr})
160 // expected-error@below {{"llvm.alignstack" attribute attached to non-pointer LLVM type}}
161 llvm.func @invalid_alignstack_arg_type(%0 : i32 {llvm.alignstack = 10 : i32})
165 // expected-error@below {{"llvm.alignstack" should be an integer attribute}}
166 llvm.func @invalid_alignstack_attr_type(%0 : i32 {llvm.alignstack = "foo"})
170 // expected-error@below {{"llvm.writeonly" attribute attached to non-pointer LLVM type}}
171 llvm.func @invalid_writeonly_arg_type(%0 : i32 {llvm.writeonly})
175 // expected-error@below {{"llvm.writeonly" should be a unit attribute}}
176 llvm.func @invalid_writeonly_attr_type(%0 : i32 {llvm.writeonly = i32})
183 // expected-error@below {{expects result attribute array to have the same number of elements as the number of function results, got 1, but expected 0}}
184 llvm.func @void_def() -> (!llvm.void {llvm.noundef})
188 // expected-error @below{{"llvm.align" should be an integer attribute}}
189 llvm.func @alignattr_ret() -> (!llvm.ptr {llvm.align = 1.0 : f32})
193 // expected-error @below{{"llvm.align" attribute attached to non-pointer LLVM type}}
194 llvm.func @alignattr_ret() -> (i32 {llvm.align = 4})
198 // expected-error @below{{"llvm.noalias" should be a unit attribute}}
199 llvm.func @noaliasattr_ret() -> (!llvm.ptr {llvm.noalias = 1})
203 // expected-error @below{{"llvm.noalias" attribute attached to non-pointer LLVM type}}
204 llvm.func @noaliasattr_ret() -> (i32 {llvm.noalias})
208 // expected-error @below{{"llvm.noundef" should be a unit attribute}}
209 llvm.func @noundefattr_ret() -> (!llvm.ptr {llvm.noundef = 1})
213 // expected-error @below{{"llvm.signext" should be a unit attribute}}
214 llvm.func @signextattr_ret() -> (i32 {llvm.signext = 1})
218 // expected-error @below{{"llvm.signext" attribute attached to non-integer LLVM type}}
219 llvm.func @signextattr_ret() -> (f32 {llvm.signext})
223 // expected-error @below{{"llvm.zeroext" should be a unit attribute}}
224 llvm.func @zeroextattr_ret() -> (i32 {llvm.zeroext = 1})
228 // expected-error @below{{"llvm.zeroext" attribute attached to non-integer LLVM type}}
229 llvm.func @zeroextattr_ret() -> (f32 {llvm.zeroext})
233 // expected-error @below{{"llvm.allocalign" is not a valid result attribute}}
234 llvm.func @allocalign_ret() -> (f32 {llvm.allocalign})
238 // expected-error @below{{"llvm.allocptr" is not a valid result attribute}}
239 llvm.func @allocptr_ret() -> (!llvm.ptr {llvm.allocptr})
243 // expected-error @below{{"llvm.byval" is not a valid result attribute}}
244 llvm.func @byval_ret() -> (!llvm.ptr {llvm.byval = i64})
248 // expected-error @below{{"llvm.byref" is not a valid result attribute}}
249 llvm.func @byref_ret() -> (!llvm.ptr {llvm.byref = i64})
253 // expected-error @below{{"llvm.inalloca" is not a valid result attribute}}
254 llvm.func @inalloca_ret() -> (!llvm.ptr {llvm.inalloca = i64})
258 // expected-error @below{{"llvm.nest" is not a valid result attribute}}
259 llvm.func @nest_ret() -> (!llvm.ptr {llvm.nest})
263 // expected-error @below{{"llvm.nocapture" is not a valid result attribute}}
264 llvm.func @nocapture_ret() -> (!llvm.ptr {llvm.nocapture})
268 // expected-error @below{{"llvm.nofree" is not a valid result attribute}}
269 llvm.func @nofree_ret() -> (!llvm.ptr {llvm.nofree})
273 // expected-error @below{{"llvm.preallocated" is not a valid result attribute}}
274 llvm.func @preallocated_ret() -> (!llvm.ptr {llvm.preallocated = i64})
278 // expected-error @below{{"llvm.readnone" is not a valid result attribute}}
279 llvm.func @readnone_ret() -> (!llvm.ptr {llvm.readnone})
283 // expected-error @below{{"llvm.readonly" is not a valid result attribute}}
284 llvm.func @readonly_ret() -> (!llvm.ptr {llvm.readonly})
288 // expected-error @below{{"llvm.alignstack" is not a valid result attribute}}
289 llvm.func @alignstack_ret() -> (!llvm.ptr {llvm.alignstack = 16 : i64})
293 // expected-error @below{{"llvm.sret" is not a valid result attribute}}
294 llvm.func @sret_ret() -> (!llvm.ptr {llvm.sret = i64})
298 // expected-error @below{{"llvm.writeonly" is not a valid result attribute}}
299 llvm.func @writeonly_ret() -> (!llvm.ptr {llvm.writeonly})