[all-commits] [llvm/llvm-project] 0a4551: [VPlan][NFC] Simplify reverse access pattern detec...

Mel Chen via All-commits all-commits at lists.llvm.org
Wed Jun 10 01:57:04 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a45515e9e386233970b56b34a65d7442ac37e5f
      https://github.com/llvm/llvm-project/commit/0a45515e9e386233970b56b34a65d7442ac37e5f
  Author: Mel Chen <mel.chen at sifive.com>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M llvm/lib/Analysis/VectorUtils.cpp
    M llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

  Log Message:
  -----------
  [VPlan][NFC] Simplify reverse access pattern detection in EVL vectorization (#199510)

This PR demonstrates how to decouple the transformation of reverse
accesses during `VPlanTransforms::optimizeEVLMasks` from the reverse
operations of load results or stored values. First, `optimizeEVLMask`
transforms:
```
vptr = vec_end_ptr (ptr, VF)
res = masked.load(vptr, vector.reverse(mask))
-->
vptr = vec_end_ptr (ptr, evl)
load = vp.load(vptr, vp.reverse(mask_w/o_header_mask), evl)
res = splice.left(poison, load, evl)
```
```
vptr = vec_end_ptr (ptr, VF)
masked.store(stored_val, vptr, vector.reverse(mask))
-->
vptr = vec_end_ptr (ptr, evl)
splice = splice.right(store_val, poison, evl)
vp.store(splice, vp.reverse(mask_w/o_header_mask), evl)
```
To maintain cost model consistency, `optimizeEVLMasks` introduces the
following simplification rules to fold splice and vector.reverse to
vp.reverse.
```
vector.reverse(splice.left(poison, v, evl))
-->
vp.reverse(v, true, evl)

splice.right(vector.reverse(v), poison, evl)
-->
vp.reverse(v, true, evl)
```
As a result, the permutations elimination can now take place directly
before the EVL lowering. However, a side effect is that we might
subsequently need to clean up redundant splices after EVL lowering.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list