]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: avlprop: Do not propagate VL from slidedown.
authorRobin Dapp <rdapp@ventanamicro.com>
Mon, 25 Nov 2024 11:40:53 +0000 (12:40 +0100)
committerRobin Dapp <rdapp@ventanamicro.com>
Tue, 26 Nov 2024 08:51:54 +0000 (09:51 +0100)
In the following situation (found in the
rvv/autovec/vls-vlmax/shuffle-slide.c test which is not yet pushed)

vsetivli zero,4,e8,mf4,ta,ma
vle8.v v2,0(a1) # (1)
vle8.v v1,0(a2) # (2)
vsetivli zero,2,e8,mf4,tu,ma
vslidedown.vi v1,v2,2
vsetivli zero,4,e8,mf4,ta,ma
vse8.v v1,0(a2)

we wrongly "propagate" VL=2 from vslidedown into the load.

Although we check whether the "target" instruction has a merge operand
the check only handles cases where the merge operand itself is
loaded, like (2) in the snippet above.  For (1) we load the non-merged
operand, assume propagation is valid and continue despite (2).

This patch just re-uses avl_can_be_propagated_p in order to disable
slides altogether in such situations.

gcc/ChangeLog:

* config/riscv/riscv-avlprop.cc (pass_avlprop::get_vlmax_ta_preferred_avl):
Check whether the use insn is valid for propagation.

gcc/config/riscv/riscv-avlprop.cc

index 91d80aa00d62fd525c05655c57554e6e4fc78296..62491f9be2d47534c6d85977038a0cb4020cc1f2 100644 (file)
@@ -351,7 +351,8 @@ pass_avlprop::get_vlmax_ta_preferred_avl (insn_info *insn) const
          if (!use_insn->can_be_optimized () || use_insn->is_asm ()
              || use_insn->is_call () || use_insn->has_volatile_refs ()
              || use_insn->has_pre_post_modify ()
-             || !has_vl_op (use_insn->rtl ()))
+             || !has_vl_op (use_insn->rtl ())
+             || !avl_can_be_propagated_p (use_insn->rtl ()))
            return NULL_RTX;
 
          /* We should only propagate non-VLMAX AVL into VLMAX insn when