diff --git a/Makefile b/Makefile index 06d5c3560f50..0db5ed3986d1 100755 --- a/Makefile +++ b/Makefile @@ -765,6 +765,16 @@ else KBUILD_CFLAGS += -O3 endif +ifdef CONFIG_LLVM_POLLY +KBUILD_CFLAGS += -mllvm -polly \ + -mllvm -polly-run-inliner \ + -mllvm -polly-opt-fusion=max \ + -mllvm -polly-ast-use-context \ + -mllvm -polly-detect-keep-going \ + -mllvm -polly-vectorizer=stripmine \ + -mllvm -polly-invariant-load-hoisting +endif + # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) diff --git a/arch/Kconfig b/arch/Kconfig index 73564ba7ab31..0f7f9dba731a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -754,6 +754,14 @@ 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)" + 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