1// RUN: mlir-opt %s -split-input-file --test-operations-equality | FileCheck %s
2
3
4// CHECK-LABEL: test.top_level_op
5// CHECK-SAME: compares equals
6
7"test.top_level_op"() : () -> ()
8"test.top_level_op"() : () -> ()
9
10// -----
11
12// CHECK-LABEL: test.top_level_op_strict_loc
13// CHECK-SAME: compares NOT equals
14
15"test.top_level_op_strict_loc"() { strict_loc_check } : () -> ()
16"test.top_level_op_strict_loc"() { strict_loc_check } : () -> ()
17
18// -----
19
20// CHECK-LABEL: test.top_level_op_loc_match
21// CHECK-SAME: compares equals
22
23"test.top_level_op_loc_match"() { strict_loc_check } : () -> () loc("foo")
24"test.top_level_op_loc_match"() { strict_loc_check } : () -> () loc("foo")
25
26// -----
27
28// CHECK-LABEL: test.top_level_op_block_loc_mismatch
29// CHECK-SAME: compares NOT equals
30
31"test.top_level_op_block_loc_mismatch"() ({
32 ^bb0(%a : i32):
33}) { strict_loc_check } : () -> () loc("foo")
34"test.top_level_op_block_loc_mismatch"() ({
35 ^bb0(%a : i32):
36}) { strict_loc_check } : () -> () loc("foo")
37
38// -----
39
40// CHECK-LABEL: test.top_level_op_block_loc_match
41// CHECK-SAME: compares equals
42
43"test.top_level_op_block_loc_match"() ({
44 ^bb0(%a : i32 loc("bar")):
45}) { strict_loc_check } : () -> () loc("foo")
46"test.top_level_op_block_loc_match"() ({
47 ^bb0(%a : i32 loc("bar")):
48}) { strict_loc_check } : () -> () loc("foo")
49
50// -----
51
52// CHECK-LABEL: test.top_level_name_mismatch
53// CHECK-SAME: compares NOT equals
54
55"test.top_level_name_mismatch"() : () -> ()
56"test.top_level_name_mismatch2"() : () -> ()
57
58// -----
59
60// CHECK-LABEL: test.top_level_op_attr_mismatch
61// CHECK-SAME: compares NOT equals
62
63"test.top_level_op_attr_mismatch"() { foo = "bar" } : () -> ()
64"test.top_level_op_attr_mismatch"() { foo = "bar2"} : () -> ()
65
66// -----
67
68// CHECK-LABEL: test.top_level_op_cfg
69// CHECK-SAME: compares equals
70
71"test.top_level_op_cfg"() ({
72  ^bb0(%arg0 : i32, %arg1 : f32):
73    "test.some_branching_op"(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> ()
74  ^bb1(%arg2 : f32):
75    "test.some_branching_op"() : () -> ()
76  ^bb2(%arg3 : i32):
77    "test.some_branching_op"() : () -> ()
78  }, {
79  ^bb0(%arg0 : i32, %arg1 : f32):
80    "test.some_branching_op"(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> ()
81  ^bb1(%arg2 : f32):
82    "test.some_branching_op"() : () -> ()
83  ^bb2(%arg3 : i32):
84    "test.some_branching_op"() : () -> ()
85  })
86   { attr = "foo" } : () -> ()
87"test.top_level_op_cfg"() ({
88  ^bb0(%arg0 : i32, %arg1 : f32):
89    "test.some_branching_op"(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> ()
90  ^bb1(%arg2 : f32):
91    "test.some_branching_op"() : () -> ()
92  ^bb2(%arg3 : i32):
93    "test.some_branching_op"() : () -> ()
94  }, {
95  ^bb0(%arg0 : i32, %arg1 : f32):
96    "test.some_branching_op"(%arg1, %arg0) [^bb1, ^bb2] : (f32, i32) -> ()
97  ^bb1(%arg2 : f32):
98    "test.some_branching_op"() : () -> ()
99  ^bb2(%arg3 : i32):
100    "test.some_branching_op"() : () -> ()
101  })
102   { attr = "foo" } : () -> ()
103
104// -----
105
106// CHECK-LABEL: test.operand_num_mismatch
107// CHECK-SAME: compares NOT equals
108
109"test.operand_num_mismatch"() ({
110  ^bb0(%arg0 : i32, %arg1 : f32):
111    "test.some_branching_op"(%arg1, %arg0) : (f32, i32) -> ()
112  }) : () -> ()
113"test.operand_num_mismatch"() ({
114  ^bb0(%arg0 : i32, %arg1 : f32):
115    "test.some_branching_op"(%arg1) : (f32) -> ()
116  }) : () -> ()
117
118// -----
119
120// CHECK-LABEL: test.operand_type_mismatch
121// CHECK-SAME: compares NOT equals
122
123"test.operand_type_mismatch"() ({
124  ^bb0(%arg0 : i32, %arg1 : f32):
125    "test.some_branching_op"(%arg1, %arg0) : (f32, i32) -> ()
126  }) : () -> ()
127"test.operand_type_mismatch"() ({
128  ^bb0(%arg0 : i32, %arg1 : f32):
129    "test.some_branching_op"(%arg1, %arg1) : (f32, f32) -> ()
130  }) : () -> ()
131
132// -----
133
134// CHECK-LABEL: test.block_type_mismatch
135// CHECK-SAME: compares NOT equals
136
137"test.block_type_mismatch"() ({
138  ^bb0(%arg0 : f32, %arg1 : f32):
139    "test.some_branching_op"() : () -> ()
140  }) : () -> ()
141"test.block_type_mismatch"() ({
142  ^bb0(%arg0 : i32, %arg1 : f32):
143    "test.some_branching_op"() : () -> ()
144  }) : () -> ()
145
146// -----
147
148// CHECK-LABEL: test.block_arg_num_mismatch
149// CHECK-SAME: compares NOT equals
150
151"test.block_arg_num_mismatch"() ({
152  ^bb0(%arg0 : f32, %arg1 : f32):
153    "test.some_branching_op"() : () -> ()
154  }) : () -> ()
155"test.block_arg_num_mismatch"() ({
156  ^bb0(%arg0 : f32):
157    "test.some_branching_op"() : () -> ()
158  }) : () -> ()
159
160// -----
161
162// CHECK-LABEL: test.dataflow_match
163// CHECK-SAME: compares equals
164
165"test.dataflow_match"() ({
166  %0:2 = "test.producer"() : () -> (i32, i32)
167  "test.consumer"(%0#0, %0#1) : (i32, i32) -> ()
168  }) : () -> ()
169"test.dataflow_match"() ({
170  %0:2 = "test.producer"() : () -> (i32, i32)
171  "test.consumer"(%0#0, %0#1) : (i32, i32) -> ()
172  }) : () -> ()
173
174// -----
175
176// CHECK-LABEL: test.dataflow_mismatch
177// CHECK-SAME: compares NOT equals
178
179"test.dataflow_mismatch"() ({
180  %0:2 = "test.producer"() : () -> (i32, i32)
181  "test.consumer"(%0#0, %0#1) : (i32, i32) -> ()
182  }) : () -> ()
183"test.dataflow_mismatch"() ({
184  %0:2 = "test.producer"() : () -> (i32, i32)
185  "test.consumer"(%0#1, %0#0) : (i32, i32) -> ()
186  }) : () -> ()
187