> 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.
Hi,
I actually noticed that I missed to update handling of static chain and
NRV values, but while testing updated patch I also found that it has no
measurable effect on cc1plus and I failed to construct testcase where
handling of EAF_DIRECT would do somehting useful.  The points-to set
of returned value contains all eascape and nonlocal solutions (as it
should).  So I decided to commit only the EAF_UNUSED part. As it stands
EAF_DIRECT handling only makes constraint graph bigger for no much
benefit.

I think to make return values useful we need to also use the info about
global memory uses.  This is easilly available from modref but doing so
seems non-trivial since pure functions can return addresses of global
symbols but NONLOCAL solution is too big for that.

Honza

        * tree-ssa-structalias.c (handle_pure_call): Skip EAF_UNUSED
         parameters.
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 9f4de96d544..cf653be8b6d 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4274,6 +4274,11 @@ 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 the argument is not used we can ignore it.  */
+      if (flags & EAF_UNUSED)
+       continue;
       if (!uses)
        {
          uses = get_call_use_vi (stmt);

Reply via email to