[Mesa-dev] [PATCH] mesa: Enable LTO compilation

Pierre Moreau pierre.morrow at free.fr
Mon May 30 18:07:51 UTC 2016


On 07:28 PM - May 30 2016, ⚛ wrote:
> This patch enables compilation with -flto.
> 
> The performance benefits of LTO (GCC 4.9 & 6.1) are about 1% for glxgears.
> Performance changes in OpenGL games haven't been measured yet, my feeling
> is that they are negligible.

> diff --git a/configure.ac b/configure.ac
> index fc0b1db..e84a1ad 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -362,6 +362,8 @@ if test "x$GXX" = xyes; then
>      CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
>  fi
>  
> +AX_CHECK_COMPILE_FLAG([-flto], AM_CONDITIONAL(COMPILER_UNDERSTANDS_LTO, true), AM_CONDITIONAL(COMPILER_UNDERSTANDS_LTO, false))
> +
>  AC_SUBST([MSVC2013_COMPAT_CFLAGS])
>  AC_SUBST([MSVC2013_COMPAT_CXXFLAGS])
>  
> diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
> index 68a28a2..4b7d266 100644
> --- a/src/mapi/Makefile.am
> +++ b/src/mapi/Makefile.am
> @@ -51,6 +51,11 @@ AM_CPPFLAGS =							\
>  
>  include Makefile.sources
>  
> +if COMPILER_UNDERSTANDS_LTO
> +CFLAGS += -fno-lto
> +CXXFLAGS += -fno-lto

This should be `-flto` if I’m not mistaken.

Pierre

> +endif
> +
>  MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
>  PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
>  

> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160530/f468167c/attachment.sig>


More information about the mesa-dev mailing list