From: Richard Biener Date: Tue, 4 Mar 2014 08:47:55 +0000 (+0000) Subject: re PR tree-optimization/60382 (ICE on valid code at -O3 on x86_64-linux-gnu (in vect_... X-Git-Tag: releases/gcc-4.9.0~584 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b75f28e1aef56750fb163c3ee580474f0a0a4dc5;p=thirdparty%2Fgcc.git re PR tree-optimization/60382 (ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)) 2014-03-04 Richard Biener PR tree-optimization/60382 * tree-vect-loop.c (vect_is_simple_reduction_1): Do not consider dead PHIs a reduction. * gcc.dg/vect/pr60382.c: New testcase. From-SVN: r208305 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f5bd57bef0b..ee70301094af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-03-04 Richard Biener + + PR tree-optimization/60382 + * tree-vect-loop.c (vect_is_simple_reduction_1): Do not consider + dead PHIs a reduction. + 2014-03-03 Uros Bizjak * config/i386/xmmintrin.h (enum _mm_hint) <_MM_HINT_ET0>: Correct diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b0f81006e71..7ba86f719855 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-04 Richard Biener + + PR tree-optimization/60382 + * gcc.dg/vect/pr60382.c: New testcase. + 2014-03-03 Jerry DeLisle PR libfortran/60148 diff --git a/gcc/testsuite/gcc.dg/vect/pr60382.c b/gcc/testsuite/gcc.dg/vect/pr60382.c new file mode 100644 index 000000000000..a28c6313c40f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr60382.c @@ -0,0 +1,32 @@ +#include "tree-vect.h" + +int a, b, c, e, f; + +void +foo () +{ + for (b = 0; b < 3; b++) + if (e) + { + for (c = 0; c < 4; c++) + { + if (b) + continue; + f = 1; + for (a = 0; a < 2; a++) + f |= 1; + } + for (;;) + ; + } +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 838803ebe520..df6ab6fcb9ee 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2193,6 +2193,12 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, || (!check_reduction && flow_loop_nested_p (vect_loop, loop))); name = PHI_RESULT (phi); + /* ??? If there are no uses of the PHI result the inner loop reduction + won't be detected as possibly double-reduction by vectorizable_reduction + because that tries to walk the PHI arg from the preheader edge which + can be constant. See PR60382. */ + if (has_zero_uses (name)) + return NULL; nloop_uses = 0; FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name) {