On Wed, Nov 25, 2020 at 3:14 PM Jan Hubicka <hubi...@ucw.cz> wrote:
>
> Hi,
> while looking into structalias I noticed that we ignore EAF flags here.
> This is pity since we still can apply direct and unused.
> This patch simply copies logic from normal call handling. I relaize that
> it is bit more expensive by creating callarg and doing transitive
> closure there instead of doing one common transitive closure on call use.
> I can also scan first if there are both direct and !direct argument and
> do this optimization, but it does not seem to affect build times (tested
> on spec2k6 gcc LTO build)
>
> lto-boostrapped/regtested x86_64-linux.

OK.

Richard.

> Honza
>
> diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
> index a4832b75436..5f84f7d467f 100644
> --- a/gcc/tree-ssa-structalias.c
> +++ b/gcc/tree-ssa-structalias.c
> @@ -4253,12 +4253,20 @@ handle_pure_call (gcall *stmt, vec<ce_s> *results)
>    for (i = 0; i < gimple_call_num_args (stmt); ++i)
>      {
>        tree arg = gimple_call_arg (stmt, i);
> +      int flags = gimple_call_arg_flags (stmt, i);
> +
> +      if (flags & EAF_UNUSED)
> +       continue;
> +
>        if (!uses)
> -       {
> -         uses = get_call_use_vi (stmt);
> -         make_any_offset_constraints (uses);
> -         make_transitive_closure_constraints (uses);
> -       }
> +       uses = get_call_use_vi (stmt);
> +      varinfo_t tem = new_var_info (NULL_TREE, "callarg", true);
> +      tem->is_reg_var = true;
> +      make_constraint_to (tem->id, arg);
> +      make_any_offset_constraints (tem);
> +      if (!(flags & EAF_DIRECT))
> +       make_transitive_closure_constraints (tem);
> +      make_copy_constraint (uses, tem->id);
>        make_constraint_to (uses->id, arg);
>      }
>

Reply via email to