Disable TBAA in some uses of call_may_clobber_ref_p

* tree-nrv.c (dest_safe_for_nrv_p): Disable tbaa in
	call_may_clobber_ref_p and ref_maybe_used_by_stmt_p.
	* tree-tailcall.c (find_tail_calls): Likewise.
	* tree-ssa-alias.c (call_may_clobber_ref_p): Add tbaa_p parameter.
	* tree-ssa-alias.h (call_may_clobber_ref_p): Update prototype.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Pass data->tbaa_p
	to call_may_clobber_ref_p_1.
This commit is contained in:
Jan Hubicka 2020-10-08 17:15:58 +02:00
parent 3a9e6ee42a
commit 3e1123e52f
5 changed files with 9 additions and 9 deletions

View File

@ -315,8 +315,8 @@ dest_safe_for_nrv_p (gcall *call)
if (TREE_CODE (dest) == SSA_NAME)
return true;
if (call_may_clobber_ref_p (call, dest)
|| ref_maybe_used_by_stmt_p (call, dest))
if (call_may_clobber_ref_p (call, dest, false)
|| ref_maybe_used_by_stmt_p (call, dest, false))
return false;
return true;

View File

@ -3320,12 +3320,12 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
return true, otherwise return false. */
bool
call_may_clobber_ref_p (gcall *call, tree ref)
call_may_clobber_ref_p (gcall *call, tree ref, bool tbaa_p)
{
bool res;
ao_ref r;
ao_ref_init (&r, ref);
res = call_may_clobber_ref_p_1 (call, &r, true);
res = call_may_clobber_ref_p_1 (call, &r, tbaa_p);
if (res)
++alias_stats.call_may_clobber_ref_p_may_alias;
else

View File

@ -128,7 +128,7 @@ extern bool ref_maybe_used_by_stmt_p (gimple *, ao_ref *, bool = true);
extern bool stmt_may_clobber_global_p (gimple *);
extern bool stmt_may_clobber_ref_p (gimple *, tree, bool = true);
extern bool stmt_may_clobber_ref_p_1 (gimple *, ao_ref *, bool = true);
extern bool call_may_clobber_ref_p (gcall *, tree);
extern bool call_may_clobber_ref_p (gcall *, tree, bool = true);
extern bool call_may_clobber_ref_p_1 (gcall *, ao_ref *, bool = true);
extern bool stmt_kills_ref_p (gimple *, tree);
extern bool stmt_kills_ref_p (gimple *, ao_ref *);

View File

@ -2586,7 +2586,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
if (valueized_anything)
{
bool res = call_may_clobber_ref_p_1 (as_a <gcall *> (def_stmt),
ref);
ref, data->tbaa_p);
for (unsigned i = 0; i < gimple_call_num_args (def_stmt); ++i)
gimple_call_set_arg (def_stmt, i, oldargs[i]);
if (!res)

View File

@ -523,7 +523,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
tree result_decl = DECL_RESULT (cfun->decl);
if (result_decl
&& may_be_aliased (result_decl)
&& ref_maybe_used_by_stmt_p (call, result_decl))
&& ref_maybe_used_by_stmt_p (call, result_decl, false))
return;
/* We found the call, check whether it is suitable. */
@ -597,8 +597,8 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
if (TREE_CODE (var) != PARM_DECL
&& auto_var_in_fn_p (var, cfun->decl)
&& may_be_aliased (var)
&& (ref_maybe_used_by_stmt_p (call, var)
|| call_may_clobber_ref_p (call, var)))
&& (ref_maybe_used_by_stmt_p (call, var, false)
|| call_may_clobber_ref_p (call, var, false)))
{
if (!VAR_P (var))
{