diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -467,7 +467,7 @@ endif export KERNELDOC KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ - -O2 -fomit-frame-pointer -std=gnu11 + -O3 -fomit-frame-pointer -std=gnu11 KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS) KBUILD_USERLDFLAGS := $(USERLDFLAGS) @@ -506,7 +506,7 @@ endif KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) \ $(HOSTCFLAGS) -I $(srctree)/scripts/include -KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) \ +KBUILD_HOSTCXXFLAGS := -Wall -O3 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) \ -I $(srctree)/scripts/include KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \ -Zallow-features= @@ -922,19 +922,19 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += -fno-delete-null-pointer-checks ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE -KBUILD_CFLAGS += -O2 +KBUILD_CFLAGS += -O3 # LLVM's Polly for high-level loop and data-locality optimizer based on integer # polyhedra to analyze and optimize the memory access pattern. KBUILD_CFLAGS += $(call cc-option,-mllvm=-polly -mllvm=-polly-ast-use-context \ -mllvm=-polly-invariant-load-hoisting -mllvm=-polly-loopfusion-greedy \ -mllvm=-polly-run-inliner -mllvm=-polly-vectorizer=stripmine) ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION KBUILD_CFLAGS += $(call cc-option,-mllvm=-polly-run-dce) endif # Enable software pipelining (Swing Modulo Scheduling) for innermost loops. KBUILD_CFLAGS += $(call cc-option,-fmodulo-sched -fmodulo-sched-allow-regmoves) \ $(call cc-option,-mllvm=-enable-pipeliner) -KBUILD_RUSTFLAGS += -Copt-level=2 +KBUILD_RUSTFLAGS += -Copt-level=3 else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os KBUILD_CFLAGS += $(call cc-option,-mllvm=-enable-pipeliner-opt-size) diff --git a/init/Kconfig b/init/Kconfig --- a/init/Kconfig +++ b/init/Kconfig @@ -1613,10 +1613,10 @@ choice default CC_OPTIMIZE_FOR_PERFORMANCE config CC_OPTIMIZE_FOR_PERFORMANCE - bool "Optimize for performance (-O2)" + bool "Optimize for performance (-O3)" help This is the default optimization level for the kernel, building - with the "-O2" compiler flag for best performance and most + with the "-O3" compiler flag for best performance and most helpful compile-time warnings. config CC_OPTIMIZE_FOR_SIZE