From ceba42cff9cb0cb384bb67b865ad58498122afe5 Mon Sep 17 00:00:00 2001 From: "Carlos Jimenez (JavaShin-X)" Date: Mon, 3 Jan 2022 14:12:15 +0530 Subject: [PATCH] Makefile: Rework on Polly optimizer flags Commits that have been squashed are as follows: 1. https://github.com/javashin/Xiaomi-Fury-Bengal-SD662/commit/d569f7e09fabd8e0e0a42ba0860f1f756b88d423 2. https://github.com/javashin/Xiaomi-Fury-Bengal-SD662/commit/24a11f1008dc0c96a36c1ec695ecf7e872b1fc4f 3. https://github.com/javashin/Xiaomi-Fury-Bengal-SD662/commit/50e16d01b46ddbb13f7d0bd1acaf3539c5427555 4. https://github.com/javashin/Xiaomi-Fury-Bengal-SD662/commit/86fb97a73bc5bcb559cb6d409a041d1859d5b101 [ Tashar02: Conditionally place the flags as they are only supported by clang greater than version 13.0.0 ] Signed-off-by: Dakkshesh Co-authored-by: Tashfin Shakeer Rhythm Signed-off-by: Tashfin Shakeer Rhythm Signed-off-by: Divyanshu-Modi Signed-off-by: Adithya R --- Makefile | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) 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