tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Factor out code checking if runtime alias check is possible to below ...

* 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
This commit is contained in:
Bin Cheng 2017-06-07 11:28:17 +00:00 committed by Bin Cheng
parent 0874a778ec
commit 6355150f58
4 changed files with 61 additions and 39 deletions

View 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

View 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

View 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);

View 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;