https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79776

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
We are ignoring global.inlined_to when walking over nodes already.

What I wonder now is, as we're obviously seeing thunks as first class functions
in IPA-PTA, we are walking over thunks in addition to aliases at all.  I
suppose
this is for the case the thunk doesn't have a body (and thus we'd miss the
call to the real function).

Thus

Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c  (revision 246489)
+++ gcc/tree-ssa-structalias.c  (working copy)
@@ -7615,7 +7615,7 @@ struct pt_solution ipa_escaped_pt
 static bool
 associate_varinfo_to_alias (struct cgraph_node *node, void *data)
 {
-  if ((node->alias || node->thunk.thunk_p)
+  if ((node->alias || (node->thunk.thunk_p && ! node->has_gimple_body_p ()))
       && node->analyzed)
     insert_vi_for_tree (node->decl, (varinfo_t)data);
   return false;

not sure why we check ->analyzed here.

Hmm, but thunks never have a body according to has_gimple_body_p.

So we are skipping all thunks, even those with gimple bodies, in

  FOR_EACH_DEFINED_FUNCTION (node)
    {
      varinfo_t vi;
      /* Nodes without a body are not interesting.  Especially do not
         visit clones at this point for now - we get duplicate decls
         there for inline clones at least.  */
      if (!node->has_gimple_body_p () || node->global.inlined_to)
        continue;

that means excluding inlined_to thunks is ok.

Testing that.

Reply via email to