[llvm] [LV] Add initial support for partial alias masking (PR #177599)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 23:53:22 PST 2026


================
@@ -4802,11 +4802,20 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
 }
 
 void VPlanTransforms::materializeVFAndVFxUF(VPlan &Plan, VPBasicBlock *VectorPH,
-                                            ElementCount VFEC) {
+                                            ElementCount VFEC,
+                                            VPValue *ClampedVF) {
   VPBuilder Builder(VectorPH, VectorPH->begin());
   Type *TCTy = VPTypeAnalysis(Plan).inferScalarType(Plan.getTripCount());
   VPValue &VF = Plan.getVF();
   VPValue &VFxUF = Plan.getVFxUF();
+
+  if (ClampedVF) {
+    assert(Plan.getUF() == 1 && "Clamped VF not support with interleaving");
+    VF.replaceAllUsesWith(ClampedVF);
+    VFxUF.replaceAllUsesWith(ClampedVF);
+    return;
+  }
----------------
lukel97 wrote:

I think there's some similarities with EVL tail folding on RISC-V where we need to change the amount that the loop steps by. I think it should be possible to just replace the "VF" operand of the induction recipes etc. so it can be done as an individual transformation, instead of having to change `materializeVFAndVFxUF`, i.e. see fixupVFUsersForEVL. 

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


More information about the llvm-commits mailing list