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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 22:02:58 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; })) {
----------------
lukel97 wrote:

Nit, can you also use `isSingleSourceMask()` instead of the lambda? Or extend `ShuffleVectorInst::isSingleSource` to take an argument to allow length changing shuffles

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


More information about the llvm-commits mailing list