From 5595141e25722c703d252c6908602deb9d3cb13f Mon Sep 17 00:00:00 2001 From: Tomasz Konojacki Date: Mon, 14 Oct 2024 00:35:30 +0200 Subject: [PATCH] win32/Makefile: update compilation flags for Visual C++ Makefile contains the following comment from 2002: # -O1 yields smaller code, which turns out to be faster than -O2 Visual C++ documentation says that -O2 "creates fast code", while -O1 "creates small code". It's unlikely that, after 20 years, -O2 still generates worse code. If it does, it should be reported to Microsoft. Also added -Gw (optimize global data). --- win32/GNUmakefile | 3 +-- win32/Makefile | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/win32/GNUmakefile b/win32/GNUmakefile index 5b9957fe5354..ea54e7ace7b1 100644 --- a/win32/GNUmakefile +++ b/win32/GNUmakefile @@ -697,8 +697,7 @@ EXTRACFLAGS += -MDd else # Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG). -# -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64 -OPTIMIZE = -O1 -Zi -GL +OPTIMIZE = -O2 -Zi -GL -Gw # we enable debug symbols in release builds also LINK_DBG = -debug -opt:ref,icf -ltcg # you may want to enable this if you want COFF symbols in the executables diff --git a/win32/Makefile b/win32/Makefile index e4882bc36b42..9974b4118cb2 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -455,8 +455,7 @@ DEFINES = $(DEFINES) -D_DEBUG -DDEBUGGING EXTRACFLAGS = $(EXTRACFLAGS) -MDd !ELSE # Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG). -# -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64 -OPTIMIZE = -O1 -Zi -GL +OPTIMIZE = -O2 -Zi -GL -Gw # we enable debug symbols in release builds also LINK_DBG = -debug -opt:ref,icf -ltcg # you may want to enable this if you want COFF symbols in the executables