[RISCV] Add a test showing a miscompilation with subreg liveness
authorFraser Cormack <fraser@codeplay.com>
Wed, 13 Jul 2022 13:21:48 +0000 (14:21 +0100)
committerFraser Cormack <fraser@codeplay.com>
Thu, 14 Jul 2022 09:34:38 +0000 (10:34 +0100)
commit3b334978d565bf39c80b6b81e459bd33d204e2a3
treea2e7f8f40fe1e3a64cca3e8cd9802dc0b4648fb1
parent055b409cea9f0672595e6a17446cb4d770f10bc8
[RISCV] Add a test showing a miscompilation with subreg liveness

This patch adds a test which shows that we may incorrectly register
allocate for RVV instructions which have no-overlap constraints on
source/dest registers of different LMUL groups.

The particular case shows that a vrgatherei16 instruction writes to a
LMUL=1 register group v11 and reads from an EMUL=2 register group
v10/v11. This breaks the overlap constraints of the vrgatherei16
instruction.

The test also shows that disabling subregister liveness fixes the test.

We use `early-clobber` on the `VR` dest and the `VRM2` source to enforce
the constraint but with subregister liveness this constraint is not met.

It's unclear to me at this point whether this is per-design of
early-clobber in conjunction with subregisters (meaning we should find
another way of expressing this constraint) or whether it's a bug in the
register allocator somewhere.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D129639
llvm/test/CodeGen/RISCV/rvv/vrgatherei16-subreg-liveness.ll [new file with mode: 0644]