https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112929
--- Comment #21 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:ef21ae5c45f3b79a36fadc1cb5723c095e2965ad commit r14-6490-gef21ae5c45f3b79a36fadc1cb5723c095e2965ad Author: Juzhe-Zhong <juzhe.zh...@rivai.ai> Date: Wed Dec 13 13:48:11 2023 +0800 RISC-V: Postpone full available optimization [VSETVL PASS] Fix VSETVL BUG that AVL is polluted .L15: li a3,9 lui a4,%hi(s) sw a3,%lo(j)(t2) sh a5,%lo(s)(a4) <--a4 is hold the address of s beq t0,zero,.L42 sw t5,8(t4) vsetvli zero,a4,e8,m8,ta,ma <<--- a4 as avl Actually, this vsetvl is redundant. The root cause we include full available optimization in LCM local data computation. full available optimization should be after LCM computation. PR target/112929 PR target/112988 gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pre_vsetvl::compute_lcm_local_properties): Remove full available. (pre_vsetvl::pre_global_vsetvl_info): Add full available optimization. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/pr112929.c: New test. * gcc.target/riscv/rvv/vsetvl/pr112988.c: New test.