1 // RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics | FileCheck %s
3 // CHECK: succeededSameOperandsElementType
4 func.func @succeededSameOperandsElementType(%t10x10 : tensor<10x10xf32>, %t1f: tensor<1xf32>, %v1: vector<1xf32>, %t1i: tensor<1xi32>, %sf: f32) {
5 "test.same_operand_element_type"(%t1f, %t1f) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xi32>
6 "test.same_operand_element_type"(%t1f, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> tensor<1xi32>
7 "test.same_operand_element_type"(%t10x10, %v1) : (tensor<10x10xf32>, vector<1xf32>) -> tensor<1xi32>
8 "test.same_operand_element_type"(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<1xi32>
9 "test.same_operand_element_type"(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<121xi32>
10 "test.same_operand_element_type"(%sf, %sf) : (f32, f32) -> i32
11 "test.same_operand_element_type"(%sf, %t1f) : (f32, tensor<1xf32>) -> tensor<121xi32>
12 "test.same_operand_element_type"(%sf, %v1) : (f32, vector<1xf32>) -> tensor<121xi32>
13 "test.same_operand_element_type"(%sf, %t10x10) : (f32, tensor<10x10xf32>) -> tensor<121xi32>
19 func.func @failedSameOperandElementType(%t1f: tensor<1xf32>, %t1i: tensor<1xi32>) {
20 // expected-error@+1 {{requires the same element type for all operands}}
21 "test.same_operand_element_type"(%t1f, %t1i) : (tensor<1xf32>, tensor<1xi32>) -> tensor<1xf32>
26 func.func @failedSameOperandAndResultElementType_no_operands() {
27 // expected-error@+1 {{expected 2 operands, but found 0}}
28 "test.same_operand_element_type"() : () -> tensor<1xf32>
33 func.func @failedSameOperandElementType_scalar_type_mismatch(%si: i32, %sf: f32) {
34 // expected-error@+1 {{requires the same element type for all operands}}
35 "test.same_operand_element_type"(%sf, %si) : (f32, i32) -> tensor<1xf32>
40 // CHECK: succeededSameOperandAndResultElementType
41 func.func @succeededSameOperandAndResultElementType(%t10x10 : tensor<10x10xf32>, %t1f: tensor<1xf32>, %v1: vector<1xf32>, %t1i: tensor<1xi32>, %sf: f32) {
42 "test.same_operand_and_result_element_type"(%t1f, %t1f) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32>
43 "test.same_operand_and_result_element_type"(%t1f, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> tensor<1xf32>
44 "test.same_operand_and_result_element_type"(%t10x10, %v1) : (tensor<10x10xf32>, vector<1xf32>) -> tensor<1xf32>
45 "test.same_operand_and_result_element_type"(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<1xf32>
46 "test.same_operand_and_result_element_type"(%v1, %t1f) : (vector<1xf32>, tensor<1xf32>) -> tensor<121xf32>
47 "test.same_operand_and_result_element_type"(%sf, %sf) : (f32, f32) -> f32
48 "test.same_operand_and_result_element_type"(%sf, %t1f) : (f32, tensor<1xf32>) -> tensor<121xf32>
49 "test.same_operand_and_result_element_type"(%sf, %v1) : (f32, vector<1xf32>) -> tensor<121xf32>
50 "test.same_operand_and_result_element_type"(%sf, %t10x10) : (f32, tensor<10x10xf32>) -> tensor<121xf32>
56 func.func @failedSameOperandAndResultElementType_operand_result_mismatch(%t1f: tensor<1xf32>) {
57 // expected-error@+1 {{requires the same element type for all operands and results}}
58 "test.same_operand_and_result_element_type"(%t1f, %t1f) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xi32>
63 func.func @failedSameOperandAndResultElementType_operand_mismatch(%t1f: tensor<1xf32>, %t1i: tensor<1xi32>) {
64 // expected-error@+1 {{requires the same element type for all operands and results}}
65 "test.same_operand_and_result_element_type"(%t1f, %t1i) : (tensor<1xf32>, tensor<1xi32>) -> tensor<1xf32>
70 func.func @failedSameOperandAndResultElementType_result_mismatch(%t1f: tensor<1xf32>) {
71 // expected-error@+1 {{requires the same element type for all operands and results}}
72 %0:2 = "test.same_operand_and_result_element_type"(%t1f) : (tensor<1xf32>) -> (tensor<1xf32>, tensor<1xi32>)
77 func.func @failedSameOperandAndResultElementType_no_operands() {
78 // expected-error@+1 {{expected 1 or more operands}}
79 "test.same_operand_and_result_element_type"() : () -> tensor<1xf32>
84 func.func @failedSameOperandAndResultElementType_no_results(%t1f: tensor<1xf32>) {
85 // expected-error@+1 {{expected 1 or more results}}
86 "test.same_operand_and_result_element_type"(%t1f) : (tensor<1xf32>) -> ()
91 // CHECK: succeededSameOperandShape
92 func.func @succeededSameOperandShape(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>, %m10x10 : memref<10x10xi32>, %tr: tensor<*xf32>) {
93 "test.same_operand_shape"(%t1, %t1) : (tensor<1xf32>, tensor<1xf32>) -> ()
94 "test.same_operand_shape"(%t10x10, %t10x10) : (tensor<10x10xf32>, tensor<10x10xf32>) -> ()
95 "test.same_operand_shape"(%t1, %tr) : (tensor<1xf32>, tensor<*xf32>) -> ()
96 "test.same_operand_shape"(%t10x10, %m10x10) : (tensor<10x10xf32>, memref<10x10xi32>) -> ()
102 func.func @failedSameOperandShape_operand_mismatch(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>) {
103 // expected-error@+1 {{requires the same shape for all operands}}
104 "test.same_operand_shape"(%t1, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> ()
109 func.func @failedSameOperandShape_no_operands() {
110 // expected-error@+1 {{expected 1 or more operands}}
111 "test.same_operand_shape"() : () -> ()
116 // CHECK: succeededSameOperandAndResultShape
117 func.func @succeededSameOperandAndResultShape(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>, %tr: tensor<*xf32>, %t1d: tensor<?xf32>) {
118 "test.same_operand_and_result_shape"(%t1, %t1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32>
119 "test.same_operand_and_result_shape"(%t10x10, %t10x10) : (tensor<10x10xf32>, tensor<10x10xf32>) -> tensor<10x10xf32>
120 "test.same_operand_and_result_shape"(%t1, %tr) : (tensor<1xf32>, tensor<*xf32>) -> tensor<1xf32>
121 "test.same_operand_and_result_shape"(%t1, %t1d) : (tensor<1xf32>, tensor<?xf32>) -> tensor<1xf32>
122 "test.same_operand_and_result_shape"(%t1, %t1d) : (tensor<1xf32>, tensor<?xf32>) -> memref<1xf32>
129 func.func @failedSameOperandAndResultShape_operand_result_mismatch(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>) {
130 // expected-error@+1 {{requires the same shape for all operands and results}}
131 "test.same_operand_and_result_shape"(%t1, %t10x10) : (tensor<1xf32>, tensor<10x10xf32>) -> tensor<10x10xf32>
136 func.func @failedSameOperandAndResultShape_operand_result_mismatch(%t10 : tensor<10xf32>, %t1: tensor<?xf32>) {
137 // expected-error@+1 {{requires the same shape for all operands and results}}
138 "test.same_operand_and_result_shape"(%t1, %t10) : (tensor<?xf32>, tensor<10xf32>) -> tensor<3xf32>
143 func.func @failedSameOperandAndResultShape_no_operands() {
144 // expected-error@+1 {{expected 1 or more operands}}
145 "test.same_operand_and_result_shape"() : () -> (tensor<1xf32>)
150 func.func @failedSameOperandAndResultShape_no_operands(%t1: tensor<1xf32>) {
151 // expected-error@+1 {{expected 1 or more results}}
152 "test.same_operand_and_result_shape"(%t1) : (tensor<1xf32>) -> ()
157 // CHECK: succeededSameOperandAndResultType
158 func.func @succeededSameOperandAndResultType(%t10x10 : tensor<10x10xf32>, %t1: tensor<1xf32>, %tr: tensor<*xf32>, %t1d: tensor<?xf32>, %i32 : i32) {
159 "test.same_operand_and_result_type"(%t1, %t1) : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32>
160 "test.same_operand_and_result_type"(%t10x10, %t10x10) : (tensor<10x10xf32>, tensor<10x10xf32>) -> tensor<10x10xf32>
161 "test.same_operand_and_result_type"(%t1, %tr) : (tensor<1xf32>, tensor<*xf32>) -> tensor<1xf32>
162 "test.same_operand_and_result_type"(%t1, %t1d) : (tensor<1xf32>, tensor<?xf32>) -> tensor<1xf32>
163 "test.same_operand_and_result_type"(%i32, %i32) : (i32, i32) -> i32
169 func.func @failedSameOperandAndResultType_operand_result_mismatch(%t10 : tensor<10xf32>, %t20 : tensor<20xf32>) {
170 // expected-error@+1 {{requires the same type for all operands and results}}
171 "test.same_operand_and_result_type"(%t10, %t20) : (tensor<10xf32>, tensor<20xf32>) -> tensor<10xf32>
177 func.func @failedSameOperandAndResultType_encoding_mismatch(%t10 : tensor<10xf32>, %t20 : tensor<10xf32>) {
178 // expected-error@+1 {{requires the same encoding for all operands and results}}
179 "test.same_operand_and_result_type"(%t10, %t20) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10xf32, "enc">
185 func.func @failedElementwiseMappable_different_rankedness(%arg0: tensor<?xf32>, %arg1: tensor<*xf32>) {
186 // expected-error@+1 {{all non-scalar operands/results must have the same shape and base type}}
187 %0 = "test.elementwise_mappable"(%arg0, %arg1) : (tensor<?xf32>, tensor<*xf32>) -> tensor<*xf32>
193 func.func @failedElementwiseMappable_different_rank(%arg0: tensor<?xf32>, %arg1: tensor<?x?xf32>) {
194 // expected-error@+1 {{all non-scalar operands/results must have the same shape and base type}}
195 %0 = "test.elementwise_mappable"(%arg0, %arg1) : (tensor<?xf32>, tensor<?x?xf32>) -> tensor<?x?xf32>
201 func.func @elementwiseMappable_dynamic_shapes(%arg0: tensor<?xf32>,
202 %arg1: tensor<5xf32>) {
203 %0 = "test.elementwise_mappable"(%arg0, %arg1) :
204 (tensor<?xf32>, tensor<5xf32>) -> tensor<?xf32>
210 func.func @failedElementwiseMappable_different_base_type(%arg0: vector<2xf32>, %arg1: tensor<2xf32>) {
211 // expected-error@+1 {{all non-scalar operands/results must have the same shape and base type}}
212 %0 = "test.elementwise_mappable"(%arg0, %arg1) : (vector<2xf32>, tensor<2xf32>) -> tensor<2xf32>
218 func.func @failedElementwiseMappable_non_scalar_output(%arg0: vector<2xf32>) {
219 // expected-error@+1 {{if an operand is non-scalar, then there must be at least one non-scalar result}}
220 %0 = "test.elementwise_mappable"(%arg0) : (vector<2xf32>) -> f32
226 func.func @failedElementwiseMappable_non_scalar_result_all_scalar_input(%arg0: f32) {
227 // expected-error@+1 {{if a result is non-scalar, then at least one operand must be non-scalar}}
228 %0 = "test.elementwise_mappable"(%arg0) : (f32) -> tensor<f32>
234 func.func @failedElementwiseMappable_mixed_scalar_non_scalar_results(%arg0: tensor<10xf32>) {
235 // expected-error@+1 {{if an operand is non-scalar, then all results must be non-scalar}}
236 %0, %1 = "test.elementwise_mappable"(%arg0) : (tensor<10xf32>) -> (f32, tensor<10xf32>)
242 func.func @failedElementwiseMappable_zero_results(%arg0: tensor<10xf32>) {
243 // expected-error@+1 {{if an operand is non-scalar, then there must be at least one non-scalar result}}
244 "test.elementwise_mappable"(%arg0) : (tensor<10xf32>) -> ()
250 func.func @failedElementwiseMappable_zero_operands() {
251 // expected-error@+1 {{if a result is non-scalar, then at least one operand must be non-scalar}}
252 "test.elementwise_mappable"() : () -> (tensor<6xf32>)
258 func.func @succeededElementwiseMappable(%arg0: vector<2xf32>) {
259 // Check that varying element types are allowed.
260 // CHECK: test.elementwise_mappable
261 %0 = "test.elementwise_mappable"(%arg0) : (vector<2xf32>) -> vector<2xf16>
267 func.func @failedHasParent_wrong_parent() {
269 // expected-error@+1 {{'test.child' op expects parent op 'test.parent'}}
270 "test.child"() : () -> ()
276 // CHECK: succeededParentOneOf
277 func.func @succeededParentOneOf() {
279 "test.child_with_parent_one_of"() : () -> ()
280 "test.finish"() : () -> ()
287 // CHECK: succeededParent1OneOf
288 func.func @succeededParent1OneOf() {
290 "test.child_with_parent_one_of"() : () -> ()
291 "test.finish"() : () -> ()
298 func.func @failedParentOneOf_wrong_parent1() {
300 // expected-error@+1 {{'test.child_with_parent_one_of' op expects parent op to be one of 'test.parent, test.parent1'}}
301 "test.child_with_parent_one_of"() : () -> ()
302 "test.finish"() : () -> ()
309 func.func @failedSingleBlockImplicitTerminator_empty_block() {
310 // expected-error@+1 {{'test.SingleBlockImplicitTerminator' op expects a non-empty block}}
311 "test.SingleBlockImplicitTerminator"() ({
318 func.func @failedSingleBlockImplicitTerminator_too_many_blocks() {
319 // expected-error@+1 {{'test.SingleBlockImplicitTerminator' op expects region #0 to have 0 or 1 block}}
320 "test.SingleBlockImplicitTerminator"() ({
322 "test.finish" () : () -> ()
324 "test.finish" () : () -> ()
330 func.func @failedSingleBlockImplicitTerminator_missing_terminator() {
331 // expected-error@+2 {{'test.SingleBlockImplicitTerminator' op expects regions to end with 'test.finish'}}
332 // expected-note@+1 {{in custom textual format, the absence of terminator implies 'test.finish'}}
333 "test.SingleBlockImplicitTerminator"() ({
335 "test.non_existent_op"() : () -> ()
341 // Test the invariants of operations with the Symbol Trait.
343 // expected-error@+1 {{op requires attribute 'sym_name'}}
344 "test.symbol"() {} : () -> ()
348 // expected-error@+1 {{invalid properties {sym_name = "foo_2", sym_visibility} for op test.symbol: Invalid attribute `sym_visibility` in property conversion: unit}}
349 "test.symbol"() <{sym_name = "foo_2", sym_visibility}> : () -> ()
353 // expected-error@+1 {{visibility expected to be one of ["public", "private", "nested"]}}
354 "test.symbol"() {sym_name = "foo_2", sym_visibility = "foo"} : () -> ()
358 "test.symbol"() {sym_name = "foo_3", sym_visibility = "nested"} : () -> ()
359 "test.symbol"() {sym_name = "foo_4", sym_visibility = "private"} : () -> ()
360 "test.symbol"() {sym_name = "foo_5", sym_visibility = "public"} : () -> ()
361 "test.symbol"() {sym_name = "foo_6"} : () -> ()
365 // Test that operation with the SymbolTable Trait define a new symbol scope.
366 "test.symbol_scope"() ({
367 func.func private @foo()
368 "test.finish" () : () -> ()
370 func.func private @foo()
374 // Test that operation with the SymbolTable Trait fails with too many blocks.
375 // expected-error@+1 {{op expects region #0 to have 0 or 1 blocks}}
376 "test.symbol_scope"() ({
378 "test.finish" () : () -> ()
380 "test.finish" () : () -> ()
385 func.func @failedMissingOperandSizeAttr(%arg: i32) {
386 // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes'}}
387 "test.attr_sized_operands"(%arg, %arg, %arg, %arg) : (i32, i32, i32, i32) -> ()
392 func.func @failedOperandSizeAttrWrongType(%arg: i32) {
393 // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes'}}
394 "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = 10} : (i32, i32, i32, i32) -> ()
399 func.func @failedOperandSizeAttrWrongElementType(%arg: i32) {
400 // expected-error @+1 {{op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes'}}
401 "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array<i64: 1, 1, 1, 1>} : (i32, i32, i32, i32) -> ()
406 func.func @failedOperandSizeAttrNegativeValue(%arg: i32) {
407 // expected-error @+1 {{'operandSegmentSizes' attribute cannot have negative elements}}
408 "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array<i32: 1, 1, -1, 1>} : (i32, i32, i32, i32) -> ()
413 func.func @failedOperandSizeAttrWrongTotalSize(%arg: i32) {
414 // expected-error @+1 {{operand count (4) does not match with the total size (3) specified in attribute 'operandSegmentSizes'}}
415 "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array<i32: 0, 1, 1, 1>} : (i32, i32, i32, i32) -> ()
420 func.func @failedOperandSizeAttrWrongCount(%arg: i32) {
421 // expected-error @+1 {{test.attr_sized_operands' op operand count (4) does not match with the total size (0) specified in attribute 'operandSegmentSizes}}
422 "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array<i32: 2, 1, 1>} : (i32, i32, i32, i32) -> ()
427 func.func @succeededOperandSizeAttr(%arg: i32) {
428 // CHECK: test.attr_sized_operands
429 "test.attr_sized_operands"(%arg, %arg, %arg, %arg) {operandSegmentSizes = array<i32: 0, 2, 1, 1>} : (i32, i32, i32, i32) -> ()
435 func.func @failedMissingResultSizeAttr() {
436 // expected-error @+1 {{op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}}
437 %0:4 = "test.attr_sized_results"() : () -> (i32, i32, i32, i32)
442 func.func @failedResultSizeAttrWrongType() {
443 // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}}
444 %0:4 = "test.attr_sized_results"() {resultSegmentSizes = 10} : () -> (i32, i32, i32, i32)
450 func.func @failedResultSizeAttrWrongElementType() {
451 // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}}
452 %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array<i64: 1, 1, 1, 1>} : () -> (i32, i32, i32, i32)
457 func.func @failedResultSizeAttrNegativeValue() {
458 // expected-error @+1 {{'resultSegmentSizes' attribute cannot have negative elements}}
459 %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array<i32: 1, 1, -1, 1>} : () -> (i32, i32, i32, i32)
464 func.func @failedResultSizeAttrWrongTotalSize() {
465 // expected-error @+1 {{result count (4) does not match with the total size (3) specified in attribute 'resultSegmentSizes'}}
466 %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array<i32: 0, 1, 1, 1>} : () -> (i32, i32, i32, i32)
471 func.func @failedResultSizeAttrWrongCount() {
472 // expected-error @+1 {{ op result count (4) does not match with the total size (0) specified in attribute 'resultSegmentSizes'}}
473 %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array<i32: 2, 1, 1>} : () -> (i32, i32, i32, i32)
478 func.func @succeededResultSizeAttr() {
479 // CHECK: test.attr_sized_results
480 %0:4 = "test.attr_sized_results"() {resultSegmentSizes = array<i32: 0, 2, 1, 1>} : () -> (i32, i32, i32, i32)
486 // CHECK-LABEL: @succeededOilistTrivial
487 func.func @succeededOilistTrivial() {
488 // CHECK: test.oilist_with_keywords_only keyword
489 test.oilist_with_keywords_only keyword
490 // CHECK: test.oilist_with_keywords_only otherKeyword
491 test.oilist_with_keywords_only otherKeyword
492 // CHECK: test.oilist_with_keywords_only keyword otherKeyword
493 test.oilist_with_keywords_only keyword otherKeyword
494 // CHECK: test.oilist_with_keywords_only keyword otherKeyword
495 test.oilist_with_keywords_only otherKeyword keyword
496 // CHECK: test.oilist_with_keywords_only thirdKeyword
497 test.oilist_with_keywords_only thirdKeyword
498 // CHECK: test.oilist_with_keywords_only keyword thirdKeyword
499 test.oilist_with_keywords_only keyword thirdKeyword
505 // CHECK-LABEL: @succeededOilistTrivialProperties
506 func.func @succeededOilistTrivialProperties() {
507 // CHECK: test.oilist_with_keywords_only_properties keyword
508 test.oilist_with_keywords_only_properties keyword
509 // CHECK: test.oilist_with_keywords_only_properties otherKeyword
510 test.oilist_with_keywords_only_properties otherKeyword
511 // CHECK: test.oilist_with_keywords_only_properties keyword otherKeyword
512 test.oilist_with_keywords_only_properties keyword otherKeyword
513 // CHECK: test.oilist_with_keywords_only_properties keyword otherKeyword
514 test.oilist_with_keywords_only_properties otherKeyword keyword
515 // CHECK: test.oilist_with_keywords_only_properties thirdKeyword
516 test.oilist_with_keywords_only_properties thirdKeyword
517 // CHECK: test.oilist_with_keywords_only_properties keyword thirdKeyword
518 test.oilist_with_keywords_only_properties keyword thirdKeyword
524 // CHECK-LABEL: @succeededOilistSimple
525 func.func @succeededOilistSimple(%arg0 : i32, %arg1 : i32, %arg2 : i32) {
526 // CHECK: test.oilist_with_simple_args keyword %{{.*}} : i32
527 test.oilist_with_simple_args keyword %arg0 : i32
528 // CHECK: test.oilist_with_simple_args otherKeyword %{{.*}} : i32
529 test.oilist_with_simple_args otherKeyword %arg0 : i32
530 // CHECK: test.oilist_with_simple_args thirdKeyword %{{.*}} : i32
531 test.oilist_with_simple_args thirdKeyword %arg0 : i32
533 // CHECK: test.oilist_with_simple_args keyword %{{.*}} : i32 otherKeyword %{{.*}} : i32
534 test.oilist_with_simple_args keyword %arg0 : i32 otherKeyword %arg1 : i32
535 // CHECK: test.oilist_with_simple_args keyword %{{.*}} : i32 thirdKeyword %{{.*}} : i32
536 test.oilist_with_simple_args keyword %arg0 : i32 thirdKeyword %arg1 : i32
537 // CHECK: test.oilist_with_simple_args otherKeyword %{{.*}} : i32 thirdKeyword %{{.*}} : i32
538 test.oilist_with_simple_args thirdKeyword %arg0 : i32 otherKeyword %arg1 : i32
540 // CHECK: test.oilist_with_simple_args keyword %{{.*}} : i32 otherKeyword %{{.*}} : i32 thirdKeyword %{{.*}} : i32
541 test.oilist_with_simple_args keyword %arg0 : i32 otherKeyword %arg1 : i32 thirdKeyword %arg2 : i32
542 // CHECK: test.oilist_with_simple_args keyword %{{.*}} : i32 otherKeyword %{{.*}} : i32 thirdKeyword %{{.*}} : i32
543 test.oilist_with_simple_args otherKeyword %arg0 : i32 keyword %arg1 : i32 thirdKeyword %arg2 : i32
544 // CHECK: test.oilist_with_simple_args keyword %{{.*}} : i32 otherKeyword %{{.*}} : i32 thirdKeyword %{{.*}} : i32
545 test.oilist_with_simple_args otherKeyword %arg0 : i32 thirdKeyword %arg1 : i32 keyword %arg2 : i32
551 // CHECK-LABEL: @succeededOilistVariadic
552 // CHECK-SAME: (%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32, %[[ARG2:.*]]: i32)
553 func.func @succeededOilistVariadic(%arg0: i32, %arg1: i32, %arg2: i32) {
554 // CHECK: test.oilist_variadic_with_parens keyword(%[[ARG0]], %[[ARG1]] : i32, i32)
555 test.oilist_variadic_with_parens keyword (%arg0, %arg1 : i32, i32)
556 // CHECK: test.oilist_variadic_with_parens keyword(%[[ARG0]], %[[ARG1]] : i32, i32) otherKeyword(%[[ARG2]], %[[ARG1]] : i32, i32)
557 test.oilist_variadic_with_parens otherKeyword (%arg2, %arg1 : i32, i32) keyword (%arg0, %arg1 : i32, i32)
558 // CHECK: test.oilist_variadic_with_parens keyword(%[[ARG0]], %[[ARG1]] : i32, i32) otherKeyword(%[[ARG0]], %[[ARG1]] : i32, i32) thirdKeyword(%[[ARG2]], %[[ARG0]], %[[ARG1]] : i32, i32, i32)
559 test.oilist_variadic_with_parens thirdKeyword (%arg2, %arg0, %arg1 : i32, i32, i32) keyword (%arg0, %arg1 : i32, i32) otherKeyword (%arg0, %arg1 : i32, i32)
564 // CHECK-LABEL: succeededOilistCustom
565 // CHECK-SAME: (%[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32, %[[ARG2:.*]]: i32)
566 func.func @succeededOilistCustom(%arg0: i32, %arg1: i32, %arg2: i32) {
567 // CHECK: test.oilist_custom private(%[[ARG0]], %[[ARG1]] : i32, i32)
568 test.oilist_custom private (%arg0, %arg1 : i32, i32)
569 // CHECK: test.oilist_custom private(%[[ARG0]], %[[ARG1]] : i32, i32) nowait
570 test.oilist_custom private (%arg0, %arg1 : i32, i32) nowait
571 // CHECK: test.oilist_custom private(%arg0, %arg1 : i32, i32) reduction (%arg1) nowait
572 test.oilist_custom nowait reduction (%arg1) private (%arg0, %arg1 : i32, i32)
578 func.func @failedHasDominanceScopeOutsideDominanceFreeScope() -> () {
579 "test.ssacfg_region"() ({
581 // expected-error @+1 {{operand #0 does not dominate this use}}
582 %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
584 // expected-note @+1 {{operand defined here}}
585 %1 = "baz"() : () -> (i64)
592 // Ensure that SSACFG regions of operations in GRAPH regions are
593 // checked for dominance
594 func.func @illegalInsideDominanceFreeScope(%cond: i1) -> () {
597 // expected-error @+1 {{operand #0 does not dominate this use}}
598 %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
599 // expected-note @+1 {{operand defined here}}
600 %1 = "baz"(%2#0) : (i1) -> (i64)
602 "terminator"() : () -> ()
609 // Ensure that SSACFG regions of operations in GRAPH regions are
610 // checked for dominance
611 func.func @illegalCFGInsideDominanceFreeScope(%cond: i1) -> () {
614 "test.ssacfg_region"() ({
616 // expected-error @+1 {{operand #0 does not dominate this use}}
617 %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
622 %1 = "foo"() : ()->i64 // expected-note {{operand defined here}}
625 "terminator"() : () -> ()
632 // Ensure that GRAPH regions still have all values defined somewhere.
633 func.func @illegalCDFGInsideDominanceFreeScope() -> () {
635 // expected-error @+1 {{use of undeclared SSA value name}}
636 %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
637 "terminator"() : () -> ()
644 func.func @graph_region_cant_have_blocks() {
646 // expected-error@-1 {{'test.graph_region' op expects graph region #0 to have 0 or 1 blocks}}
650 "terminator"() : () -> ()
656 // Check that we can query traits in types
657 func.func @succeeded_type_traits() {
658 // CHECK: "test.result_type_with_trait"() : () -> !test.test_type_with_trait
659 "test.result_type_with_trait"() : () -> !test.test_type_with_trait
665 // Check that we can query traits in types
666 func.func @failed_type_traits() {
667 // expected-error@+1 {{result type should have trait 'TestTypeTrait'}}
668 "test.result_type_with_trait"() : () -> i32
674 // Check that we can query traits in attributes
675 func.func @succeeded_attr_traits() {
676 // CHECK: "test.attr_with_trait"() <{attr = #test.attr_with_trait}> : () -> ()
677 "test.attr_with_trait"() {attr = #test.attr_with_trait} : () -> ()
683 // Check that we can query traits in attributes
684 func.func @failed_attr_traits() {
685 // expected-error@+1 {{'attr' attribute should have trait 'TestAttrTrait'}}
686 "test.attr_with_trait"() {attr = 42 : i32} : () -> ()