[llvm] [LV] Use wide lane masks as the canonical form when tail-folding & interleaving (PR #209484)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 07:11:07 PDT 2026


================
@@ -1104,6 +1105,33 @@ Value *VPInstruction::generate(VPTransformState &State) {
 
     return Result;
   }
+  case VPInstruction::ExtractSubvectorForPart: {
+    Type *DstTy = VectorType::get(getScalarType(), State.VF);
+    unsigned Part = cast<VPConstantInt>(getOperand(1))->getZExtValue();
+
+    // Return Src if it's an ActiveLaneMask with a multiplier of 1.
+    Value *Src = State.get(getOperand(0));
+    if (Part == 0 && match(getOperand(0),
+                           m_ActiveLaneMask(m_VPValue(), m_VPValue(), m_One())))
+      return Src;
----------------
MacDue wrote:

I think this can be generalized/simplified to: 
```suggestion
   if (Srcec->getType() == DstTy)
      return Vec;
```

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


More information about the llvm-commits mailing list