https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123459
--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> --- Note that in the illustrated case, where there's a chain of handlers and one handler can invoke the next in chain, speculative inlining/devirtualization as done by GCC is just harmful, as there's little chance that the next handler will be the same as current (in the given testcase, h->next->handler would be set by another TU, where noop_handler is not visible). (after all, if the programmer wanted a recursive call, they could have written a recursive call without obfuscating it via indirection) Perhaps, heuristically limiting speculative inlining to disregard recursive edges might be a worthwhile idea, while of course not a substitute for a proper fix.
