https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128847
颜森道 <yansendao at 126 dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yansendao at 126 dot com
--- Comment #1 from 颜森道 <yansendao at 126 dot com> ---
Created attachment 66257
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66257&action=edit
patch: i386: apply the -funroll-loops defaults when -fprofile-use enabled it
Attaching a patch for the i386 case.
-fprofile-use enables -funroll-loops in enable_fdo_optimizations() through
SET_OPTION_IF_UNSET, which does not record the option in opts_set, so
ix86_override_options_after_change_1() does not apply the defaults that
follow an explicit -funroll-loops: -munroll-only-small-loops stays in
effect (and -fweb/-frename-registers stay disabled). The patch makes the
hook treat profile-feedback-enabled unrolling like an explicit
-funroll-loops.
An alternative, more general fix would be to record the option in opts_set
inside enable_fdo_optimizations() itself; that would also cover the same
pattern in the rs6000, riscv and s390 hooks. I am happy to go either way.
Testing: bootstrap + make -k check on x86_64, same failure list as the
baseline; with CPython 3.12.15 (PGO+LTO), binascii.b2a_base64() is 8.1%
faster (1444 -> 1327 us, x86).