diff options
author | Richard Biener <rguenther@suse.de> | 2024-08-30 09:50:32 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2024-08-30 12:47:12 +0200 |
commit | d48273f06fee3886b05ce4d10b4db3d52f1991dc (patch) | |
tree | 63feb441b5c558735234a0a33206539b567b8da9 /gcc/gdbhooks.py | |
parent | e7c7397236544f0e7dbb1ffa635b58126157dc86 (diff) | |
download | gcc-d48273f06fee3886b05ce4d10b4db3d52f1991dc.zip gcc-d48273f06fee3886b05ce4d10b4db3d52f1991dc.tar.gz gcc-d48273f06fee3886b05ce4d10b4db3d52f1991dc.tar.bz2 |
Avoid division by zero via constant_multiple_p
With recent SLP vectorization patches I see RISC-V divison by zero
for gfortran.dg/matmul_10.f90 and others in get_group_load_store_type
which does
&& can_div_trunc_p (group_size
* LOOP_VINFO_VECT_FACTOR (loop_vinfo) - gap,
nunits, &tem, &remain)
&& (known_eq (remain, 0u)
|| (constant_multiple_p (nunits, remain, &num)
&& (vector_vector_composition_type (vectype, num,
&half_vtype)
!= NULL_TREE))))
overrun_p = false;
where for [2, 2] / [0, 2] the condition doesn't reflect what we
are trying to test - that, when remain is zero or, when non-zero,
nunits is a multiple of remain, we can avoid touching a gap via
loading smaller pieces and vector composition.
It isn't safe to change the known_eq to maybe_eq so instead
require known_ne (remain, 0u) before doing constant_multiple_p.
There's the corresponding code in vectorizable_load that's known
to have a latent similar issue, so sync that up as well.
* tree-vect-stmts.cc (get_group_load_store_type): Check
known_ne (remain, 0u) before doing constant_multiple_p.
(vectorizable_load): Likewise.
Diffstat (limited to 'gcc/gdbhooks.py')
0 files changed, 0 insertions, 0 deletions