kbuild: Add support for Clang's polyhedral loop optimizer

* Default N
This commit is contained in:
Diab Neiroukh 2023-01-28 23:06:24 +01:00 committed by rsuntk
parent 032c56014f
commit d8b5868b62
2 changed files with 24 additions and 0 deletions

View file

@ -721,6 +721,21 @@ KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
$(call cc-option,-fno-partial-inlining)
endif
ifdef CONFIG_LLVM_POLLY
KBUILD_CFLAGS += -mllvm -polly \
-mllvm -polly-ast-use-context \
-mllvm -polly-invariant-load-hoisting \
-mllvm -polly-run-inliner \
-mllvm -polly-vectorizer=stripmine
# Polly may optimise loops with dead paths beyound what the linker
# # can understand. This may negate the effect of the linker's DCE
# # so we tell Polly to perfom proven DCE on the loops it optimises
# # in order to preserve the overall effect of the linker's DCE.
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
KBUILD_CFLAGS += -mllvm -polly-run-dce
endif
endif
ifneq ($(CONFIG_FRAME_WARN),0)
KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
endif

View file

@ -594,6 +594,15 @@ config SHADOW_CALL_STACK_VMAP
provides better stack exhaustion protection, but increases per-thread
memory consumption as a full page is allocated for each shadow stack.
config LLVM_POLLY
bool "Enable LLVM's polyhedral loop optimizer (Polly)"
default n
help
This option enables LLVM's polyhedral loop optimizer known as Polly.
Polly is able to optimize various loops throughout the kernel for
maximum cache locality. This requires an LLVM toolchain explicitly
compiled with Polly support.
config HAVE_ARCH_WITHIN_STACK_FRAMES
bool
help