On Thu, Nov 28, 2024 at 11:23:02AM +0100, Richard Biener wrote: > Sorry for chiming in only late - to me this shows that the desire to inline > a function more than another function, currently identified as > DECL_DECLARED_INLINE_P overlaps with frontend semantic differences. > But don't we reflect those semantic differences into the IL (via linkage, > symtab details) already?
After handling it in the FE, yes, we do. We still want DECL_DECLARED_INLINE_P also e.g. for debug info generation. > So what would remain is a way for the user > to distinguish between auto-inline (we have the corresponding -auto > set of --params) and inline-inline. The middle-end interface after your > change, where DECL_DECLARED_INLINE_P means inline-inline > unless !DECL_OPTIMIZABLE_INLINE_P looks a bit awkward. > > Rather than clearing DECL_DECLARED_INLINE_P I'd suggest to > split both completely and turn DECL_DISREGARD_INLINE_LIMITS, > DECL_UNINLINABLE and auto-inline vs. inline-inline into a > multi-bit enum and only use that for inlining decisions (ignoring > DECL_DECLARED_INLINE_P for that purpose, but use that > and feeble_inline to compute the enum value). I think a 4 state flag { never_inline, default, auto_inline, always_inline } would be fine. The question is how to call the macro(s) and values and how to merge those from different decls and what we do currently e.g. for noinline, always_inline, on the same or on different decls of the same function. > Note I've had to lookup what 'feeble' means - given we use -auto feeble was used in the meaning of synonym to weak, as I wrote, weak_inline could be confusing. Another possibility would be weaker_inline though, that one can't confuse with weak attribute. > for --params I'd have chosen __attribute__((auto_inline)), possibly > "completed" by __attribute__((inline)) to mark a function as > wanting 'inline' heuristics but not 'inline' semantics. I think auto_inline and inline would be just confusing, even in the negative forms. We actually "auto-inline" even functions not declared inline, just with different heuristics. Jakub