https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98974
Bug ID: 98974
Summary: ICE in vectorizable_condition after
STMT_VINFO_VEC_STMTS
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: avieira at gcc dot gnu.org
Target Milestone: ---
Hi,
After
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b05d5563f4be13b4a0d0951375a82adf483973c0
we found vectorizable_condition to ICE when autovectorizing for SVE.
The reduced fortran testcase is an example of this:
$ cat foo.F90
module module_foobar
integer,parameter :: fp_kind = selected_real_kind(15)
contains
subroutine foobar( foo, ix ,jx ,kx,iy,ky)
real, dimension( ix, kx, jx ) :: foo
real(fp_kind), dimension( iy, ky, 3 ) :: bar, baz
j_loop: do j=jts,enddo
do k=0,ky
do i=0,iy
if ( baz(i,k,1) > 0. ) then
bar(i,k,1) = 0
endif
foo(i,nk,j) = baz0 * bar(i,k,1)
enddo
enddo
enddo j_loop
end
end
And the following command will cause it to ICE:
$ gfortran -Ofast -mcpu=neoverse-v1 foo.F90 -S
I have debugged this and I believe the issue is that before Richi's change
vectorizable_condition used to set vec_oprnds0 to vec_cond_lhs for each copy.
Now it is collected for all copies at the same time. However, when calling
vect_get_loop_mask we pass vec_num * ncopies as the nvectors parameter, where
vec_num has been set to the length of vec_oprnds0. I believe that because we
are now doing all ncopies at the same time we no longer need to multiply it by
ncopies.
I'll be posting a patch for this soon.