[PATCH] Kconfig: default to CC_OPTIMIZE_FOR_PERFORMANCE_O3 for gcc >= 10
From: Artem S. Tashkinov
Date: Wed May 13 2020 - 07:27:46 EST
> GCC 10 appears to have changed -O2 in order to make compilation time
faster when using -flto, seemingly at the expense of performance, in
particular with regards to how the inliner works. Since -O3 these days
shouldn't have the same set of bugs as 10 years ago, this commit
defaults new kernel compiles to -O3 when using gcc >= 10.
It's a strong "no" from me.
1) Aside from rare Gentoo users no one has extensively tested -O3 with
the kernel - even Gentoo defaults to -O2 for kernel compilation
2) -O3 _always_ bloats the code by a large amount which means both
vmlinux/bzImage and modules will become bigger, and slower to load from
the disk
3) -O3 does _not_ necessarily makes the code run faster
4) If GCC10 has removed certain options for the -O2 optimization level
you could just readded them as compilation flags without forcing -O3 by
default on everyone
5) If you still insist on -O3 I guess everyone would be happy if you
just made two KConfig options:
OPTIMIZE_O2 (-O2)
OPTIMIZE_O3_EVEN_MOAR (-O3)
Best regards,
Artem