]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[vect] Refactor versioning threshold
authoravieira <avieira@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Oct 2019 11:59:35 +0000 (11:59 +0000)
committeravieira <avieira@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Oct 2019 11:59:35 +0000 (11:59 +0000)
gcc/ChangeLog:
2019-10-17  Andre Vieira  <andre.simoesdiasvieira@arm.com>

* tree-vect-loop.c (vect_transform_loop): Move code from here...
* tree-vect-loop-manip.c (vect_loop_versioning): ... to here.
* tree-vectorizer.h (vect_loop_versioning): Remove unused parameters.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277101 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-vect-loop-manip.c
gcc/tree-vect-loop.c
gcc/tree-vectorizer.h

index eebb890282bd6eacda972a5708d8e9dc6da4b4d4..4c90b48c9f388b1dff765bf74acdafbd7ade394f 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-17  Andre Vieira  <andre.simoesdiasvieira@arm.com>
+
+       * tree-vect-loop.c (vect_transform_loop): Move code from here...
+       * tree-vect-loop-manip.c (vect_loop_versioning): ... to here.
+       * tree-vectorizer.h (vect_loop_versioning): Remove unused parameters.
+
 2019-10-17  Richard Biener  <rguenther@suse.de>
 
        * tree-vect-loop.c (needs_fold_left_reduction_p): Export.
index 5c25441c70a271f04730486e513437fffa75b7e3..a2902267c62889a63af09d121a631e6d8c6f69d5 100644 (file)
@@ -2966,9 +2966,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, tree * cond_expr)
    *COND_EXPR_STMT_LIST.  */
 
 class loop *
-vect_loop_versioning (loop_vec_info loop_vinfo,
-                     unsigned int th, bool check_profitability,
-                     poly_uint64 versioning_threshold)
+vect_loop_versioning (loop_vec_info loop_vinfo)
 {
   class loop *loop = LOOP_VINFO_LOOP (loop_vinfo), *nloop;
   class loop *scalar_loop = LOOP_VINFO_SCALAR_LOOP (loop_vinfo);
@@ -2988,10 +2986,15 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
   bool version_align = LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo);
   bool version_alias = LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo);
   bool version_niter = LOOP_REQUIRES_VERSIONING_FOR_NITERS (loop_vinfo);
+  poly_uint64 versioning_threshold
+    = LOOP_VINFO_VERSIONING_THRESHOLD (loop_vinfo);
   tree version_simd_if_cond
     = LOOP_REQUIRES_VERSIONING_FOR_SIMD_IF_COND (loop_vinfo);
+  unsigned th = LOOP_VINFO_COST_MODEL_THRESHOLD (loop_vinfo);
 
-  if (check_profitability)
+  if (th >= vect_vf_for_cost (loop_vinfo)
+      && !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+      && !ordered_p (th, versioning_threshold))
     cond_expr = fold_build2 (GE_EXPR, boolean_type_node, scalar_loop_iters,
                             build_int_cst (TREE_TYPE (scalar_loop_iters),
                                            th - 1));
index 0ad32cec2e2a0cc2aa59e3fdabe7144d5cc6c80b..cdbf768390233ed8d31b06eeb99463d75793fb91 100644 (file)
@@ -8083,18 +8083,8 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 
   if (LOOP_REQUIRES_VERSIONING (loop_vinfo))
     {
-      poly_uint64 versioning_threshold
-       = LOOP_VINFO_VERSIONING_THRESHOLD (loop_vinfo);
-      if (check_profitability
-         && ordered_p (poly_uint64 (th), versioning_threshold))
-       {
-         versioning_threshold = ordered_max (poly_uint64 (th),
-                                             versioning_threshold);
-         check_profitability = false;
-       }
       class loop *sloop
-       = vect_loop_versioning (loop_vinfo, th, check_profitability,
-                               versioning_threshold);
+       = vect_loop_versioning (loop_vinfo);
       sloop->force_vectorize = false;
       check_profitability = false;
     }
index 559d78d4491c8644118aafaa5947122d0fe683c5..ad8be029d7c4c8a5b5d486bf82f7fcb7039337fe 100644 (file)
@@ -1514,8 +1514,7 @@ extern void vect_set_loop_condition (class loop *, loop_vec_info,
 extern bool slpeel_can_duplicate_loop_p (const class loop *, const_edge);
 class loop *slpeel_tree_duplicate_loop_to_edge_cfg (class loop *,
                                                     class loop *, edge);
-class loop *vect_loop_versioning (loop_vec_info, unsigned int, bool,
-                                  poly_uint64);
+class loop *vect_loop_versioning (loop_vec_info);
 extern class loop *vect_do_peeling (loop_vec_info, tree, tree,
                                     tree *, tree *, tree *, int, bool, bool);
 extern void vect_prepare_for_masked_peels (loop_vec_info);