RISC-V: Fix ICE for the fusion case from vsetvl to scalar move[PR111927]
commit0c4bd1321a6def5eb44c530e83b01a415633b660
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Mon, 23 Oct 2023 09:40:34 +0000 (23 17:40 +0800)
committerPan Li <pan2.li@intel.com>
Mon, 23 Oct 2023 09:59:42 +0000 (23 17:59 +0800)
treea0ae37d7bbbddeb8cd630abf18efc6a58fdd3f31
parent09c9de06074ced7a4beb148bcf9611a5c5fb0d61
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.
gcc/config/riscv/riscv-vsetvl.cc
gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111927.c [new file with mode: 0644]