Skip to content

Commit b6445ac

Browse files
authored
[GlobalISel] Create a common register_vector_matchinfo (#144306)
Several combiner use MatchInfo that are just SmallVector<Register>. This creates a common register_vector_matchinfo that they can all use.
1 parent 58f4801 commit b6445ac

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/include/llvm/Target/GlobalISel/Combine.td

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def constantfp_matchinfo : GIDefMatchData<"ConstantFP*">;
211211
def build_fn_matchinfo :
212212
GIDefMatchData<"std::function<void(MachineIRBuilder &)>">;
213213
def unsigned_matchinfo: GIDefMatchData<"unsigned">;
214+
def register_vector_matchinfo : GIDefMatchData<"SmallVector<Register>">;
214215

215216
def copy_prop : GICombineRule<
216217
(defs root:$d),
@@ -811,9 +812,8 @@ def zext_trunc_fold: GICombineRule <
811812
(apply [{ Helper.replaceSingleDefInstWithReg(*${root}, ${matchinfo}); }])
812813
>;
813814

814-
def not_cmp_fold_matchinfo : GIDefMatchData<"SmallVector<Register, 4>">;
815815
def not_cmp_fold : GICombineRule<
816-
(defs root:$d, not_cmp_fold_matchinfo:$info),
816+
(defs root:$d, register_vector_matchinfo:$info),
817817
(match (wip_match_opcode G_XOR): $d,
818818
[{ return Helper.matchNotCmp(*${d}, ${info}); }]),
819819
(apply [{ Helper.applyNotCmp(*${d}, ${info}); }])
@@ -828,9 +828,8 @@ def fneg_fneg_fold: GICombineRule <
828828
>;
829829

830830
// Fold (unmerge(merge x, y, z)) -> z, y, z.
831-
def unmerge_merge_matchinfo : GIDefMatchData<"SmallVector<Register, 8>">;
832831
def unmerge_merge : GICombineRule<
833-
(defs root:$d, unmerge_merge_matchinfo:$info),
832+
(defs root:$d, register_vector_matchinfo:$info),
834833
(match (wip_match_opcode G_UNMERGE_VALUES): $d,
835834
[{ return Helper.matchCombineUnmergeMergeToPlainValues(*${d}, ${info}); }]),
836835
(apply [{ Helper.applyCombineUnmergeMergeToPlainValues(*${d}, ${info}); }])
@@ -955,9 +954,8 @@ def ptr_add_with_zero: GICombineRule<
955954
[{ return Helper.matchPtrAddZero(*${root}); }]),
956955
(apply [{ Helper.applyPtrAddZero(*${root}); }])>;
957956

958-
def regs_small_vec : GIDefMatchData<"SmallVector<Register, 4>">;
959957
def combine_insert_vec_elts_build_vector : GICombineRule<
960-
(defs root:$root, regs_small_vec:$info),
958+
(defs root:$root, register_vector_matchinfo:$info),
961959
(match (wip_match_opcode G_INSERT_VECTOR_ELT):$root,
962960
[{ return Helper.matchCombineInsertVecElts(*${root}, ${info}); }]),
963961
(apply [{ Helper.applyCombineInsertVecElts(*${root}, ${info}); }])>;
@@ -1553,9 +1551,8 @@ def nneg_zext : GICombineRule<
15531551
(apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
15541552

15551553
// Combines concat operations
1556-
def concat_matchinfo : GIDefMatchData<"SmallVector<Register>">;
15571554
def combine_concat_vector : GICombineRule<
1558-
(defs root:$root, concat_matchinfo:$matchinfo),
1555+
(defs root:$root, register_vector_matchinfo:$matchinfo),
15591556
(match (wip_match_opcode G_CONCAT_VECTORS):$root,
15601557
[{ return Helper.matchCombineConcatVectors(*${root}, ${matchinfo}); }]),
15611558
(apply [{ Helper.applyCombineConcatVectors(*${root}, ${matchinfo}); }])>;
@@ -1567,7 +1564,7 @@ def combine_concat_vector : GICombineRule<
15671564
// ===>
15681565
// c = G_CONCAT_VECTORS x, y, z, undef
15691566
def combine_shuffle_concat : GICombineRule<
1570-
(defs root:$root, concat_matchinfo:$matchinfo),
1567+
(defs root:$root, register_vector_matchinfo:$matchinfo),
15711568
(match (wip_match_opcode G_SHUFFLE_VECTOR):$root,
15721569
[{ return Helper.matchCombineShuffleConcat(*${root}, ${matchinfo}); }]),
15731570
(apply [{ Helper.applyCombineShuffleConcat(*${root}, ${matchinfo}); }])>;

0 commit comments

Comments
 (0)