[PATCH] D119516: [RISCV] Add test case for a vsetvli insertion bug found after D118667.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 21:46:17 PST 2022


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

We're missing a vsetvli before a vse after a redsum in this test.

This appears to be because the vmv.s.x has a VL of 1, but did not
trigger a vsetvli because it is a scalar move op and any non-zero
VL would work. So it looked at it the predecessors and decided it was
that they all had a non-zero vl. Then the redsum was visited, it
also took the VL from the predecessors since the vmv.s.x and the 4
was found compatible.

Finally we visit the vse and it looks at the BBLocalInfo and sees
that is compatible because it contains a VL of 1 from the vmv.s.x,
the first instruction in the block. BBLocalInfo was not updated
when the vredsum was visited because BBLocalInfo was valid and no
vsetvli was generated.

I think fundamentally the vmv.s.x optimization has the same first
phase and third phase not matching problem that D118667 <https://reviews.llvm.org/D118667> was trying
to fix for stores.

This bug exists in the LLVM 14 release and I'm not sure what the
best fix for that is.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119516

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119516.407765.patch
Type: text/x-patch
Size: 5980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220211/ab0f94a2/attachment.bin>


More information about the llvm-commits mailing list