[llvm] Add SD matchers and unit test coverage for ISD::VECTOR_SHUFFLE (PR #119592)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 14 16:00:54 PST 2024


================
@@ -790,6 +818,17 @@ inline BinaryOpc_match<LHS, RHS> m_FRem(const LHS &L, const RHS &R) {
   return BinaryOpc_match<LHS, RHS>(ISD::FREM, L, R);
 }
 
+template <typename LHS, typename RHS>
+inline BinaryOpc_match<LHS, RHS> m_Shuffle(const LHS &v1, const RHS &v2) {
+  return BinaryOpc_match<LHS, RHS>(ISD::VECTOR_SHUFFLE, v1, v2);
+}
+
+template <typename V1_t, typename V2_t>
+inline SDShuffle_match<V1_t, V2_t> m_Shuffle(const V1_t &v1, const V2_t &v2,
+                                             const ArrayRef<int> mask) {
----------------
mshockwave wrote:

> this will improve readability

Not really. Because you cannot mutate the underlying object through ArrayRef anyway. Since ArrayRef is passed by value. writing `void foo(const ArrayRef)` is like writing `void foo(const int)`, which is not the norm (at lease not in our codebase).

https://github.com/llvm/llvm-project/pull/119592


More information about the llvm-commits mailing list