[llvm-branch-commits] [llvm] [VPlan] Implement VPlan-based unit-strideness speculation (PR #182595)

Luke Lau via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 20 23:30:53 PDT 2026


================
@@ -7484,6 +7495,224 @@ void VPlanTransforms::makeMemOpWideningDecisions(VPlan &Plan, VFRange &Range,
                            });
 }
 
+void VPlanTransforms::multiversionForUnitStridedMemOps(
+    VPlan &Plan, VPCostContext &CostCtx, VFSelectionContext &Config,
+    VPRecipeBuilder &RecipeBuilder, VFRange &Range,
+    SmallVectorImpl<VPInstruction *> &MemOps) {
+  SmallVector<VPInstruction *> RemainingOps;
+
+  ScalarEvolution *SE = CostCtx.PSE.getSE();
+
+  PredicatedScalarEvolution StrideMVPSE(*SE, const_cast<Loop &>(*CostCtx.L));
+
+  SCEVUnionPredicate StridePredicates({}, *SE);
+
+  // Use `for_each` so that we could do `return Skip();`.
+  for_each(MemOps, [&](VPInstruction *VPI) {
----------------
lukel97 wrote:

Instead of `Skip()` can this just be an `erase_if(MemOps, [&](VPInstruction *VPI)`?

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


More information about the llvm-branch-commits mailing list