https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88760
--- Comment #38 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 11 Oct 2019, segher at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88760 > > --- Comment #37 from Segher Boessenkool <segher at gcc dot gnu.org> --- > -- If it is done in RTL it should really be done earlier, it doesn't get all > optimisations it should right now. > > -- Unrolling small loops more aggressively (at -O2 even) perhaps needs to be > done at a different spot in the pipeline then? It needs no cost estimate > (other than some simple params). Well. Even unrolling a two-stmt loop just once can be detrimental on x86 CPUs and whether it is beneficial depends a lot on code alignment which we cannot really track well w/o introducing artificial code padding everywhere. But yes, this can be turned off easily on x86. Just heuristics are not as simple as you might think.