Skip to content

Commit 3472d4d

Browse files
authored
[MLIR][Doc] Prepend "Variadic of" in front of variadic operands (#69285)
Table of Operands for operations like: https://mlir.llvm.org/docs/Dialects/MemRef/#operands-6 Don't distinguish variadic ODS operands from others right now. After this change, it'll print: | Operand | Description | | dynamicSizes | Variadic of index | instead of: | Operand | Description | | dynamicSizes | index |
1 parent e9b9a1d commit 3472d4d

File tree

8 files changed

+12
-11
lines changed

8 files changed

+12
-11
lines changed

flang/test/Fir/invalid.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ func.func @bad_array_modify(%arr1 : !fir.ref<!fir.array<?x?xf32>>, %m : index, %
690690
func.func @slice_must_be_integral() {
691691
%0 = arith.constant 42 : i32
692692
%1 = fir.field_index field, !fir.type<t(param:i32){field:i32}> (%0 : i32)
693-
// expected-error@+1 {{'fir.slice' op operand #0 must be any integer, but got '!fir.field'}}
693+
// expected-error@+1 {{'fir.slice' op operand #0 must be variadic of any integer, but got '!fir.field'}}
694694
%2 = fir.slice %1, %1, %1 : (!fir.field, !fir.field, !fir.field) -> !fir.slice<1>
695695
return
696696
}

flang/test/HLFIR/invalid.fir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,15 @@ func.func @bad_concat(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<!fir.cha
267267
// -----
268268
func.func @bad_concat_2(%arg0: !fir.ref<!fir.array<100x!fir.char<1,10>>>, %arg1: !fir.ref<!fir.array<100x!fir.char<1,20>>>) {
269269
%c30 = arith.constant 30 : index
270-
// expected-error@+1 {{'hlfir.concat' op operand #0 must be any character scalar type, but got '!fir.ref<!fir.array<100x!fir.char<1,10>>>'}}
270+
// expected-error@+1 {{'hlfir.concat' op operand #0 must be variadic of any character scalar type, but got '!fir.ref<!fir.array<100x!fir.char<1,10>>>'}}
271271
%0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.array<100x!fir.char<1,10>>>, !fir.ref<!fir.array<100x!fir.char<1,20>>>, index) -> (!hlfir.expr<100x!fir.char<1,30>>)
272272
return
273273
}
274274

275275
// -----
276276
func.func @bad_concat_3(%arg0: !fir.ref<!fir.char<1,10>>, %arg1: !fir.ref<i32>) {
277277
%c30 = arith.constant 30 : index
278-
// expected-error@+1 {{'hlfir.concat' op operand #1 must be any character scalar type, but got '!fir.ref<i32>'}}
278+
// expected-error@+1 {{'hlfir.concat' op operand #1 must be variadic of any character scalar type, but got '!fir.ref<i32>'}}
279279
%0 = hlfir.concat %arg0, %arg1 len %c30 : (!fir.ref<!fir.char<1,10>>, !fir.ref<i32>, index) -> (!hlfir.expr<!fir.char<1,30>>)
280280
return
281281
}

mlir/include/mlir/IR/CommonTypeConstraints.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ class DialectType<Dialect d, Pred condition, string descr = "",
117117

118118
// A variadic type constraint. It expands to zero or more of the base type. This
119119
// class is used for supporting variadic operands/results.
120-
class Variadic<Type type> : TypeConstraint<type.predicate, type.summary,
120+
class Variadic<Type type> : TypeConstraint<type.predicate,
121+
"variadic of " # type.summary,
121122
type.cppClassName> {
122123
Type baseType = type;
123124
int minSize = 0;

mlir/test/Dialect/Affine/invalid.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
func.func @affine_apply_operand_non_index(%arg0 : i32) {
66
// Custom parser automatically assigns all arguments the `index` so we must
77
// use the generic syntax here to exercise the verifier.
8-
// expected-error@+1 {{op operand #0 must be index, but got 'i32'}}
8+
// expected-error@+1 {{op operand #0 must be variadic of index, but got 'i32'}}
99
%0 = "affine.apply"(%arg0) {map = affine_map<(d0) -> (d0)>} : (i32) -> (index)
1010
return
1111
}

mlir/test/Dialect/LLVMIR/invalid.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ func.func @call_non_llvm() {
306306
// -----
307307

308308
func.func @call_non_llvm_arg(%arg0 : tensor<*xi32>) {
309-
// expected-error@+1 {{'llvm.call' op operand #0 must be LLVM dialect-compatible type}}
309+
// expected-error@+1 {{'llvm.call' op operand #0 must be variadic of LLVM dialect-compatible type}}
310310
"llvm.call"(%arg0) : (tensor<*xi32>) -> ()
311311
llvm.return
312312
}

mlir/test/Dialect/Linalg/invalid.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ func.func @illegal_fill_memref_with_tensor_return
345345
func.func @illegal_fill_tensor_with_memref_return
346346
(%arg0 : tensor<?x?xf32>, %arg1 : f32) -> memref<?x?xf32>
347347
{
348-
// expected-error @+1 {{result #0 must be ranked tensor of any type values, but got 'memref<?x?xf32>'}}
348+
// expected-error @+1 {{result #0 must be variadic of ranked tensor of any type values, but got 'memref<?x?xf32>'}}
349349
%0 = linalg.fill ins(%arg1 : f32) outs(%arg0 : tensor<?x?xf32>) -> memref<?x?xf32>
350350
return %0 : memref<?x?xf32>
351351
}

mlir/test/IR/operand.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func.func @correct_variadic_operand(%arg0: tensor<f32>, %arg1: f32) {
1313
// -----
1414

1515
func.func @error_in_first_variadic_operand(%arg0: tensor<f32>, %arg1: f32) {
16-
// expected-error @+1 {{operand #1 must be tensor of any type}}
16+
// expected-error @+1 {{operand #1 must be variadic of tensor of any type}}
1717
"test.mixed_normal_variadic_operand"(%arg0, %arg1, %arg0, %arg0, %arg0) : (tensor<f32>, f32, tensor<f32>, tensor<f32>, tensor<f32>) -> ()
1818
return
1919
}
@@ -29,7 +29,7 @@ func.func @error_in_normal_operand(%arg0: tensor<f32>, %arg1: f32) {
2929
// -----
3030

3131
func.func @error_in_second_variadic_operand(%arg0: tensor<f32>, %arg1: f32) {
32-
// expected-error @+1 {{operand #3 must be tensor of any type}}
32+
// expected-error @+1 {{operand #3 must be variadic of tensor of any type}}
3333
"test.mixed_normal_variadic_operand"(%arg0, %arg0, %arg0, %arg1, %arg0) : (tensor<f32>, tensor<f32>, tensor<f32>, f32, tensor<f32>) -> ()
3434
return
3535
}

mlir/test/IR/result.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func.func @correct_variadic_result() -> tensor<f32> {
1313
// -----
1414

1515
func.func @error_in_first_variadic_result() -> tensor<f32> {
16-
// expected-error @+1 {{result #1 must be tensor of any type}}
16+
// expected-error @+1 {{result #1 must be variadic of tensor of any type}}
1717
%0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, f32, tensor<f32>, tensor<f32>, tensor<f32>)
1818
return %0#4 : tensor<f32>
1919
}
@@ -29,7 +29,7 @@ func.func @error_in_normal_result() -> tensor<f32> {
2929
// -----
3030

3131
func.func @error_in_second_variadic_result() -> tensor<f32> {
32-
// expected-error @+1 {{result #3 must be tensor of any type}}
32+
// expected-error @+1 {{result #3 must be variadic of tensor of any type}}
3333
%0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, tensor<f32>, f32, tensor<f32>)
3434
return %0#4 : tensor<f32>
3535
}

0 commit comments

Comments
 (0)