https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61837
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> --- Note the unswitching pass has special code to hoist guards of inner loops steming from loop header copying. That could possibly be enabled at -O2 since it doesn't come with a size penalty due to loop copying (the code size issue is the reason we don't unswitch at -O2 - yes, creating non-perfect nests might be another good reason).