]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Eliminate latter vsetvl when fused
authorBohan Lei <garthlei@linux.alibaba.com>
Thu, 12 Sep 2024 02:28:03 +0000 (10:28 +0800)
committerPan Li <pan2.li@intel.com>
Thu, 12 Sep 2024 06:15:17 +0000 (14:15 +0800)
commit3f212eabbba3edc1827d6da53cf6d5a64c6524f0
tree1673314c9b844b9b5106c14f9beecb56f6596c26
parent5958279509c4601499ac22629512f1723e6744b4
RISC-V: Eliminate latter vsetvl when fused

Hi all,

A simple assembly check has been added in this version. Previous version:
https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662783.html

Thanks,
Bohan

------

The current vsetvl pass eliminates a vsetvl instruction when the previous
info is "available," but does not when "compatible."  This can lead to not
only redundancy, but also incorrect behaviors when the previous info happens
to be compatible with a later vector instruction, which ends of using the
vsetvl info that should have been eliminated, as is shown in the testcase.
This patch eliminates the vsetvl when the previous info is "compatible."

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (pre_vsetvl::fuse_local_vsetvl_info):
Delete vsetvl insn when `prev_info` is compatible

gcc/testsuite/ChangeLog:

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