]> gcc.gnu.org Git - gcc.git/commitdiff
Remove insert location argument from vectorizable_live_operation
authorRichard Biener <rguenther@suse.de>
Wed, 9 Aug 2023 09:48:28 +0000 (11:48 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 10 Aug 2023 12:23:16 +0000 (14:23 +0200)
The insert location argument isn't actually used but we compute
that ourselves.  There's a single spot, namely when asking
for the loop mask via vect_get_loop_mask that the passed argument
is used but that looks like an oversight.  The following fixes that
and adjusts vectorizable_live_operation and can_vectorize_live_stmts
to no longer take a stmt iterator argument.

* tree-vectorizer.h (vectorizable_live_operation): Remove
gimple_stmt_iterator * argument.
* tree-vect-loop.cc (vectorizable_live_operation): Likewise.
Adjust plumbing around vect_get_loop_mask.
(vect_analyze_loop_operations): Adjust.
* tree-vect-slp.cc (vect_slp_analyze_node_operations_1): Likewise.
(vect_bb_slp_mark_live_stmts): Likewise.
(vect_schedule_slp_node): Likewise.
* tree-vect-stmts.cc (can_vectorize_live_stmts): Likewise.
Remove gimple_stmt_iterator * argument.
(vect_transform_stmt): Adjust.

gcc/tree-vect-loop.cc
gcc/tree-vect-slp.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h

index 00058c3c13e3fb7d8d9622e85ba5e2f4f819cb88..bf8d677b584c0fc75e0457914ddb16853f50473c 100644 (file)
@@ -2061,8 +2061,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
          if (ok
              && STMT_VINFO_LIVE_P (stmt_info)
              && !PURE_SLP_STMT (stmt_info))
-           ok = vectorizable_live_operation (loop_vinfo,
-                                             stmt_info, NULL, NULL, NULL,
+           ok = vectorizable_live_operation (loop_vinfo, stmt_info, NULL, NULL,
                                              -1, false, &cost_vec);
 
           if (!ok)
@@ -10185,9 +10184,7 @@ vectorizable_induction (loop_vec_info loop_vinfo,
    it can be supported.  */
 
 bool
-vectorizable_live_operation (vec_info *vinfo,
-                            stmt_vec_info stmt_info,
-                            gimple_stmt_iterator *gsi,
+vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info,
                             slp_tree slp_node, slp_instance slp_node_instance,
                             int slp_index, bool vec_stmt_p,
                             stmt_vector_for_cost *cost_vec)
@@ -10393,9 +10390,12 @@ vectorizable_live_operation (vec_info *vinfo,
             the loop mask for the final iteration.  */
          gcc_assert (ncopies == 1 && !slp_node);
          tree scalar_type = TREE_TYPE (STMT_VINFO_VECTYPE (stmt_info));
-         tree mask = vect_get_loop_mask (loop_vinfo, gsi,
+         gimple_seq tem = NULL;
+         gimple_stmt_iterator gsi = gsi_last (tem);
+         tree mask = vect_get_loop_mask (loop_vinfo, &gsi,
                                          &LOOP_VINFO_MASKS (loop_vinfo),
                                          1, vectype, 0);
+         gimple_seq_add_seq (&stmts, tem);
          tree scalar_res = gimple_build (&stmts, CFN_EXTRACT_LAST, scalar_type,
                                          mask, vec_lhs_phi);
 
index 070ab3ff7aeff79ec66df1391e21d5496e0549e3..f02921564c9d9bfb70ef73856433ebb4e241f7d8 100644 (file)
@@ -6012,8 +6012,7 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
       FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, slp_stmt_info)
        {
          if (STMT_VINFO_LIVE_P (slp_stmt_info)
-             && !vectorizable_live_operation (vinfo,
-                                              slp_stmt_info, NULL, node,
+             && !vectorizable_live_operation (vinfo, slp_stmt_info, node,
                                               node_instance, i,
                                               false, cost_vec))
            return false;
@@ -6330,7 +6329,7 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
                  {
                    STMT_VINFO_LIVE_P (stmt_info) = true;
                    if (vectorizable_live_operation (bb_vinfo, stmt_info,
-                                                    NULL, node, instance, i,
+                                                    node, instance, i,
                                                     false, cost_vec))
                      /* ???  So we know we can vectorize the live stmt
                         from one SLP node.  If we cannot do so from all
@@ -9030,8 +9029,7 @@ vect_schedule_slp_node (vec_info *vinfo,
       FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, slp_stmt_info)
        if (STMT_VINFO_LIVE_P (slp_stmt_info))
          {
-           done = vectorizable_live_operation (vinfo,
-                                               slp_stmt_info, &si, node,
+           done = vectorizable_live_operation (vinfo, slp_stmt_info, node,
                                                instance, i, true, NULL);
            gcc_assert (done);
          }
index 76b1c83f41e7f4941462e3fdacd5beae4553a408..398fbe945e581c6d4eb93a57678f826acee6e4a9 100644 (file)
@@ -12011,11 +12011,10 @@ vectorizable_comparison (vec_info *vinfo,
 /* If SLP_NODE is nonnull, return true if vectorizable_live_operation
    can handle all live statements in the node.  Otherwise return true
    if STMT_INFO is not live or if vectorizable_live_operation can handle it.
-   GSI and VEC_STMT_P are as for vectorizable_live_operation.  */
+   VEC_STMT_P is as for vectorizable_live_operation.  */
 
 static bool
-can_vectorize_live_stmts (vec_info *vinfo,
-                         stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
+can_vectorize_live_stmts (vec_info *vinfo, stmt_vec_info stmt_info,
                          slp_tree slp_node, slp_instance slp_node_instance,
                          bool vec_stmt_p,
                          stmt_vector_for_cost *cost_vec)
@@ -12027,15 +12026,14 @@ can_vectorize_live_stmts (vec_info *vinfo,
       FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (slp_node), i, slp_stmt_info)
        {
          if (STMT_VINFO_LIVE_P (slp_stmt_info)
-             && !vectorizable_live_operation (vinfo,
-                                              slp_stmt_info, gsi, slp_node,
+             && !vectorizable_live_operation (vinfo, slp_stmt_info, slp_node,
                                               slp_node_instance, i,
                                               vec_stmt_p, cost_vec))
            return false;
        }
     }
   else if (STMT_VINFO_LIVE_P (stmt_info)
-          && !vectorizable_live_operation (vinfo, stmt_info, gsi,
+          && !vectorizable_live_operation (vinfo, stmt_info,
                                            slp_node, slp_node_instance, -1,
                                            vec_stmt_p, cost_vec))
     return false;
@@ -12270,7 +12268,7 @@ vect_analyze_stmt (vec_info *vinfo,
       && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type
       && STMT_VINFO_TYPE (stmt_info) != lc_phi_info_type
       && !can_vectorize_live_stmts (as_a <loop_vec_info> (vinfo),
-                                   stmt_info, NULL, node, node_instance,
+                                   stmt_info, node, node_instance,
                                    false, cost_vec))
     return opt_result::failure_at (stmt_info->stmt,
                                   "not vectorized:"
@@ -12428,7 +12426,7 @@ vect_transform_stmt (vec_info *vinfo,
     {
       /* Handle stmts whose DEF is used outside the loop-nest that is
         being vectorized.  */
-      done = can_vectorize_live_stmts (vinfo, stmt_info, gsi, slp_node,
+      done = can_vectorize_live_stmts (vinfo, stmt_info, slp_node,
                                       slp_node_instance, true, NULL);
       gcc_assert (done);
     }
index dea29a74ebb6423127742d859121345d1c43614a..5987a327332d76788fb85c049ac65fec7377c489 100644 (file)
@@ -2362,8 +2362,7 @@ extern opt_result vect_analyze_loop_form (class loop *, vect_loop_form_info *);
 extern loop_vec_info vect_create_loop_vinfo (class loop *, vec_info_shared *,
                                             const vect_loop_form_info *,
                                             loop_vec_info = nullptr);
-extern bool vectorizable_live_operation (vec_info *,
-                                        stmt_vec_info, gimple_stmt_iterator *,
+extern bool vectorizable_live_operation (vec_info *, stmt_vec_info,
                                         slp_tree, slp_instance, int,
                                         bool, stmt_vector_for_cost *);
 extern bool vectorizable_reduction (loop_vec_info, stmt_vec_info,
This page took 0.112131 seconds and 5 git commands to generate.