diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-28 09:10:30 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-28 09:10:30 +0000 |
commit | e87502d6302857879c38fd2f115809db9a402ba1 (patch) | |
tree | a37a1ca3bba1f4fc5d479113637a1a45821b6cf0 | |
parent | badce2248e3785d19b214b63bda4f290bac9c692 (diff) | |
download | gcc-e87502d6302857879c38fd2f115809db9a402ba1.tar.gz |
2016-01-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/69466
* tree-vect-loop-manip.c (slpeel_duplicate_current_defs_from_edges):
Account for PHIs we couldn't duplicate.
* gfortran.dg/vect/pr69466.f90: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232916 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/vect/pr69466.f90 | 42 | ||||
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 19 |
4 files changed, 67 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1d8fafcdb0..1dc8252f2bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-01-28 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69466 + * tree-vect-loop-manip.c (slpeel_duplicate_current_defs_from_edges): + Account for PHIs we couldn't duplicate. + 2016-01-28 Martin Liska <mliska@suse.cz> PR pch/68758 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 540ffedf011..60c87fe9f9f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-28 Richard Biener <rguenther@suse.de> + + PR tree-optimization/69466 + * gfortran.dg/vect/pr69466.f90: New testcase. + 2016-01-28 Thomas Preud'homme <thomas.preudhomme@arm.com> * g++.dg/pr67989.C: Remove ARM-specific option. diff --git a/gcc/testsuite/gfortran.dg/vect/pr69466.f90 b/gcc/testsuite/gfortran.dg/vect/pr69466.f90 new file mode 100644 index 00000000000..a01950f1ac8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr69466.f90 @@ -0,0 +1,42 @@ +! { dg-do compile } +! { dg-additional-options "-march=core-avx2" { target x86_64-*-* i?86-*-* } } + + subroutine foo + + integer :: a, b, c, d, e + + integer, dimension(:), allocatable :: f, g, h + + call zoo (a) + call zoo (b) + call zoo (c) + + if(a == b) then + allocate(g(0:d-1), h(0:d-1)) + else + allocate(g(1), h(1)) + if (b /= 0) then + call zoo(b) + endif + endif + + if(a == b) then + do d=0,c-1 + e = e + g(d) + if(d == 0) then + h(d) = 0 + else + h(d) = h(d-1) + g(d-1) + endif + end do + endif + + if(a == b) then + allocate(f(e), g(e)) + endif + + if(a == 0) then + call boo(e) + endif + + end subroutine foo diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index f9fdf013e10..f8a44b53217 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -727,17 +727,26 @@ slpeel_duplicate_current_defs_from_edges (edge from, edge to) for (gsi_from = gsi_start_phis (from->dest), gsi_to = gsi_start_phis (to->dest); - !gsi_end_p (gsi_from) && !gsi_end_p (gsi_to); - gsi_next (&gsi_from), gsi_next (&gsi_to)) + !gsi_end_p (gsi_from) && !gsi_end_p (gsi_to);) { gimple *from_phi = gsi_stmt (gsi_from); gimple *to_phi = gsi_stmt (gsi_to); tree from_arg = PHI_ARG_DEF_FROM_EDGE (from_phi, from); + if (TREE_CODE (from_arg) != SSA_NAME) + { + gsi_next (&gsi_from); + continue; + } tree to_arg = PHI_ARG_DEF_FROM_EDGE (to_phi, to); - if (TREE_CODE (from_arg) == SSA_NAME - && TREE_CODE (to_arg) == SSA_NAME - && get_current_def (to_arg) == NULL_TREE) + if (TREE_CODE (to_arg) != SSA_NAME) + { + gsi_next (&gsi_to); + continue; + } + if (get_current_def (to_arg) == NULL_TREE) set_current_def (to_arg, get_current_def (from_arg)); + gsi_next (&gsi_from); + gsi_next (&gsi_to); } } |