xref: /llvm-project/mlir/test/IR/test-verification-order.mlir (revision 6a99d29022169ce9175e79983c235c438b76a030)
1// RUN: mlir-opt --mlir-disable-threading -split-input-file -verify-diagnostics %s
2
3func.func @verify_operand_type() {
4  %0 = arith.constant 1 : index
5  // expected-error@+1 {{op operand #0 must be 32-bit signless integer, but got 'index'}}
6  "test.verifiers"(%0) ({
7    %1 = arith.constant 2 : index
8  }) : (index) -> ()
9  return
10}
11
12// -----
13
14func.func @verify_nested_op_block_trait() {
15  %0 = arith.constant 1 : i32
16  // expected-remark@+1 {{success run of verifier}}
17  "test.verifiers"(%0) ({
18    %1 = arith.constant 2 : index
19    // expected-error@+1 {{op requires one region}}
20    "test.verifiers"(%1) : (index) -> ()
21  }) : (i32) -> ()
22  return
23}
24
25// -----
26
27func.func @verify_nested_op_operand() {
28  %0 = arith.constant 1 : i32
29  // expected-remark@+1 {{success run of verifier}}
30  "test.verifiers"(%0) ({
31    %1 = arith.constant 2 : index
32    // expected-error@+1 {{op operand #0 must be 32-bit signless integer, but got 'index'}}
33    "test.verifiers"(%1) ({
34      %2 = arith.constant 3 : index
35    }) : (index) -> ()
36  }) : (i32) -> ()
37  return
38}
39
40// -----
41
42func.func @verify_nested_isolated_above() {
43  %0 = arith.constant 1 : i32
44  // expected-remark@+1 {{success run of verifier}}
45  "test.verifiers"(%0) ({
46    // expected-remark@-1 {{success run of region verifier}}
47    %1 = arith.constant 2 : i32
48    // expected-remark@+1 {{success run of verifier}}
49    "test.verifiers"(%1) ({
50      // expected-remark@-1 {{success run of region verifier}}
51      %2 = arith.constant 3 : index
52    }) : (i32) -> ()
53  }) : (i32) -> ()
54  return
55}
56