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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 04:40:34 PDT 2026


================
@@ -1104,6 +1108,32 @@ Value *VPInstruction::generate(VPTransformState &State) {
 
     return Result;
   }
+  case VPInstruction::ExtractVectorForPart: {
+    Value *Src = State.get(getOperand(0));
+    Type *DstTy = VectorType::get(getScalarType(), State.VF);
+    unsigned Part = cast<VPConstantInt>(getOperand(1))->getZExtValue();
+
+    if (Src->getType() == DstTy)
+      return Src;
+
+    // If the VF is scalar & this is an extract of an active lane mask,
+    // generate an ICMP directly.
+    VPValue *Start, *TC;
+    if (State.VF.isScalar() &&
----------------
lukel97 wrote:

Can this optimization be done in VPlan  in `optimizeForVFAndUF`?

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


More information about the llvm-commits mailing list