[PATCH] D123786: [RISCV] Fix lowering of BUILD_VECTORs as VID sequences

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 05:31:03 PDT 2022


frasercrmck created this revision.
Herald added subscribers: sunshaoce, VincentWu, luke957, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

This patch fixes a bug when lowering BUILD_VECTOR via VID sequences.
After adding support for fractional steps in D106533 <https://reviews.llvm.org/D106533>, elements with zero
steps may be skipped if no step has yet been computed. This allowed
certain sequences to slip through the cracks, being identified as VID
sequences when in fact they are not.

The fix for this is to perform a second loop over the BUILD_VECTOR to
validate the entire sequence once the step has been computed. This isn't
the most efficient, but on balance the code is more readable and
maintainable than doing back-validation during the first loop.

Fixes the tests introduced in D123785 <https://reviews.llvm.org/D123785>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123786

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123786.422828.patch
Type: text/x-patch
Size: 4381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220414/24cb963c/attachment.bin>


More information about the llvm-commits mailing list