Skip to content

Commit

Permalink
Makefile: Enable store motion pass for gcse
Browse files Browse the repository at this point in the history
GCC enables global common subexpression elimination (-fgcse) with
-Os, -O2, -O3 optimisation levels. Enabling this flag runs a store
motion pass after gcse, which attempts to move the stores out of
loops. When used in conjunction with -fgcse-lm (load move, enabled
by default with -Os, -O2 and -O3 levels), loops with a load/store
sequence can be changed to a load before the loop and store after
the loop, hence improving loop code execution speed.

When enabled in conjunction with LTO and -fipa-pta, this yields a
marginally better hackbench score.
- Before: 47.6s
- After: 28.5s

Signed-off-by: Vaisakh Murali <[email protected]>
Signed-off-by: Cyber Knight <[email protected]>
  • Loading branch information
mvaisakh authored and cyberknight777 committed Jun 19, 2022
1 parent e96a529 commit 54c0714
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
# change __FILE__ to the relative path from the srctree
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)

# Use store motion pass for gcse
KBUILD_CFLAGS += $(call cc-option,-fgcse-sm)

# ensure -fcf-protection is disabled when using retpoline as it is
# incompatible with -mindirect-branch=thunk-extern
ifdef CONFIG_RETPOLINE
Expand Down

0 comments on commit 54c0714

Please sign in to comment.