TL;DR: How do I fix inline failures by LTO on compiler-generated functions?
I am using GCC and MPICH with link-time optimization and -O3 to compile a high-performance code. At link-time, I get the following inline warnings:
warning: inlining failed in call to ‘__dt_comp ’: call is unlikely and code size would grow [-Winline]
The function __dt_comp
is compiler-generated (there are many of these generated with various compiler-generated functions). It seems that the compiler is creating functions and asking for them to be inlined, but the inline directive is not respected by the linker during LTO.
I can confirm that this occurs for:
- GCC 13.2.0 / MPICH 4.2.0 under Ubuntu 24.04
- GCC 11.4.0 / MPICH 4.0 under Ubuntu 22.04
This does not occur, however for - GCC 9.4.0 / MPICH 3.3.2 under Ubuntu 20.04
I do not want to suppress all inline failure warnings; I only want to avoid warnings when LTO fails on compiler generated functions.
Common fixes and why they do not work here:
- Remove inline keyword – this does not work because the functions themselves are compiler generated.
- Ignore inline warnings – this does not work because warnings are necessary to check other functions
- Increase limit on function inlining – this might be a good thing to do, but is not a long-term fix for the problem.
Unfortunately, a MWE is not feasible since this only occurs with a very large code.
mrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.