[llvm] [IA] Recognize repeated masks which come from shuffle vectors (PR #150285)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 24 07:31:17 PDT 2025


================
@@ -587,6 +587,19 @@ static Value *getMask(Value *WideMask, unsigned Factor,
     }
   }
 
+  if (auto *SVI = dyn_cast<ShuffleVectorInst>(WideMask)) {
+    unsigned LeafMaskLen = LeafValueEC.getFixedValue();
+    if (SVI->isInterleave(Factor) &&
+        llvm::all_of(SVI->getShuffleMask(),
+                     [&](int Idx) { return Idx < (int)LeafMaskLen; })) {
----------------
preames wrote:

We can't, at least without significant rework of the API.  This isn't checking that the shuffle is single source, it's checking that all elements only come from the first 1/Nth of the elements.  For e.g. nf5, it will be 1/5th of the elements.  Remember this will be working on the root of a concat tree.

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


More information about the llvm-commits mailing list