On Dec 6, 2023, Jan Hubicka <hubi...@ucw.cz> wrote: > I am sorry for sending this late.
No need to be sorry. Thank you very much for taking the time to review and comment on it. > I think the ipa changes are generally fine. Phew :-) >> +static inline bool >> +strub_always_inline_p (cgraph_node *node) >> +{ >> + return lookup_attribute ("always_inline", DECL_ATTRIBUTES (node->decl)); >> +} > We may want to ahve this as cgraph_node::always_inline_p since there are > now quite many places we look up this attribute. Can do. Would such a global refactoring still be welcome at this stage, or should it be saved for stage1? I guess it could still go in, so simple it is... >> +/* The strub pass proper adjusts types, signatures, and at-calls calls, and >> + splits internal-strub functions. */ >> + >> +unsigned int >> +pass_ipa_strub::execute (function *) >> +{ >> + cgraph_node *onode; >> + >> + ipa_strub_set_mode_for_new_functions (); >> + >> + /* First, adjust the signature of at-calls functions. We adjust types of >> + at-calls functions first, so that we don't modify types in place unless >> + strub is explicitly requested. */ > I think Martin ma have more specific opinion on this, but since this is > not running as the ipa pass during WPA stage, I think the param > modification infrastructure is not really that much hepful here. Hmm... I wonder if this is indeed what Martin refers to. There are two separate pieces of logic for parm-tweaking, one for "at-calls" strub functions, that get the signature and the type of the function itself modified (akin to adding the implicit "this" parameter to a C++ nonstatic member-function), and is implemented under the comment above, and there's the splitting-out of "internal" strub function bodies into a clone with a modified signature, that is implemented elsewhere. The latter uses cloning and thus (some, but not much) IPA param modification infrastructure, but the former doesn't IIRC. >> + /* ??? Maybe we could adjust it instead. */ >> + if (drop_fnspec) >> + remove_named_attribute_unsharing ("fn spec", >> + &TYPE_ATTRIBUTES (nftype)); > ipa param modification also doesn't know how to update fn spec, this is > something we should look into next stage1... > There is also access attribute which speaks directly about individual > arugments, perhaps you want to drop this one too? Hmm, I can't recall whether I've come across it before (it sounds vaguely familiar, but unless they become "fn spec" (ISTR synthetic "fn spec"s), I think I'd have dealt with them already. I'll dig it a little further. > Are variadic thunks working with scrubbing? Yeah, the wrapper is rewritten to call va_start itself, and the split-out wrapped body is modified to call va_copy instead of va_start. -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive