[llvm] [AArch64][GlobalISel] Combine G_EXTRACT_VECTOR_ELT and G_BUILD_VECTOR sequences into G_SHUFFLE_VECTOR (PR #110545)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 22:50:07 PDT 2024
================
@@ -905,6 +905,16 @@ def extract_vec_elt_build_vec : GICombineRule<
[{ return Helper.matchExtractVecEltBuildVec(*${root}, ${matchinfo}); }]),
(apply [{ Helper.applyExtractVecEltBuildVec(*${root}, ${matchinfo}); }])>;
+def extract_vector_register_to_id_mapping_matchinfo :
+ GIDefMatchData<"SmallVector<std::pair<Register, int>>">;
+def vector_reg_pair_matchinfo :
+ GIDefMatchData<"std::pair<Register, Register>">;
+def extract_vector_element_build_vector_to_shuffle_vector : GICombineRule<
+ (defs root:$root, extract_vector_register_to_id_mapping_matchinfo:$matchinfo, vector_reg_pair_matchinfo:$regpair),
+ (match (wip_match_opcode G_BUILD_VECTOR):$root,
----------------
tschuett wrote:
We are interested in compile-time. The combiner engine is more efficient than the C++ code. That is why we strive for precise patterns. If we jump for every build vector into the C++ code, the success rate of the C++ code will be extremely low. It is waste of compile-time. For precise patterns, we only jump into C++ code when there is good chance to succeed. If the pattern of this combine is build vector and the chance of success of the combine is really low, then we have to try something else.
https://github.com/llvm/llvm-project/pull/110545
More information about the llvm-commits
mailing list