diff --git a/Makefile b/Makefile index 5f4cb6fe4..d077be0e6 100755 --- a/Makefile +++ b/Makefile @@ -811,11 +811,30 @@ 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 + -mllvm -polly-invariant-load-hoisting \ + -mllvm -polly-vectorizer=stripmine + +ifeq ($(shell test $(CONFIG_CLANG_VERSION) -gt 130000; echo $$?),0) +KBUILD_CFLAGS += -mllvm -polly-loopfusion-greedy=1 \ + -mllvm -polly-reschedule=1 \ + -mllvm -polly-postopts=1 \ + -mllvm -polly-num-threads=0 \ + -mllvm -polly-omp-backend=LLVM \ + -mllvm -polly-scheduling=dynamic \ + -mllvm -polly-scheduling-chunksize=1 +else +KBUILD_CFLAGS += -mllvm -polly-opt-fusion=max +endif + +# 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 +POLLY_FLAGS += -mllvm -polly-run-dce +endif endif # Tell gcc to never replace conditional load with a non-conditional one