[llvm] [VPlan] Simplify reverse(reverse(x)) -> x (PR #199057)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 7 23:52:15 PDT 2026


lukel97 wrote:

> 2\. `VPlanTransforms::convertToStridedAccesses`: Based on the cost, it decides whether to convert reverse access patterns into strided accesses with a stride of -1, and clamps the VF of plan.

@Mel-Chen  Ah my understanding was that converting reverse accesses to strides of -1 would be a separate transform from `VPlanTransforms::convertToStridedAccesses` that would run after optimizeMasksToEVL.

But yes I think we can also teach the convertToStridedAccesses to handle reverses too. So your proposed ordering sounds good to me.

So to check, are you happy with the following order of PRs?

1) Add simplifyReverses, after optimizeMasksToEVL #199057
2) Handle EVL reverses as splices in #199510
3) Move simplifyReverses up before convertToStridedAccesses, some future PR

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


More information about the llvm-commits mailing list