]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: [multiple changes]
authorRichard Biener <rguenther@suse.de>
Fri, 23 May 2014 09:46:18 +0000 (09:46 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 23 May 2014 09:46:18 +0000 (09:46 +0000)
2014-05-23  Richard Biener  <rguenther@suse.de>

Backport from mainline
2013-08-30  Richard Biener  <rguenther@suse.de>

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  <rguenther@suse.de>

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr58228.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr58539.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c
gcc/tree-vect-loop.c

index e90dc13b039236dc100e8284ede2d9b82c055de1..db07f4673198d77f65de6ad7fb8ebbd53ba5e838 100644 (file)
@@ -1,3 +1,19 @@
+2014-05-23  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2013-08-30  Richard Biener  <rguenther@suse.de>
+
+       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  <rguenther@suse.de>
+
+       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  <rearnsha@arm.com>
 
        PR target/61208
index 4609c56f7f1c5b60fb991c7dc225161cb920e995..665ff3a92120e40e2daa1e30fd25bc8371520419 100644 (file)
@@ -1,3 +1,16 @@
+2014-05-23  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2013-08-30  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58228
+       * gcc.dg/torture/pr58228.c: New testcase.
+
+       2013-09-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58539
+       * gcc.dg/torture/pr58539.c: New testcase.
+
 2014-05-20  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
 
        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 (file)
index 0000000..d12303a
--- /dev/null
@@ -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 (file)
index 0000000..a016150
--- /dev/null
@@ -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);
+}
index 0faf1a93c9d7309450e7847fc49b2000c1ad0c12..07253ec011df578c855c6d84f3d42575b8a610b3 100644 (file)
@@ -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);
     }
 
index 964e5dd2c887b2e4335504bfae8ea3b8886fe4a4..8dea3cfbd6c10185847f0da107af58a9d5f9e281 100644 (file)
@@ -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));
                     }