blob: d6d4c3acaf7e3b4c09def66da6b19525562400eb [file] [log] [blame]
Chia-hung Duan5232c5c2022-04-15 04:33:401// RUN: mlir-opt --mlir-disable-threading -split-input-file -verify-diagnostics %s
2
River Riddle6a99d292022-04-20 23:20:543func.func @verify_operand_type() {
Chia-hung Duan5232c5c2022-04-15 04:33:404 %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 Riddle6a99d292022-04-20 23:20:5414func.func @verify_nested_op_block_trait() {
Chia-hung Duan5232c5c2022-04-15 04:33:4015 %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 Riddle6a99d292022-04-20 23:20:5427func.func @verify_nested_op_operand() {
Chia-hung Duan5232c5c2022-04-15 04:33:4028 %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 Riddle6a99d292022-04-20 23:20:5442func.func @verify_nested_isolated_above() {
Chia-hung Duan5232c5c2022-04-15 04:33:4043 %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}