re PR middle-end/65962 (Missed vectorization of strided stores)
authorRichard Biener <rguenther@suse.de>
Wed, 28 Oct 2015 10:09:37 +0000 (10:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 28 Oct 2015 10:09:37 +0000 (10:09 +0000)
2015-10-28  Richard Biener  <rguenther@suse.de>

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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-62.c
gcc/tree-ssa-pre.c

index 416bc155c11862635f0ff58d6a8db5b5547784e5..883f1b68959162702a3a921ef67f6ff043e8e673 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-28  Richard Biener  <rguenther@suse.de>
+
+       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  <rguenther@suse.de>
 
        * common.opt (fchecking): New flag controlling flag_checking.
index 9d7a47c6b3b9bbdf123ff4e4e50677310918c6b6..2fd643ed1320299fa730ef0c742345751aa58437 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/65962
+       * gcc.dg/vect/vect-62.c: Adjust.
+
 2015-10-28  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/68067
index 64be339b0cd51e337161fe98d60cdf0a7d93c960..f11301c84adf23cdd41b64aadd4c901a4766ea6b 100644 (file)
@@ -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" } } */
index c5af63d8ca17ca82738ca9c429dbf8dde3071630..7deb5a4ef562509dcc3d594fa17e85be04e733aa 100644 (file)
@@ -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;