xref: /llvm-project/mlir/test/IR/result.mlir (revision 3472d4d4c311bfed6fc316fb5834bfb50d409421)
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
2
3//===----------------------------------------------------------------------===//
4// Test mixed normal and variadic results
5//===----------------------------------------------------------------------===//
6
7func.func @correct_variadic_result() -> tensor<f32> {
8  // CHECK: mixed_normal_variadic_result
9  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>, tensor<f32>)
10  return %0#4 : tensor<f32>
11}
12
13// -----
14
15func.func @error_in_first_variadic_result() -> tensor<f32> {
16  // expected-error @+1 {{result #1 must be variadic of tensor of any type}}
17  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, f32, tensor<f32>, tensor<f32>, tensor<f32>)
18  return %0#4 : tensor<f32>
19}
20
21// -----
22
23func.func @error_in_normal_result() -> tensor<f32> {
24  // expected-error @+1 {{result #2 must be tensor of any type}}
25  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, f32, tensor<f32>, tensor<f32>)
26  return %0#4 : tensor<f32>
27}
28
29// -----
30
31func.func @error_in_second_variadic_result() -> tensor<f32> {
32  // expected-error @+1 {{result #3 must be variadic of tensor of any type}}
33  %0:5 = "test.mixed_normal_variadic_result"() : () -> (tensor<f32>, tensor<f32>, tensor<f32>, f32, tensor<f32>)
34  return %0#4 : tensor<f32>
35}
36
37