Skip to content

Commit

Permalink
Disable Thin LTO when using Clang.
Browse files Browse the repository at this point in the history
The default Clang configuration uses ThinLTO instead of the standard
LTO. When published, benchmarks already showed this to be inferior for
chess engines:
http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html

Benchmarking with current Clang 12 shows that the above result still holds
and ThinLTO is a pessimization, see issue official-stockfish#3341.

The commit that added ThinLTO did not contain any benchmarking. While
ThinLTO may compile faster, that's not a worthwhile tradeoff for a chess
engine. With ThinLTO disabled, Clang 12 will outperform GCC 9 and 10 for
some architectures, e.g. Intel Haswell.
  • Loading branch information
gcp committed Feb 9, 2021
1 parent 29ed22d commit 921df56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ endif
ifeq ($(optimize),yes)
ifeq ($(debug), no)
ifeq ($(comp),clang)
CXXFLAGS += -flto=thin
CXXFLAGS += -flto
ifneq ($(findstring MINGW,$(KERNEL)),)
CXXFLAGS += -fuse-ld=lld
else ifneq ($(findstring MSYS,$(KERNEL)),)
Expand All @@ -608,7 +608,7 @@ ifeq ($(debug), no)
LDFLAGS += -save-temps
endif
else
CXXFLAGS += -flto=thin
CXXFLAGS += -flto
LDFLAGS += $(CXXFLAGS)
endif

Expand Down

0 comments on commit 921df56

Please sign in to comment.