Traditionally, the difference between -O2 and -O3 is that -O3 included things that sometimes sped things up and other things got a lot slower. It sounds as if the heuristics for -O3 have got better in GCC. It sounds a bit like GCC needs to move a few passes from their -O3 pipeline to -O2.
Talking about Gentoo, I do think it would be interesting to see which packages would benefit from these optimisations without having to manually test them one by one.
Traditionally, the difference between -O2 and -O3 is that -O3 included things that sometimes sped things up and other things got a lot slower. It sounds as if the heuristics for -O3 have got better in GCC. It sounds a bit like GCC needs to move a few passes from their -O3 pipeline to -O2.
I am reminded of the old Gentoo meme page https://www.shlomifish.org/humour/by-others/funroll-loops/Gentoo-is-Rice.html
Talking about Gentoo, I do think it would be interesting to see which packages would benefit from these optimisations without having to manually test them one by one.