]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-vect-loop.c (vect_is_slp_reduction): Don't set use_stmt twice.
authorJakub Jelinek <jakub@redhat.com>
Fri, 14 Feb 2014 07:31:23 +0000 (08:31 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 14 Feb 2014 07:31:23 +0000 (08:31 +0100)
* tree-vect-loop.c (vect_is_slp_reduction): Don't set
use_stmt twice.
(get_initial_def_for_induction, vectorizable_induction): Ignore
debug stmts when looking for exit_phi.
(vectorizable_live_operation): Fix up condition.

* gcc.c-torture/compile/20140213.c: New test.

From-SVN: r207778

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20140213.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index 3b9468d0766ce96756d5735e01bae9235df5a813..99d55bfd84a4f0c2e090ec730c1afba1a6a777dc 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * tree-vect-loop.c (vect_is_slp_reduction): Don't set
+       use_stmt twice.
+       (get_initial_def_for_induction, vectorizable_induction): Ignore
+       debug stmts when looking for exit_phi.
+       (vectorizable_live_operation): Fix up condition.
+
 2014-02-14  Chung-Ju Wu  <jasonwucj@gmail.com>
 
        * config/nds32/nds32.c (nds32_asm_function_prologue): Do not use
index 881aa3df2a0c34e913c5677a151957161ccd9f7d..b2fefd0875a5ec0e3c2ca1b037c4138f7345beae 100644 (file)
@@ -1,3 +1,7 @@
+2014-02-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/compile/20140213.c: New test.
+
 2014-02-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/43546
diff --git a/gcc/testsuite/gcc.c-torture/compile/20140213.c b/gcc/testsuite/gcc.c-torture/compile/20140213.c
new file mode 100644 (file)
index 0000000..3811caa
--- /dev/null
@@ -0,0 +1,21 @@
+static unsigned short
+foo (unsigned char *x, int y)
+{
+  unsigned short r = 0;
+  int i;
+  for (i = 0; i < y; i++)
+    r += x[i];
+  return r;
+}
+
+int baz (int, unsigned short);
+
+void
+bar (unsigned char *x, unsigned char *y)
+{
+  int i;
+  unsigned short key = foo (x, 0x10000);
+  baz (0, 0);
+  for (i = 0; i < 0x80000; i++)
+    y[i] = x[baz (i, key)];
+}
index ab4d06fef33f735d42b2269df692fe1c9cb59237..838803ebe520ef883ef28f422548020bd1339353 100644 (file)
@@ -1968,10 +1968,8 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt)
       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, lhs)
         {
          gimple use_stmt = USE_STMT (use_p);
-          if (is_gimple_debug (use_stmt))
-            continue;
-
-         use_stmt = USE_STMT (use_p);
+         if (is_gimple_debug (use_stmt))
+           continue;
 
           /* Check if we got back to the reduction phi.  */
          if (use_stmt == phi)
@@ -3507,9 +3505,13 @@ get_initial_def_for_induction (gimple iv_phi)
       exit_phi = NULL;
       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, loop_arg)
         {
-         if (!flow_bb_inside_loop_p (iv_loop, gimple_bb (USE_STMT (use_p))))
+         gimple use_stmt = USE_STMT (use_p);
+         if (is_gimple_debug (use_stmt))
+           continue;
+
+         if (!flow_bb_inside_loop_p (iv_loop, gimple_bb (use_stmt)))
            {
-             exit_phi = USE_STMT (use_p);
+             exit_phi = use_stmt;
              break;
            }
         }
@@ -5413,10 +5415,13 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
       loop_arg = PHI_ARG_DEF_FROM_EDGE (phi, latch_e);
       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, loop_arg)
        {
-         if (!flow_bb_inside_loop_p (loop->inner,
-                                     gimple_bb (USE_STMT (use_p))))
+         gimple use_stmt = USE_STMT (use_p);
+         if (is_gimple_debug (use_stmt))
+           continue;
+
+         if (!flow_bb_inside_loop_p (loop->inner, gimple_bb (use_stmt)))
            {
-             exit_phi = USE_STMT (use_p);
+             exit_phi = use_stmt;
              break;
            }
        }
@@ -5514,7 +5519,7 @@ vectorizable_live_operation (gimple stmt,
            {
              gimple use_stmt = USE_STMT (use_p);
              if (gimple_code (use_stmt) == GIMPLE_PHI
-                 || gimple_bb (use_stmt) == merge_bb)
+                 && gimple_bb (use_stmt) == merge_bb)
                {
                  if (vec_stmt)
                    {