Skip to content

Commit 8c3d461

Browse files
committed
Address comments, use ADT/EquivalenceClasses
1 parent b96b577 commit 8c3d461

File tree

4 files changed

+113
-178
lines changed

4 files changed

+113
-178
lines changed

llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def bad_imm_too_many_args : GICombineRule<
151151
(match (COPY $x, (i32 0, 0)):$d),
152152
(apply (COPY $x, $b):$d)>;
153153

154-
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: unknown type 'COPY'
154+
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: cannot parse immediate '(COPY 0)': unknown type 'COPY'
155155
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Failed to parse pattern: '(COPY ?:$x, (COPY 0))
156156
def bad_imm_not_a_valuetype : GICombineRule<
157157
(defs root:$a),
@@ -186,7 +186,7 @@ def expected_op_name : GICombineRule<
186186
(match (G_FNEG $x, i32)),
187187
(apply (COPY $x, (i32 0)))>;
188188

189-
// CHECK: :[[@LINE+3]]:{{[0-9]+}}: error: unknown type 'not_a_type'
189+
// CHECK: :[[@LINE+3]]:{{[0-9]+}}: error: cannot parse operand type: unknown type 'not_a_type'
190190
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: Failed to parse pattern: '(G_FNEG ?:$x, not_a_type:$y)'
191191
def not_a_type;
192192
def bad_mo_type_not_a_valuetype : GICombineRule<

llvm/test/TableGen/GlobalISelCombinerEmitter/type-inference.td

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,30 @@ def MyTargetISA : InstrInfo;
1111
def MyTarget : Target { let InstructionSet = MyTargetISA; }
1212

1313
// CHECK: Rule Operand Type Equivalence Classes for inference_mul_by_neg_one:
14-
// CHECK-NEXT: __inference_mul_by_neg_one_match_0: [dst, x]
15-
// CHECK-NEXT: __inference_mul_by_neg_one_apply_0: [dst, x]
16-
// CHECK-NEXT: (merging [dst, x] | [dst, x])
17-
// CHECK-NEXT: Result: [dst, x]
14+
// CHECK-NEXT: Groups for __inference_mul_by_neg_one_match_0: [dst, x]
15+
// CHECK-NEXT: Groups for __inference_mul_by_neg_one_apply_0: [dst, x]
16+
// CHECK-NEXT: Final Type Equivalence Classes: [dst, x]
1817
// CHECK-NEXT: INFER: imm 0 -> GITypeOf<$x>
1918
// CHECK-NEXT: Apply patterns for rule inference_mul_by_neg_one after inference:
20-
// CHECK-NEXT: (CodeGenInstructionPattern name:__inference_mul_by_neg_one_apply_0 G_SUB operands:[<def>$dst, (GITypeOf<$x> 0), $x])
19+
// CHECK-NEXT: (CodeGenInstructionPattern name:__inference_mul_by_neg_one_apply_0 G_SUB operands:[<def>$dst, (GITypeOf<$x> 0), $x])
2120
def inference_mul_by_neg_one: GICombineRule <
2221
(defs root:$dst),
2322
(match (G_MUL $dst, $x, -1)),
2423
(apply (G_SUB $dst, 0, $x))
2524
>;
2625

2726
// CHECK: Rule Operand Type Equivalence Classes for infer_complex_tempreg:
28-
// CHECK-NEXT: __infer_complex_tempreg_match_0: [dst] [x, y, z]
29-
// CHECK-NEXT: __infer_complex_tempreg_apply_0: [tmp2] [x, y]
30-
// CHECK-NEXT: __infer_complex_tempreg_apply_1: [tmp, tmp2]
31-
// CHECK-NEXT: __infer_complex_tempreg_apply_2: [dst, tmp]
32-
// CHECK-NEXT: (merging [dst] | [dst, tmp])
33-
// CHECK-NEXT: (merging [x, y, z] | [x, y])
34-
// CHECK-NEXT: (merging [tmp2] | [tmp, tmp2])
35-
// CHECK-NEXT: (merging [dst, tmp] | [tmp2, tmp])
36-
// CHECK-NEXT: Result: [dst, tmp, tmp2] [x, y, z]
27+
// CHECK-NEXT: Groups for __infer_complex_tempreg_match_0: [dst] [x, y, z]
28+
// CHECK-NEXT: Groups for __infer_complex_tempreg_apply_0: [tmp2] [x, y]
29+
// CHECK-NEXT: Groups for __infer_complex_tempreg_apply_1: [tmp, tmp2]
30+
// CHECK-NEXT: Groups for __infer_complex_tempreg_apply_2: [dst, tmp]
31+
// CHECK-NEXT: Final Type Equivalence Classes: [dst, tmp, tmp2] [x, y, z]
3732
// CHECK-NEXT: INFER: MachineOperand $tmp2 -> GITypeOf<$dst>
3833
// CHECK-NEXT: INFER: MachineOperand $tmp -> GITypeOf<$dst>
3934
// CHECK-NEXT: Apply patterns for rule infer_complex_tempreg after inference:
40-
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_complex_tempreg_apply_0 G_BUILD_VECTOR operands:[<def>GITypeOf<$dst>:$tmp2, $x, $y])
41-
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_complex_tempreg_apply_1 G_FNEG operands:[<def>GITypeOf<$dst>:$tmp, GITypeOf<$dst>:$tmp2])
42-
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_complex_tempreg_apply_2 G_FNEG operands:[<def>$dst, GITypeOf<$dst>:$tmp])
35+
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_complex_tempreg_apply_0 G_BUILD_VECTOR operands:[<def>GITypeOf<$dst>:$tmp2, $x, $y])
36+
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_complex_tempreg_apply_1 G_FNEG operands:[<def>GITypeOf<$dst>:$tmp, GITypeOf<$dst>:$tmp2])
37+
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_complex_tempreg_apply_2 G_FNEG operands:[<def>$dst, GITypeOf<$dst>:$tmp])
4338
def infer_complex_tempreg: GICombineRule <
4439
(defs root:$dst),
4540
(match (G_MERGE_VALUES $dst, $x, $y, $z)),
@@ -49,17 +44,15 @@ def infer_complex_tempreg: GICombineRule <
4944
>;
5045

5146
// CHECK: Rule Operand Type Equivalence Classes for infer_variadic_outs:
52-
// CHECK-NEXT: __infer_variadic_outs_match_0: [x, y] [vec]
53-
// CHECK-NEXT: __infer_variadic_outs_match_1: [dst, x]
54-
// CHECK-NEXT: __infer_variadic_outs_apply_0: [tmp, y]
55-
// CHECK-NEXT: __infer_variadic_outs_apply_1: (empty)
56-
// CHECK-NEXT: (merging [x, y] | [dst, x])
57-
// CHECK-NEXT: (merging [x, y, dst] | [tmp, y])
58-
// CHECK-NEXT: Result: [x, y, dst, tmp] [vec]
59-
// CHECK-NEXT: INFER: MachineOperand $tmp -> GITypeOf<$x>
47+
// CHECK-NEXT: Groups for __infer_variadic_outs_match_0: [x, y] [vec]
48+
// CHECK-NEXT: Groups for __infer_variadic_outs_match_1: [dst, x]
49+
// CHECK-NEXT: Groups for __infer_variadic_outs_apply_0: [tmp, y]
50+
// CHECK-NEXT: Groups for __infer_variadic_outs_apply_1:
51+
// CHECK-NEXT: Final Type Equivalence Classes: [tmp, dst, x, y] [vec]
52+
// CHECK-NEXT: INFER: MachineOperand $tmp -> GITypeOf<$dst>
6053
// CHECK-NEXT: Apply patterns for rule infer_variadic_outs after inference:
61-
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_variadic_outs_apply_0 G_FNEG operands:[<def>GITypeOf<$x>:$tmp, $y])
62-
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_variadic_outs_apply_1 COPY operands:[<def>$dst, GITypeOf<$x>:$tmp])
54+
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_variadic_outs_apply_0 G_FNEG operands:[<def>GITypeOf<$dst>:$tmp, $y])
55+
// CHECK-NEXT: (CodeGenInstructionPattern name:__infer_variadic_outs_apply_1 COPY operands:[<def>$dst, GITypeOf<$dst>:$tmp])
6356
def infer_variadic_outs: GICombineRule <
6457
(defs root:$dst),
6558
(match (G_UNMERGE_VALUES $x, $y, $vec),

llvm/test/TableGen/GlobalISelCombinerEmitter/typeof-errors.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include "llvm/Target/GlobalISel/Combine.td"
88
def MyTargetISA : InstrInfo;
99
def MyTarget : Target { let InstructionSet = MyTargetISA; }
1010

11-
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: invalid operand name format 'unknown' in GITypeOf: expected '$' followed by an operand name
11+
// CHECK: :[[@LINE+2]]:{{[0-9]+}}: error: cannot parse immediate '(anonymous_7029 0)': invalid operand name format 'unknown' in GITypeOf: expected '$' followed by an operand name
1212
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Failed to parse pattern: '(G_ANYEXT ?:$dst, (anonymous_
1313
def NoDollarSign : GICombineRule<
1414
(defs root:$dst),

0 commit comments

Comments
 (0)