diff options
author | Ira Rosen <irar@il.ibm.com> | 2010-11-04 11:51:09 +0000 |
---|---|---|
committer | Ira Rosen <irar@gcc.gnu.org> | 2010-11-04 11:51:09 +0000 |
commit | 0532869d0595b5ae8a45a6ca9eceab25fa8b2958 (patch) | |
tree | e375ba076793adb2ad4aee99238ae93f7d3f40bf | |
parent | e4d8d4ea194dd8a360a3e21474296807984fc833 (diff) | |
download | gcc-0532869d0595b5ae8a45a6ca9eceab25fa8b2958.zip gcc-0532869d0595b5ae8a45a6ca9eceab25fa8b2958.tar.gz gcc-0532869d0595b5ae8a45a6ca9eceab25fa8b2958.tar.bz2 |
re PR tree-optimization/46213 (gfortran.dg/aliasing_array_result_1.f90 ICE: in vectorizable_reduction, at tree-vect-loop.c:4046 with custom compiler flags)
PR tree-optimization/46213
* tree-vect-loop.c (vect_is_simple_reduction_1): Handle
MINUS_EXPR only if the first operand is reduction operand.
From-SVN: r166306
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/vect/pr46213.f90 | 25 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 6 |
4 files changed, 41 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a3cdb0..2cfb60a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-11-04 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/46213 + * tree-vect-loop.c (vect_is_simple_reduction_1): Handle + MINUS_EXPR only if the first operand is reduction operand. + 2010-11-04 Richard Guenther <rguenther@suse.de> Richard Henderson <rth@redhat.com> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ebbd125..66fb730 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-11-04 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/46213 + * gfortran.dg/vect/pr46213.f90: New. + 2010-11-04 Richard Guenther <rguenther@suse.de> PR testsuite/45702 diff --git a/gcc/testsuite/gfortran.dg/vect/pr46213.f90 b/gcc/testsuite/gfortran.dg/vect/pr46213.f90 new file mode 100644 index 0000000..504d1a3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr46213.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! { dg-options "-O -fno-tree-loop-ivcanon -ftree-vectorize -fno-tree-ccp -fno-tree-ch -finline-small-functions" } + +module foo + INTEGER, PARAMETER :: ONE = 1 +end module foo +program test + use foo + integer :: a(ONE), b(ONE), c(ONE), d(ONE) + interface + function h_ext() + end function h_ext + end interface + c = j() + if (any (c .ne. check)) call myabort (7) +contains + function j() + integer :: j(ONE), cc(ONE) + j = cc - j + end function j + function get_d() + end function get_d +end program test + +! { dg-final { cleanup-tree-dump "vect" } } diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 57ca5a8..bc87965 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1800,7 +1800,11 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, simply rewriting this into "res += -x[i]". Avoid changing gimple instruction for the first simple tests and only do this if we're allowed to change code at all. */ - if (code == MINUS_EXPR && modify) + if (code == MINUS_EXPR + && modify + && (op1 = gimple_assign_rhs1 (def_stmt)) + && TREE_CODE (op1) == SSA_NAME + && SSA_NAME_DEF_STMT (op1) == phi) code = PLUS_EXPR; if (check_reduction |