https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111806
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The difference is -O2 duplicates the return which might speed up things. This happens during bb reorder due to estimates of the bb counts.