Chia-hung Duan | 5232c5c | 2022-04-15 04:33:40 | [diff] [blame] | 1 | // RUN: mlir-opt --mlir-disable-threading -split-input-file -verify-diagnostics %s |
| 2 | |
River Riddle | 6a99d29 | 2022-04-20 23:20:54 | [diff] [blame] | 3 | func.func @verify_operand_type() { |
Chia-hung Duan | 5232c5c | 2022-04-15 04:33:40 | [diff] [blame] | 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 | |
River Riddle | 6a99d29 | 2022-04-20 23:20:54 | [diff] [blame] | 14 | func.func @verify_nested_op_block_trait() { |
Chia-hung Duan | 5232c5c | 2022-04-15 04:33:40 | [diff] [blame] | 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 | |
River Riddle | 6a99d29 | 2022-04-20 23:20:54 | [diff] [blame] | 27 | func.func @verify_nested_op_operand() { |
Chia-hung Duan | 5232c5c | 2022-04-15 04:33:40 | [diff] [blame] | 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 | |
River Riddle | 6a99d29 | 2022-04-20 23:20:54 | [diff] [blame] | 42 | func.func @verify_nested_isolated_above() { |
Chia-hung Duan | 5232c5c | 2022-04-15 04:33:40 | [diff] [blame] | 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 | } |