Makefile: Use -O3 optimization for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE

-O3 is much more stable with modern compilers these days than it was a
decade ago. Using -O3 on the kernel results in significantly improved
hackbench performance, which is a sign that overall performance in the
kernel is improved. It works especially well in conjunction with LTO.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2020-03-11 11:30:06 -07:00 committed by Gagan Malvi
parent 67d97cca47
commit 938a706b23
No known key found for this signature in database
GPG key ID: B932A7CE71E9198F

View file

@ -703,7 +703,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os KBUILD_CFLAGS += -Os
else else
KBUILD_CFLAGS += -O2 KBUILD_CFLAGS += -O3
endif endif
# Tell gcc to never replace conditional load with a non-conditional one # Tell gcc to never replace conditional load with a non-conditional one