]> gcc.gnu.org Git - gcc.git/commitdiff
[02/46] Remove dead vectorizable_reduction code
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 31 Jul 2018 14:21:17 +0000 (14:21 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 31 Jul 2018 14:21:17 +0000 (14:21 +0000)
vectorizable_reduction has old code to cope with cases in which the
given statement belongs to a reduction group but isn't the first statement.
That can no longer happen, since all statements in the group go into the
same SLP node, and we only check the first statement in each node.

The point is to remove the only path through vectorizable_reduction
in which stmt and stmt_info refer to different statements.

2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-loop.c (vectorizable_reduction): Assert that the
function is not called for second and subsequent members of
a reduction group.

From-SVN: r263117

gcc/ChangeLog
gcc/tree-vect-loop.c

index 391cc6548f00d7960b1d2524838a11d762f9a52b..39c280b42e7d59646768af6e619f26659060c3d2 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * tree-vect-loop.c (vectorizable_reduction): Assert that the
+       function is not called for second and subsequent members of
+       a reduction group.
+
 2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-loop.c (get_initial_def_for_reduction): Move special
index 18fa30ba16d0b182d14ecf07b24693855f1e684c..fb818c65202aad2654c9a2bf4bea7bb4c21c8d1b 100644 (file)
@@ -6162,7 +6162,6 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
   auto_vec<gimple *> phis;
   int vec_num;
   tree def0, tem;
-  bool first_p = true;
   tree cr_index_scalar_type = NULL_TREE, cr_index_vector_type = NULL_TREE;
   tree cond_reduc_val = NULL_TREE;
 
@@ -6178,15 +6177,8 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       nested_cycle = true;
     }
 
-  /* In case of reduction chain we switch to the first stmt in the chain, but
-     we don't update STMT_INFO, since only the last stmt is marked as reduction
-     and has reduction properties.  */
-  if (REDUC_GROUP_FIRST_ELEMENT (stmt_info)
-      && REDUC_GROUP_FIRST_ELEMENT (stmt_info) != stmt)
-    {
-      stmt = REDUC_GROUP_FIRST_ELEMENT (stmt_info);
-      first_p = false;
-    }
+  if (REDUC_GROUP_FIRST_ELEMENT (stmt_info))
+    gcc_assert (slp_node && REDUC_GROUP_FIRST_ELEMENT (stmt_info) == stmt);
 
   if (gimple_code (stmt) == GIMPLE_PHI)
     {
@@ -7050,8 +7042,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 
   if (!vec_stmt) /* transformation not required.  */
     {
-      if (first_p)
-       vect_model_reduction_cost (stmt_info, reduc_fn, ncopies, cost_vec);
+      vect_model_reduction_cost (stmt_info, reduc_fn, ncopies, cost_vec);
       if (loop_vinfo && LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo))
        {
          if (reduction_type != FOLD_LEFT_REDUCTION
This page took 0.091895 seconds and 5 git commands to generate.