On Thu, Apr 28, 2022 at 01:54:51PM +0200, Jan Hubicka wrote:
> > --- gcc/cgraph.cc.jj        2022-04-20 09:24:12.194579146 +0200
> > +++ gcc/cgraph.cc   2022-04-27 11:53:52.102173154 +0200
> > @@ -3488,7 +3488,9 @@ cgraph_node::verify_node (void)
> >          "returns a pointer");
> >        error_found = true;
> >      }
> > -  if (definition && externally_visible
> > +  if (definition
> > +      && externally_visible
> > +      && (!alias || thunk || !in_lto_p)
> 
> The alias check seems OK to me.
> Why we need thunk?  Here thunk may eventually gain a gimple body and we
> will be interested in its opt_for_fn flags.  So if we do not set
> DECL_FUNCTION_SPECIFIC_OPTIMIZATION we may get unexpected surprises
> (such as blocked inlining).

I've added || thunk because free_lang_data sets 
DECL_FUNCTION_SPECIFIC_OPTIMIZATION
for thunks, the guarding condition is:
if (gimple_has_body_p (decl) || (node && node->thunk))
I wasn't sure if node->alias and node->thunk can be both set or not.
If they can't, I can take it out.

        Jakub

Reply via email to