diff options
author | Richard Biener <rguenther@suse.de> | 2020-11-09 14:32:41 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-11-09 15:50:24 +0100 |
commit | 96f315213f337c2d5a9268f2d3e8337bbdb71bfc (patch) | |
tree | 8d83148e49ee571251e54dfd4cd9e55d66c23a3c /gcc | |
parent | 4e85ad79a137535393d8dc169359e1730cab3533 (diff) | |
download | gcc-96f315213f337c2d5a9268f2d3e8337bbdb71bfc.zip gcc-96f315213f337c2d5a9268f2d3e8337bbdb71bfc.tar.gz gcc-96f315213f337c2d5a9268f2d3e8337bbdb71bfc.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gfortran.dg/vect/pr97761.f90 | 32 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 4 |
2 files changed, 32 insertions, 4 deletions
diff --git a/gcc/testsuite/gfortran.dg/vect/pr97761.f90 b/gcc/testsuite/gfortran.dg/vect/pr97761.f90 new file mode 100644 index 0000000..250e2bf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr97761.f90 @@ -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 diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 88e637e..e4c2aa4 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -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) |