llvm-project/mlir/test/IR/result.mlir
Mehdi Amini 3472d4d4c3
[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       |
2023-10-17 13:50:01 -07:00

37 lines
1.4 KiB
MLIR

// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
//===----------------------------------------------------------------------===//
// Test mixed normal and variadic results
//===----------------------------------------------------------------------===//
func.func @correct_variadic_result() -> tensor<f32> {
// CHECK: mixed_normal_variadic_result
%0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>)
return %0#4 : tensor<f32>
}
// -----
func.func @error_in_first_variadic_result() -> tensor<f32> {
// expected-error @+1 {{result #1 must be variadic of tensor of any type}}
%0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, f32, tensor<f32>, tensor<f32>, tensor<f32>)
return %0#4 : tensor<f32>
}
// -----
func.func @error_in_normal_result() -> tensor<f32> {
// expected-error @+1 {{result #2 must be tensor of any type}}
%0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, f32, tensor<f32>, tensor<f32>)
return %0#4 : tensor<f32>
}
// -----
func.func @error_in_second_variadic_result() -> tensor<f32> {
// expected-error @+1 {{result #3 must be variadic of tensor of any type}}
%0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, tensor<f32>, f32, tensor<f32>)
return %0#4 : tensor<f32>
}