https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61837
--- Comment #9 from luoxhu at gcc dot gnu.org --- (In reply to Segher Boessenkool from comment #8) > -funswitch-loops changes things like > > for (...) { > if (...) > ...1; > else > ...2; > } > > into > > if (...) { > for (...) > ...1; > } else { > for (...) > ...2; > } > > which often is not a good idea. This is why this is not done at -O2: > -O2 is only for optimisations that almost never hurt performance. Yes, for this case it performs better with unswitch-loops, and I see many usage of -O2 with unswith-loops in testsuite. I thought you were meaning do this at O2 without -funswitch-loops...