[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.
This commit is contained in:
@@ -211,6 +211,7 @@ def constantfp_matchinfo : GIDefMatchData<"ConstantFP*">;
|
||||
def build_fn_matchinfo :
|
||||
GIDefMatchData<"std::function<void(MachineIRBuilder &)>">;
|
||||
def unsigned_matchinfo: GIDefMatchData<"unsigned">;
|
||||
def register_vector_matchinfo : GIDefMatchData<"SmallVector<Register>">;
|
||||
|
||||
def copy_prop : GICombineRule<
|
||||
(defs root:$d),
|
||||
@@ -811,9 +812,8 @@ def zext_trunc_fold: GICombineRule <
|
||||
(apply [{ Helper.replaceSingleDefInstWithReg(*${root}, ${matchinfo}); }])
|
||||
>;
|
||||
|
||||
def not_cmp_fold_matchinfo : GIDefMatchData<"SmallVector<Register, 4>">;
|
||||
def not_cmp_fold : GICombineRule<
|
||||
(defs root:$d, not_cmp_fold_matchinfo:$info),
|
||||
(defs root:$d, register_vector_matchinfo:$info),
|
||||
(match (wip_match_opcode G_XOR): $d,
|
||||
[{ return Helper.matchNotCmp(*${d}, ${info}); }]),
|
||||
(apply [{ Helper.applyNotCmp(*${d}, ${info}); }])
|
||||
@@ -828,9 +828,8 @@ def fneg_fneg_fold: GICombineRule <
|
||||
>;
|
||||
|
||||
// Fold (unmerge(merge x, y, z)) -> z, y, z.
|
||||
def unmerge_merge_matchinfo : GIDefMatchData<"SmallVector<Register, 8>">;
|
||||
def unmerge_merge : GICombineRule<
|
||||
(defs root:$d, unmerge_merge_matchinfo:$info),
|
||||
(defs root:$d, register_vector_matchinfo:$info),
|
||||
(match (wip_match_opcode G_UNMERGE_VALUES): $d,
|
||||
[{ return Helper.matchCombineUnmergeMergeToPlainValues(*${d}, ${info}); }]),
|
||||
(apply [{ Helper.applyCombineUnmergeMergeToPlainValues(*${d}, ${info}); }])
|
||||
@@ -955,9 +954,8 @@ def ptr_add_with_zero: GICombineRule<
|
||||
[{ return Helper.matchPtrAddZero(*${root}); }]),
|
||||
(apply [{ Helper.applyPtrAddZero(*${root}); }])>;
|
||||
|
||||
def regs_small_vec : GIDefMatchData<"SmallVector<Register, 4>">;
|
||||
def combine_insert_vec_elts_build_vector : GICombineRule<
|
||||
(defs root:$root, regs_small_vec:$info),
|
||||
(defs root:$root, register_vector_matchinfo:$info),
|
||||
(match (wip_match_opcode G_INSERT_VECTOR_ELT):$root,
|
||||
[{ return Helper.matchCombineInsertVecElts(*${root}, ${info}); }]),
|
||||
(apply [{ Helper.applyCombineInsertVecElts(*${root}, ${info}); }])>;
|
||||
@@ -1553,9 +1551,8 @@ def nneg_zext : GICombineRule<
|
||||
(apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
|
||||
|
||||
// Combines concat operations
|
||||
def concat_matchinfo : GIDefMatchData<"SmallVector<Register>">;
|
||||
def combine_concat_vector : GICombineRule<
|
||||
(defs root:$root, concat_matchinfo:$matchinfo),
|
||||
(defs root:$root, register_vector_matchinfo:$matchinfo),
|
||||
(match (wip_match_opcode G_CONCAT_VECTORS):$root,
|
||||
[{ return Helper.matchCombineConcatVectors(*${root}, ${matchinfo}); }]),
|
||||
(apply [{ Helper.applyCombineConcatVectors(*${root}, ${matchinfo}); }])>;
|
||||
@@ -1567,7 +1564,7 @@ def combine_concat_vector : GICombineRule<
|
||||
// ===>
|
||||
// c = G_CONCAT_VECTORS x, y, z, undef
|
||||
def combine_shuffle_concat : GICombineRule<
|
||||
(defs root:$root, concat_matchinfo:$matchinfo),
|
||||
(defs root:$root, register_vector_matchinfo:$matchinfo),
|
||||
(match (wip_match_opcode G_SHUFFLE_VECTOR):$root,
|
||||
[{ return Helper.matchCombineShuffleConcat(*${root}, ${matchinfo}); }]),
|
||||
(apply [{ Helper.applyCombineShuffleConcat(*${root}, ${matchinfo}); }])>;
|
||||
|
||||
Reference in New Issue
Block a user