aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/IR/test-verification-order.mlir
blob: d6d4c3acaf7e3b4c09def66da6b19525562400eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// RUN: mlir-opt --mlir-disable-threading -split-input-file -verify-diagnostics %s

func.func @verify_operand_type() {
  %0 = arith.constant 1 : index
  // expected-error@+1 {{op operand #0 must be 32-bit signless integer, but got 'index'}}
  "test.verifiers"(%0) ({
    %1 = arith.constant 2 : index
  }) : (index) -> ()
  return
}

// -----

func.func @verify_nested_op_block_trait() {
  %0 = arith.constant 1 : i32
  // expected-remark@+1 {{success run of verifier}}
  "test.verifiers"(%0) ({
    %1 = arith.constant 2 : index
    // expected-error@+1 {{op requires one region}}
    "test.verifiers"(%1) : (index) -> ()
  }) : (i32) -> ()
  return
}

// -----

func.func @verify_nested_op_operand() {
  %0 = arith.constant 1 : i32
  // expected-remark@+1 {{success run of verifier}}
  "test.verifiers"(%0) ({
    %1 = arith.constant 2 : index
    // expected-error@+1 {{op operand #0 must be 32-bit signless integer, but got 'index'}}
    "test.verifiers"(%1) ({
      %2 = arith.constant 3 : index
    }) : (index) -> ()
  }) : (i32) -> ()
  return
}

// -----

func.func @verify_nested_isolated_above() {
  %0 = arith.constant 1 : i32
  // expected-remark@+1 {{success run of verifier}}
  "test.verifiers"(%0) ({
    // expected-remark@-1 {{success run of region verifier}}
    %1 = arith.constant 2 : i32
    // expected-remark@+1 {{success run of verifier}}
    "test.verifiers"(%1) ({
      // expected-remark@-1 {{success run of region verifier}}
      %2 = arith.constant 3 : index
    }) : (i32) -> ()
  }) : (i32) -> ()
  return
}