[PATCH] D111248: [SelectionDAG] Widen scalable-vector stores via VP_STORE

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 10:39:48 PDT 2021


frasercrmck created this revision.
frasercrmck added reviewers: RKSimon, craig.topper, spatel.
Herald added subscribers: ecnelises, rogfer01, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, vkmr, MaskRay.
Herald added a project: LLVM.

This patch fixes a compiler crash when widening scalable-vector
stores which end up breaking down to element-wise store operations. It
does so by providing a way for targets with support for
vector-predicated stores to use those instead. By widening the operation
but maintaining the original effective operation length via the EVL,
only the intended vector elements are stored.

This should in theory be possible for fixed-length vector types but I
have observed regressions in the generated code when doing so. I believe
this is simply due to VP_STORE not being up to par with STORE in terms
of optimization. It does improve performance on smaller self-contained
examples, however, so the potential is there.

This approach could be extended to widening non-simple vector loads,
which currently crash for the same reason on the same scalable vector
types.

If the approach is accepted, the crash should be raised out of
GenWidenVectorStores/GenWidenVectorLoads by making them first evaluate
the sequence of stores/loads to generate and bail if the sequence is
illegal. Without alternate legalization strategies like this one there
is less motivation to do this.

While the only target that benefits from this is RISCV, the legalization
is generic and so was placed centrally. A variety of widening load/store
test cases were added for RISCV to catch regressions.

An else-after-return clang-tidy warning was fixed in the same area of
code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111248

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-load-store.ll
  llvm/test/CodeGen/RISCV/rvv/load-store-sdnode.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111248.377606.patch
Type: text/x-patch
Size: 10213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211006/c21e6bfa/attachment.bin>


More information about the llvm-commits mailing list