Skip to content
Snippets Groups Projects
Commit d3f5f664 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'ipo' into 'master'

Inter procedural optimization

These patches enable inter procedural optimization for the GCC and
Intel compilers. They may also work for the LLVM/clang.

Further response to #104.

Matthieu, I tried these and didn't see any improvements.
Can you also check please.

See merge request !101
parents ad76757d 93c1a383
No related branches found
No related tags found
1 merge request!136Master
# This file is part of SWIFT. # This file is part of SWIFT.
# Copyright (C) 2012 pedro.gonnet@durham.ac.uk. # Copyright (C) 2012 pedro.gonnet@durham.ac.uk.
# 2016 p.w.draper@durham.ac.uk.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -37,13 +38,43 @@ AM_PROG_CC_C_O ...@@ -37,13 +38,43 @@ AM_PROG_CC_C_O
# Enable POSIX and platform extension preprocessor macros. # Enable POSIX and platform extension preprocessor macros.
AC_USE_SYSTEM_EXTENSIONS AC_USE_SYSTEM_EXTENSIONS
# Add libtool support.
LT_INIT
# Check for compiler version and vendor. # Check for compiler version and vendor.
AX_COMPILER_VENDOR AX_COMPILER_VENDOR
AX_COMPILER_VERSION AX_COMPILER_VERSION
# Interprocedural optimization support. Needs special handling for linking and
# archiving as well as compilation with Intels, needs to be done before
# libtool is configured (to use correct LD).
AC_ARG_ENABLE([ipo],
[AS_HELP_STRING([--enable-ipo],
[Enable interprocedural optimization @<:@no/yes@:>@]
)],
[enable_ipo="$enableval"],
[enable_ipo="no"]
)
if test "$enable_ipo" = "yes"; then
if test "$ax_cv_c_compiler_vendor" = "intel"; then
CFLAGS="$CFLAGS -ip -ipo"
LDFLAGS="$LDFLAGS -ipo"
: ${AR="xiar"}
: ${LD="xild"}
AC_MSG_RESULT([added Intel interprocedural optimization support])
elif test "$ax_cv_c_compiler_vendor" = "gnu"; then
CFLAGS="$CFLAGS -flto"
LDFLAGS="$LDFLAGS -flto"
AC_MSG_RESULT([added GCC interprocedural optimization support])
elif test "$ax_cv_c_compiler_vendor" = "clang"; then
CFLAGS="$CFLAGS -emit-llvm"
AC_MSG_RESULT([added LLVM interprocedural optimization support])
else
AC_MSG_WARN([Compiler does not support interprocedural optimization])
fi
fi
# Add libtool support.
LT_INIT
# Check for MPI. Need to do this before characterising the compiler (C99 mode), # Check for MPI. Need to do this before characterising the compiler (C99 mode),
# as this changes the compiler. # as this changes the compiler.
# We should consider using AX_PROG_CC_MPI to replace AC_PROG_CC when compiling # We should consider using AX_PROG_CC_MPI to replace AC_PROG_CC when compiling
...@@ -179,6 +210,7 @@ if test "$enable_san" = "yes"; then ...@@ -179,6 +210,7 @@ if test "$enable_san" = "yes"; then
fi fi
if test "$enable_san" = "yes"; then if test "$enable_san" = "yes"; then
CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer" CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer"
AC_MSG_RESULT([added address sanitizer support])
else else
AC_MSG_WARN([Compiler does not support address sanitizer option]) AC_MSG_WARN([Compiler does not support address sanitizer option])
fi fi
...@@ -320,12 +352,12 @@ AC_ARG_ENABLE([compiler-warnings], ...@@ -320,12 +352,12 @@ AC_ARG_ENABLE([compiler-warnings],
if test "$enable_warn" != "no"; then if test "$enable_warn" != "no"; then
AX_CFLAGS_WARN_ALL AX_CFLAGS_WARN_ALL
if test "$enable_warn" = "error"; then if test "$enable_warn" = "error"; then
case "$ax_cv_c_compiler_vendor" in case "$ax_cv_c_compiler_vendor" in
intel | gnu ) intel | gnu )
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Werror"
;; ;;
esac esac
fi fi
fi fi
# Check for git, needed for revision stamps. # Check for git, needed for revision stamps.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment