On 3/7/25 4:05 AM, Robin Dapp wrote:
Hi,

in PR119115 we end up with an orphaned
     vsetvli    zero,t1,e16,m1,ta,ma.
t1 originally came from another vsetvl that was fused from
     vsetvli    a4,a3,e8,mf2,ta,ma
     vsetvli    t1,a3,e8,mf2,ta,ma   (1)
to
     vsetvli    zero,a3,e16,m1,ta,ma.

This patch checks if t1, the VL operand of (1), has AVL uses and does
not delete the vsetvl if so.  While doing so, it also wraps the search
for VL uses into two new functions reg_used and reg_single_use_in_avl.

Regtested on rv64gcv_zvl512b and rv64gcv_zvl256b.  Let's see what the CI says. For my last patch it showed an execution failure that I cannot reproduce locally.

Regards
Robin

     PR target/119115

gcc/ChangeLog:

     * config/riscv/riscv-vsetvl.cc (reg_used): New function.
     (reg_single_use_in_avl): Ditto.
     (pre_vsetvl::fuse_local_vsetvl_info): Use reg_single_use_in_avl
     when checking if vsetvl can be deleted.

gcc/testsuite/ChangeLog:

     * gcc.target/riscv/rvv/base/pr119115.c: New test.
OK.  Sorry about the delay.

jeff

Reply via email to