xref: /llvm-project/mlir/test/Dialect/UB/ops.mlir (revision 9dec3fd812429663497e4eb07c3ee7995a2be759)
1// RUN: mlir-opt %s | FileCheck %s
2// Verify the printed output can be parsed.
3// RUN: mlir-opt %s | mlir-opt | FileCheck %s
4// Verify the generic form can be parsed.
5// RUN: mlir-opt -mlir-print-op-generic %s | mlir-opt | FileCheck %s
6
7// CHECK-LABEL: func @poison()
8//       CHECK:   %{{.*}} = ub.poison : i32
9func.func @poison() -> i32 {
10  %0 = ub.poison : i32
11  return %0 : i32
12}
13
14// CHECK-LABEL: func @poison_full_form()
15//       CHECK:   %{{.*}} = ub.poison : i32
16func.func @poison_full_form() -> i32 {
17  %0 = ub.poison <#ub.poison> : i32
18  return %0 : i32
19}
20
21// CHECK-LABEL: func @poison_complex()
22//       CHECK:   %{{.*}} = ub.poison : complex<f32>
23func.func @poison_complex() -> complex<f32> {
24  %0 = ub.poison : complex<f32>
25  return %0 : complex<f32>
26}
27
28// CHECK-LABEL: func @poison_vec()
29//       CHECK:   %{{.*}} = ub.poison : vector<4xi64>
30func.func @poison_vec() -> vector<4xi64> {
31  %0 = ub.poison : vector<4xi64>
32  return %0 : vector<4xi64>
33}
34
35// CHECK-LABEL: func @poison_tensor()
36//       CHECK:   %{{.*}} = ub.poison : tensor<8x?xf64>
37func.func @poison_tensor() -> tensor<8x?xf64> {
38  %0 = ub.poison : tensor<8x?xf64>
39  return %0 : tensor<8x?xf64>
40}
41