https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120297
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Robin Dapp <rd...@gcc.gnu.org>: https://gcc.gnu.org/g:9041f2bff8202d9b87d8c27f21e4ffa8d50b36a3 commit r16-2285-g9041f2bff8202d9b87d8c27f21e4ffa8d50b36a3 Author: Robin Dapp <rd...@ventanamicro.com> Date: Mon Jul 14 13:53:12 2025 +0200 RISC-V: Fix vsetvl merge rule. In PR120297 we fuse vsetvl e8,mf2,... vsetvl e64,m1,... into vsetvl e64,m4,... Individually, that's ok but we also change the new vsetvl's demand to "SEW only" even though the first original one demanded SEW >= 8 and ratio = 16. As we forget the ratio after the merge we find that the vsetvl following the merged one has ratio = 64 demand and we fuse into vsetvl e64,m1,.. which obviously doesn't have ratio = 16 any more. Regtested on rv64gcv_zvl512b. PR target/120297 gcc/ChangeLog: * config/riscv/riscv-vsetvl.def: Do not forget ratio demand of previous vsetvl. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/pr120297.c: New test.