From: Jan Hubicka Date: Thu, 8 Oct 2020 15:15:58 +0000 (+0200) Subject: Disable TBAA in some uses of call_may_clobber_ref_p X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3e1123e52f8eca2650efa0bc81768792d328961f;p=gcc.git 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. --- diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index 9d17a104f34..df757f70e71 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -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; diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 97255987e79..ac7e020c5e2 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -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 diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h index 1dd02c0ea62..1561ead2941 100644 --- a/gcc/tree-ssa-alias.h +++ b/gcc/tree-ssa-alias.h @@ -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 *); diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 014b7bdfd01..c139adb6130 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -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 (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) diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index d81e9213460..44643bef5f1 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -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)) {