https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112713
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Pan Li <pa...@gcc.gnu.org>: https://gcc.gnu.org/g:9c16ca93641ad460a576a9ed7daf2aadf596193c commit r14-5897-g9c16ca93641ad460a576a9ed7daf2aadf596193c Author: Juzhe-Zhong <juzhe.zh...@rivai.ai> Date: Mon Nov 27 21:24:12 2023 +0800 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.