https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111927
--- Comment #3 from CVS 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:0c4bd1321a6def5eb44c530e83b01a415633b660 commit r14-4856-g0c4bd1321a6def5eb44c530e83b01a415633b660 Author: Juzhe-Zhong <juzhe.zh...@rivai.ai> Date: Mon Oct 23 17:40:34 2023 +0800 RISC-V: Fix ICE for the fusion case from vsetvl to scalar move[PR111927] ICE: during RTL pass: vsetvl <source>: In function 'riscv_lms_f32': <source>:240:1: internal compiler error: in merge, at config/riscv/riscv-vsetvl.cc:1997 240 | } In general compatible_p (avl_equal_p) has: if (next.has_vl () && next.vl_used_by_non_rvv_insn_p ()) return false; Don't fuse AVL of vsetvl if the VL operand is used by non-RVV instructions. It is reasonable to add it into 'can_use_next_avl_p' since we don't want to fuse AVL of vsetvl into a scalar move instruction which doesn't demand AVL. And after the fusion, we will alway use compatible_p to check whether the demand is correct or not. PR target/111927 gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc: Fix bug. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/vsetvl/pr111927.c: New test.