]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Factor out code checking...
authorBin Cheng <bin.cheng@arm.com>
Wed, 7 Jun 2017 11:28:17 +0000 (11:28 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Wed, 7 Jun 2017 11:28:17 +0000 (11:28 +0000)
* tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Factor
out code checking if runtime alias check is possible to below ...
Call the new function.
* tree-data-ref.c (runtime_alias_check_p): ... to new function.
* tree-data-ref.h (runtime_alias_check_p): New decalaration.

From-SVN: r248962

gcc/ChangeLog
gcc/tree-data-ref.c
gcc/tree-data-ref.h
gcc/tree-vect-data-refs.c

index fa94c6fa46ac3c1f93cb37bff576360c57946c2e..e34747f531096a9b2808438b88040c72c3ce0039 100644 (file)
@@ -1,3 +1,11 @@
+2017-06-07  Bin Cheng  <bin.cheng@arm.com>
+
+       * tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Factor
+       out code checking if runtime alias check is possible to below ...
+       Call the new function.
+       * tree-data-ref.c (runtime_alias_check_p): ... to new function.
+       * tree-data-ref.h (runtime_alias_check_p): New decalaration.
+
 2017-06-07  Marek Polacek  <polacek@redhat.com>
 
        PR sanitizer/80932
index d16bc361d09bc65cd1b1af835d6077a587492ca3..ba473021534b7d65acff96237c515fcab877fa76 100644 (file)
@@ -1182,6 +1182,55 @@ data_ref_compare_tree (tree t1, tree t2)
   return 0;
 }
 
+/* Return TRUE it's possible to resolve data dependence DDR by runtime alias
+   check.  */
+
+bool
+runtime_alias_check_p (ddr_p ddr, struct loop *loop, bool speed_p)
+{
+  if (dump_enabled_p ())
+    {
+      dump_printf (MSG_NOTE, "consider run-time aliasing test between ");
+      dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr)));
+      dump_printf (MSG_NOTE,  " and ");
+      dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr)));
+      dump_printf (MSG_NOTE, "\n");
+    }
+
+  if (!speed_p)
+    {
+      if (dump_enabled_p ())
+       dump_printf (MSG_MISSED_OPTIMIZATION,
+                    "runtime alias check not supported when optimizing "
+                    "for size.\n");
+      return false;
+    }
+
+  /* FORNOW: We don't support versioning with outer-loop in either
+     vectorization or loop distribution.  */
+  if (loop != NULL && loop->inner != NULL)
+    {
+      if (dump_enabled_p ())
+       dump_printf (MSG_MISSED_OPTIMIZATION,
+                    "runtime alias check not supported for outer loop.\n");
+      return false;
+    }
+
+  /* FORNOW: We don't support creating runtime alias tests for non-constant
+     step.  */
+  if (TREE_CODE (DR_STEP (DDR_A (ddr))) != INTEGER_CST
+      || TREE_CODE (DR_STEP (DDR_B (ddr))) != INTEGER_CST)
+    {
+      if (dump_enabled_p ())
+       dump_printf (MSG_MISSED_OPTIMIZATION,
+                     "runtime alias check not supported for non-constant "
+                    "step\n");
+      return false;
+    }
+
+  return true;
+}
+
 /* Operator == between two dr_with_seg_len objects.
 
    This equality operator is used to make sure two data refs
index 1d8e01dd7fe885758ef5cedfe2035ea13873e817..0013049053f082e4750bfa94ecef1b7f19bbd4bb 100644 (file)
@@ -368,6 +368,7 @@ extern bool dr_may_alias_p (const struct data_reference *,
 extern bool dr_equal_offsets_p (struct data_reference *,
                                 struct data_reference *);
 
+extern bool runtime_alias_check_p (ddr_p, struct loop *, bool);
 extern int data_ref_compare_tree (tree, tree);
 extern void prune_runtime_alias_test_list (vec<dr_with_seg_len_pair_t> *,
                                           unsigned HOST_WIDE_INT);
index e8e2658e2183f48c3895f9a52bc93a6f83016971..623acf695ed289c6af86ae5ae1938016378b2a09 100644 (file)
@@ -150,45 +150,9 @@ vect_mark_for_runtime_alias_test (ddr_p ddr, loop_vec_info loop_vinfo)
   if ((unsigned) PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS) == 0)
     return false;
 
-  if (dump_enabled_p ())
-    {
-      dump_printf_loc (MSG_NOTE, vect_location,
-                       "mark for run-time aliasing test between ");
-      dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr)));
-      dump_printf (MSG_NOTE,  " and ");
-      dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr)));
-      dump_printf (MSG_NOTE, "\n");
-    }
-
-  if (optimize_loop_nest_for_size_p (loop))
-    {
-      if (dump_enabled_p ())
-       dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-                         "versioning not supported when optimizing"
-                         " for size.\n");
-      return false;
-    }
-
-  /* FORNOW: We don't support versioning with outer-loop vectorization.  */
-  if (loop->inner)
-    {
-      if (dump_enabled_p ())
-       dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-                         "versioning not yet supported for outer-loops.\n");
-      return false;
-    }
-
-  /* FORNOW: We don't support creating runtime alias tests for non-constant
-     step.  */
-  if (TREE_CODE (DR_STEP (DDR_A (ddr))) != INTEGER_CST
-      || TREE_CODE (DR_STEP (DDR_B (ddr))) != INTEGER_CST)
-    {
-      if (dump_enabled_p ())
-       dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-                         "versioning not yet supported for non-constant "
-                         "step\n");
-      return false;
-    }
+  if (!runtime_alias_check_p (ddr, loop,
+                             optimize_loop_nest_for_speed_p (loop)))
+    return false;
 
   LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo).safe_push (ddr);
   return true;