tree-optimization/97761 - fix SLP live calculation

This removes a premature end of the DFS walk.

2020-11-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97761
	* tree-vect-slp.c (vect_bb_slp_mark_live_stmts): Remove
	premature end of DFS walk.

	* gfortran.dg/vect/pr97761.f90: New testcase.
This commit is contained in:
Richard Biener 2020-11-09 14:32:41 +01:00
parent 4e85ad79a1
commit 96f315213f
2 changed files with 32 additions and 4 deletions

View file

@ -0,0 +1,32 @@
! { dg-do compile }
! { dg-additional-options "-O1" }
subroutine ni (ps)
type vector
real x, y
end type
type quad_inductor
type (vector) v1, v2
end type
type (quad_inductor), dimension(inout) :: ps
integer :: dl, nk = 1.0
fo = 1.0
if (f == 1) then
nk = 0.0
fo = 0.0
end if
ot = nk * 0.5
gb = -fo * 0.5
wu = fo * 0.5
up = nk * 0.1
xe = up * 0.1
do lx = 0, 7
ps%v2%y = -wu
ps(dl)%v1%x = xe + 1.0
ps(dl)%v1%y = wu - tn
end do
do lx = 0, 7
ps(dl)%v1%x = 0.1 - ot
ps(dl)%v1%y = 0.1 - wu
end do
end

View file

@ -3549,12 +3549,10 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
unsigned i;
stmt_vec_info stmt_info;
stmt_vec_info last_stmt = vect_find_last_scalar_stmt_in_slp (node);
bool all_visited = true;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
{
if (svisited.contains (stmt_info))
continue;
all_visited = false;
stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
if (STMT_VINFO_IN_PATTERN_P (orig_stmt_info)
&& STMT_VINFO_RELATED_STMT (orig_stmt_info) != stmt_info)
@ -3628,8 +3626,6 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
if (mark_visited)
svisited.add (stmt_info);
}
if (all_visited)
return;
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)