diff --git a/Makefile b/Makefile index aa4eb694c..5f4cb6fe4 100755 --- a/Makefile +++ b/Makefile @@ -808,6 +808,16 @@ else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os 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 a31288fca..d18ee26fc 100755 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -738,6 +738,14 @@ config CFI_PERMISSIVE warning instead of a kernel panic. This option is useful for finding CFI violations during development. +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