[PATCH] D112223: [RISCV] Add a test showing incorrect VSETVLI insertion

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 21 07:57:06 PDT 2021


frasercrmck created this revision.
frasercrmck added reviewers: craig.topper, rogfer01, HsiangKai, evandro, khchen.
Herald added subscribers: achieveartificialintelligence, vkmr, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

This test case, reduced from an internal test failure, shows how we may
incorrectly skip the insertion of VSETVLI instructions when doing
cross-basic-block analysis.

The entry block ends in a `e32,mf2`. Its single successor, %bb.1, ends with a
`e8,mf8`, but for a mask-type instruction, so is considered compatible.
This means that the info %bb.1 is merged into its predecessor so
produces a `e32,mf2`. When it comes to the last block, which requires a
`e32,mf2`, we skip the insertion of a vsetvli because all predecessors
were determined to preserve the right vtype.

However, when %bb.1 is actually laid out it does actually need a
`e8,mf8` vsetvli, since the previous instruction has a different tail
policy. This means that when execution flows from %bb.1 to %bb.3, the
`vadd.vx` is misconfigured.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112223

Files:
  llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112223.381265.patch
Type: text/x-patch
Size: 4676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211021/09a79616/attachment.bin>


More information about the llvm-commits mailing list