[llvm] [SLP][modularisation][NFC] Move order/mask helpers to SLPUtils (PR #221663)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 06:46:04 PDT 2026
================
@@ -161,6 +161,28 @@ void inversePermutation(ArrayRef<unsigned> Indices, SmallVectorImpl<int> &Mask);
/// Reorders the list of scalars in accordance with the given \p Mask.
void reorderScalars(SmallVectorImpl<Value *> &Scalars, ArrayRef<int> Mask);
+/// Reorders the given \p Reuses mask according to the given \p Mask. \p Reuses
+/// contains original mask for the scalars reused in the node. Procedure
+/// transform this mask in accordance with the given \p Mask.
+void reorderReuses(SmallVectorImpl<int> &Reuses, ArrayRef<int> Mask);
+
+/// Reorders the given \p Order according to the given \p Mask. \p Order - is
+/// the original order of the scalars. Procedure transforms the provided order
+/// in accordance with the given \p Mask. If the resulting \p Order is just an
+/// identity order, \p Order is cleared.
+void reorderOrder(SmallVectorImpl<unsigned> &Order, ArrayRef<int> Mask,
+ bool BottomOrder = false);
+
+/// Check if \p Order represents reverse order.
+bool isReverseOrder(ArrayRef<unsigned> Order);
+
+/// Checks if the given mask is a "clustered" mask with the same clusters of
+/// size \p Sz, which are not identity submasks.
+bool isRepeatedNonIdentityClusteredMask(ArrayRef<int> Mask, unsigned Sz);
+
----------------
alexey-bataev wrote:
```
/// Fills unset elements of \p Order (marked with the sentinel value equal to
/// the order size) with the corresponding elements of \p SecondaryOrder,
/// skipping already used indices, or with the identity order if
/// \p SecondaryOrder is empty.
```
https://github.com/llvm/llvm-project/pull/221663
More information about the llvm-commits
mailing list