https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101908
--- Comment #9 from hubicka at kam dot mff.cuni.cz --- > Not inlining ray_sphere at -O2 is of course what makes it overall slow. ray_spehere is not at all that small function. We already play tricks at -O3 to inline it by detecting that some of its parameters are loop invariant and thus inlining will enable hoisting part of function body out of loop. This we account as very large expected speedup for inlining and bump inline limits up. I do not think we could do the same at -O2 since this is all quite speculative and leads to quite some code growth. Honza