]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Fix VSETVL PASS regression
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Mon, 27 Nov 2023 13:24:12 +0000 (21:24 +0800)
committerPan Li <pan2.li@intel.com>
Tue, 28 Nov 2023 02:10:55 +0000 (10:10 +0800)
commit9c16ca93641ad460a576a9ed7daf2aadf596193c
tree7d9b7ce61d637c004e7399bc311c31f17151304a
parent5099525bff4f7c36f289537bb15c582a8b51e2b3
RISC-V: Fix VSETVL PASS regression

This patch is regression fix patch, not an optimization patch.
Since trunk GCC generates redundant vsetvl than GCC-13.

This is the case:

bb 2:
  def a2 (vsetvl a2, zero)
bb 3:
  use a2
bb 4:
  use a2 (vle)

before this patch:

bb 2:
vsetvl a2 zero
bb 3:
vsetvl zero, zero ----> should be eliminated.
bb 4:
vle.v

The root cause is we didn't set bb 3 as transparent since the incorrect codes.
bb 3 didn't modify "a2" just use it, the VSETVL status from bb 2 can be available to bb 3 and bb 4:

bb 2 -> bb 3 -> bb4.

Another regression fix is anticipation calculation:

bb 4:
use a5 (sub)
use a5 (vle)

The vle VSETVL status should be considered as anticipated as long as both sub and vle a5 def are coming from same def.

Tested on zvl128b no regression.

I am going to test on zvl256/zvl512/zvl1024

PR target/112713

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (pre_vsetvl::compute_lcm_local_properties): Fix regression.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/pr112713-1.c: New test.
* gcc.target/riscv/rvv/vsetvl/pr112713-2.c: New test.
gcc/config/riscv/riscv-vsetvl.cc
gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr112713-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr112713-2.c [new file with mode: 0644]