https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101941
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #13)
> Actually, lookng at the kernel, I don't see how this can happen.
Inlining is not always the issue here.
In the case of the reduced case in PR 103242, function split will happen on
non-inline functions with -fconserve-stack. It will split off cold parts into a
seperate function to reduce the stack size of the main function.
Note the main issue is rather __builtin_object_size does not resolve itself
until after function splitting happens while __builtin_constant_p resolve
itself after inlining. So we get a jump threading and combining of the two ifs.
A few ideas on how to resovle this:
* special case function splitting such that a BB that contains a function call
which has either warning or error attribute on it; not to split out to a
different function.
* long term: figure out how to update call graph and not expand functions which
are no longer reachable after gimple level optimizations
Any other ideas?
I might look into the first idea tomorrow or the next day unless someone gets
to it before me.