From: Richard Biener Date: Fri, 23 May 2014 09:46:18 +0000 (+0000) Subject: backport: [multiple changes] X-Git-Tag: releases/gcc-4.7.4~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5146bacf9eb489210e7d3926399cb2150e51847b;p=thirdparty%2Fgcc.git backport: [multiple changes] 2014-05-23 Richard Biener Backport from mainline 2013-08-30 Richard Biener PR tree-optimization/58228 * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not allow invariant loads in nested loop vectorization. * gcc.dg/torture/pr58228.c: New testcase. 2013-09-26 Richard Biener PR tree-optimization/58539 * tree-vect-loop.c (vect_create_epilog_for_reduction): Honor the fact that debug statements are not taking part in loop-closed SSA construction. * gcc.dg/torture/pr58539.c: New testcase. From-SVN: r210847 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e90dc13b0392..db07f4673198 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2014-05-23 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58228 + * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not + allow invariant loads in nested loop vectorization. + + 2013-09-26 Richard Biener + + PR tree-optimization/58539 + * tree-vect-loop.c (vect_create_epilog_for_reduction): Honor + the fact that debug statements are not taking part in loop-closed + SSA construction. + 2014-05-22 Richard Earnshaw PR target/61208 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4609c56f7f1c..665ff3a92120 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2014-05-23 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58228 + * gcc.dg/torture/pr58228.c: New testcase. + + 2013-09-26 Richard Biener + + PR tree-optimization/58539 + * gcc.dg/torture/pr58539.c: New testcase. + 2014-05-20 Senthil Kumar Selvaraj Backport from mainline r210325 diff --git a/gcc/testsuite/gcc.dg/torture/pr58228.c b/gcc/testsuite/gcc.dg/torture/pr58228.c new file mode 100644 index 000000000000..d12303a008da --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58228.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +extern void abort (void); +int a[8][8] = {{1}}; +int b, c, d, e; + +int main () +{ + for (c = 0; c < 8; c++) + for (b = 0; b < 2; b++) + a[b + 4][c] = a[c][0]; + if (a[4][4] != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr58539.c b/gcc/testsuite/gcc.dg/torture/pr58539.c new file mode 100644 index 000000000000..a016150f18ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58539.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +int a, b; + +extern void baz (int); + +int foo (int p) +{ + return p ? p : 1; +} + +void bar () +{ + int *c = &a, *d = &a; + for (b = 0; b < 12; b++) + *d |= 1; + foo (*c); + baz (*c && 1); +} diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 0faf1a93c9d7..07253ec011df 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2332,6 +2332,12 @@ vect_analyze_data_ref_access (struct data_reference *dr) if (loop_vinfo && dr_step == 0) { GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) = NULL; + if (nested_in_vect_loop_p (loop, stmt)) + { + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "zero step in inner loop of nest"); + return false; + } return DR_IS_READ (dr); } diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 964e5dd2c887..8dea3cfbd6c1 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4164,7 +4164,8 @@ vect_finalize_reduction: result. (The reduction result is expected to have two immediate uses - one at the latch block, and one at the loop exit). */ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest) - if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p)))) + if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))) + && !is_gimple_debug (USE_STMT (use_p))) VEC_safe_push (gimple, heap, phis, USE_STMT (use_p)); /* We expect to have found an exit_phi because of loop-closed-ssa @@ -4292,7 +4293,10 @@ vect_finalize_reduction: FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest) { if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p)))) - VEC_safe_push (gimple, heap, phis, USE_STMT (use_p)); + { + if (!is_gimple_debug (USE_STMT (use_p))) + VEC_safe_push (gimple, heap, phis, USE_STMT (use_p)); + } else { if (double_reduc && gimple_code (USE_STMT (use_p)) == GIMPLE_PHI) @@ -4302,7 +4306,8 @@ vect_finalize_reduction: FOR_EACH_IMM_USE_FAST (phi_use_p, phi_imm_iter, phi_res) { if (!flow_bb_inside_loop_p (loop, - gimple_bb (USE_STMT (phi_use_p)))) + gimple_bb (USE_STMT (phi_use_p))) + && !is_gimple_debug (USE_STMT (phi_use_p))) VEC_safe_push (gimple, heap, phis, USE_STMT (phi_use_p)); }