From 056b09955b97083e9dfcd9825160a408433143bf Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 28 Oct 2015 10:09:37 +0000 Subject: [PATCH] re PR middle-end/65962 (Missed vectorization of strided stores) 2015-10-28 Richard Biener PR tree-optimization/65962 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Avoid creating loop carried dependences also for outer loops of the loop a use to replace is in. * gcc.dg/vect/vect-62.c: Adjust. From-SVN: r229481 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/vect-62.c | 7 +++---- gcc/tree-ssa-pre.c | 10 +++++----- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 416bc155c11..883f1b68959 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-10-28 Richard Biener + + PR tree-optimization/65962 + * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): + Avoid creating loop carried dependences also for outer loops + of the loop a use to replace is in. + 2015-10-28 Richard Biener * common.opt (fchecking): New flag controlling flag_checking. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9d7a47c6b3b..2fd643ed132 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-28 Richard Biener + + PR tree-optimization/65962 + * gcc.dg/vect/vect-62.c: Adjust. + 2015-10-28 Richard Biener PR middle-end/68067 diff --git a/gcc/testsuite/gcc.dg/vect/vect-62.c b/gcc/testsuite/gcc.dg/vect/vect-62.c index 64be339b0cd..f11301c84ad 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-62.c +++ b/gcc/testsuite/gcc.dg/vect/vect-62.c @@ -33,9 +33,8 @@ int main1 () } /* Multidimensional array. Aligned. The "inner" dimensions - are invariant in the inner loop. Vectorizable, but the - vectorizer detects that everything is invariant and that - the loop is better left untouched. (it should be optimized away). */ + are invariant in the inner loop. The outer loop is + vectorizable after invariant/store motion. */ for (i = 0; i < N; i++) { for (j = 0; j < N; j++) @@ -65,5 +64,5 @@ int main (void) return main1 (); } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index c5af63d8ca1..7deb5a4ef56 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -4082,8 +4082,9 @@ eliminate_dom_walker::before_dom_children (basic_block b) gimple *def_stmt = SSA_NAME_DEF_STMT (sprime); basic_block def_bb = gimple_bb (def_stmt); if (gimple_code (def_stmt) == GIMPLE_PHI - && b->loop_father->header == def_bb) + && def_bb->loop_father->header == def_bb) { + loop_p loop = def_bb->loop_father; ssa_op_iter iter; tree op; bool found = false; @@ -4092,9 +4093,8 @@ eliminate_dom_walker::before_dom_children (basic_block b) affine_iv iv; def_bb = gimple_bb (SSA_NAME_DEF_STMT (op)); if (def_bb - && flow_bb_inside_loop_p (b->loop_father, def_bb) - && simple_iv (b->loop_father, - b->loop_father, op, &iv, true)) + && flow_bb_inside_loop_p (loop, def_bb) + && simple_iv (loop, loop, op, &iv, true)) { found = true; break; @@ -4110,7 +4110,7 @@ eliminate_dom_walker::before_dom_children (basic_block b) print_generic_expr (dump_file, sprime, 0); fprintf (dump_file, " which would add a loop" " carried dependence to loop %d\n", - b->loop_father->num); + loop->num); } /* Don't keep sprime available. */ sprime = NULL_TREE; -- 2.30.2