[llvm] [LV] Run replaceSymbolicStrides as a VPlan optimization (NFC) (PR #194067)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 02:03:04 PDT 2026


artagnon wrote:

> Why? Would we now run it on multiple VPlan copies instead of just running once when creating VPlan0?

Ah, we run the optimization exactly the same number of times:

```cpp
  for (ElementCount VF = MinVF; ElementCount::isKnownLT(VF, MaxVFTimes2);) {
    VFRange SubRange = {VF, MaxVFTimes2};
    auto Plan = tryToBuildVPlanWithVPRecipes(
        std::unique_ptr<VPlan>(VPlan0->duplicate()), SubRange);
    VF = SubRange.End;

    if (!Plan)
      continue;
```

The difference is that replaceSymStrides is an optimization that's not required for a "legal" VPlan0 -- optimizations should be present in this loop (and indeed optimize is also present here), while tryToBuildVPlanWithVPRecipes focuses on building a "legal" VPlan that we can then optimize and cost.

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


More information about the llvm-commits mailing list