Use Link Time Optimisation whenever possible (#6967)
This commit is contained in:
parent
bdc6ed8a53
commit
d0ed29adb7
8
.github/workflows/osrm-backend.yml
vendored
8
.github/workflows/osrm-backend.yml
vendored
@ -200,6 +200,7 @@ jobs:
|
|||||||
CCOMPILER: clang-15
|
CCOMPILER: clang-15
|
||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: clang++-15
|
||||||
CUCUMBER_TIMEOUT: 60000
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_LTO: OFF
|
||||||
|
|
||||||
- name: clang-15-debug
|
- name: clang-15-debug
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
@ -210,6 +211,7 @@ jobs:
|
|||||||
CCOMPILER: clang-15
|
CCOMPILER: clang-15
|
||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: clang++-15
|
||||||
CUCUMBER_TIMEOUT: 60000
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_LTO: OFF
|
||||||
|
|
||||||
- name: clang-18-debug-clang-tidy
|
- name: clang-18-debug-clang-tidy
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
@ -232,6 +234,7 @@ jobs:
|
|||||||
CCOMPILER: clang-14
|
CCOMPILER: clang-14
|
||||||
CXXCOMPILER: clang++-14
|
CXXCOMPILER: clang++-14
|
||||||
CUCUMBER_TIMEOUT: 60000
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_LTO: OFF
|
||||||
|
|
||||||
- name: clang-13-release
|
- name: clang-13-release
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
@ -242,6 +245,7 @@ jobs:
|
|||||||
CCOMPILER: clang-13
|
CCOMPILER: clang-13
|
||||||
CXXCOMPILER: clang++-13
|
CXXCOMPILER: clang++-13
|
||||||
CUCUMBER_TIMEOUT: 60000
|
CUCUMBER_TIMEOUT: 60000
|
||||||
|
ENABLE_LTO: OFF
|
||||||
|
|
||||||
- name: conan-linux-debug-asan-ubsan
|
- name: conan-linux-debug-asan-ubsan
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
@ -253,6 +257,7 @@ jobs:
|
|||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: clang++-15
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
ENABLE_SANITIZER: ON
|
ENABLE_SANITIZER: ON
|
||||||
|
ENABLE_LTO: OFF
|
||||||
|
|
||||||
- name: conan-linux-release
|
- name: conan-linux-release
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
@ -263,6 +268,7 @@ jobs:
|
|||||||
CCOMPILER: clang-15
|
CCOMPILER: clang-15
|
||||||
CXXCOMPILER: clang++-15
|
CXXCOMPILER: clang++-15
|
||||||
ENABLE_CONAN: ON
|
ENABLE_CONAN: ON
|
||||||
|
ENABLE_LTO: OFF
|
||||||
|
|
||||||
- name: gcc-14-release
|
- name: gcc-14-release
|
||||||
continue-on-error: false
|
continue-on-error: false
|
||||||
@ -361,6 +367,7 @@ jobs:
|
|||||||
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
|
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
|
||||||
OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }}
|
OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }}
|
||||||
OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }}
|
OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }}
|
||||||
|
ENABLE_LTO: ${{ matrix.ENABLE_LTO }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build machine architecture
|
- name: Build machine architecture
|
||||||
@ -521,6 +528,7 @@ jobs:
|
|||||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||||
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
|
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
|
||||||
-DENABLE_CCACHE=ON \
|
-DENABLE_CCACHE=ON \
|
||||||
|
-DENABLE_LTO=${ENABLE_LTO:-ON} \
|
||||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
||||||
make --jobs=${JOBS}
|
make --jobs=${JOBS}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
- NodeJS:
|
- NodeJS:
|
||||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||||
- Misc:
|
- Misc:
|
||||||
|
- CHANGED: Use Link Time Optimisation whenever possible. [#6967](https://github.com/Project-OSRM/osrm-backend/pull/6967)
|
||||||
- CHANGED: Use struct instead of tuple to define UnpackedPath. [#6974](https://github.com/Project-OSRM/osrm-backend/pull/6974)
|
- CHANGED: Use struct instead of tuple to define UnpackedPath. [#6974](https://github.com/Project-OSRM/osrm-backend/pull/6974)
|
||||||
- CHANGED: Micro performance optimisation in map matching. [#6976](https://github.com/Project-OSRM/osrm-backend/pull/6976)
|
- CHANGED: Micro performance optimisation in map matching. [#6976](https://github.com/Project-OSRM/osrm-backend/pull/6976)
|
||||||
- CHANGED: Re-use priority queue in StaticRTree. [#6952](https://github.com/Project-OSRM/osrm-backend/pull/6952)
|
- CHANGED: Re-use priority queue in StaticRTree. [#6952](https://github.com/Project-OSRM/osrm-backend/pull/6952)
|
||||||
|
@ -31,11 +31,12 @@ option(ENABLE_ASSERTIONS "Use assertions in release mode" OFF)
|
|||||||
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
|
option(ENABLE_DEBUG_LOGGING "Use debug logging in release mode" OFF)
|
||||||
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)
|
||||||
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
option(ENABLE_SANITIZER "Use memory sanitizer for Debug build" OFF)
|
||||||
option(ENABLE_LTO "Use LTO if available" OFF)
|
option(ENABLE_LTO "Use Link Time Optimisation" ON)
|
||||||
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
option(ENABLE_FUZZING "Fuzz testing using LLVM's libFuzzer" OFF)
|
||||||
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
||||||
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
||||||
|
|
||||||
|
|
||||||
if (ENABLE_CLANG_TIDY)
|
if (ENABLE_CLANG_TIDY)
|
||||||
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
|
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
|
||||||
if(NOT CLANG_TIDY_COMMAND)
|
if(NOT CLANG_TIDY_COMMAND)
|
||||||
@ -57,6 +58,18 @@ if (POLICY CMP0074)
|
|||||||
endif()
|
endif()
|
||||||
project(OSRM C CXX)
|
project(OSRM C CXX)
|
||||||
|
|
||||||
|
|
||||||
|
if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
||||||
|
if(LTO_SUPPORTED)
|
||||||
|
message(STATUS "IPO / LTO enabled")
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "IPO / LTO not supported: <${error}>")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# add @loader_path/$ORIGIN to rpath to make binaries relocatable
|
# add @loader_path/$ORIGIN to rpath to make binaries relocatable
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(CMAKE_BUILD_RPATH "@loader_path")
|
set(CMAKE_BUILD_RPATH "@loader_path")
|
||||||
@ -208,17 +221,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_LTO AND (CMAKE_BUILD_TYPE MATCHES Release OR CMAKE_BUILD_TYPE MATCHES MinRelSize OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo))
|
|
||||||
include(CheckIPOSupported)
|
|
||||||
check_ipo_supported(RESULT LTO_SUPPORTED OUTPUT error)
|
|
||||||
if(LTO_SUPPORTED)
|
|
||||||
message(STATUS "IPO / LTO enabled")
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
||||||
else()
|
|
||||||
message(WARNING "IPO / LTO not supported: <${error}>")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(MAYBE_COVERAGE_LIBRARIES "")
|
set(MAYBE_COVERAGE_LIBRARIES "")
|
||||||
if (ENABLE_COVERAGE)
|
if (ENABLE_COVERAGE)
|
||||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
if (NOT CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
@ -290,6 +292,7 @@ include_directories(SYSTEM ${MICROTAR_INCLUDE_DIR})
|
|||||||
|
|
||||||
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
|
add_library(MICROTAR OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/microtar/src/microtar.c")
|
||||||
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
target_no_warning(MICROTAR unused-variable)
|
target_no_warning(MICROTAR unused-variable)
|
||||||
target_no_warning(MICROTAR format)
|
target_no_warning(MICROTAR format)
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ add_warning(init-self)
|
|||||||
add_warning(bool-compare)
|
add_warning(bool-compare)
|
||||||
add_warning(logical-not-parentheses)
|
add_warning(logical-not-parentheses)
|
||||||
add_warning(logical-op)
|
add_warning(logical-op)
|
||||||
add_warning(maybe-uninitialized)
|
|
||||||
add_warning(misleading-indentation)
|
add_warning(misleading-indentation)
|
||||||
# `no-` prefix is part of warning name(i.e. doesn't mean we are disabling it)
|
# `no-` prefix is part of warning name(i.e. doesn't mean we are disabling it)
|
||||||
add_warning(no-return-local-addr)
|
add_warning(no-return-local-addr)
|
||||||
@ -84,3 +83,6 @@ no_warning(comma-subscript)
|
|||||||
no_warning(ambiguous-reversed-operator)
|
no_warning(ambiguous-reversed-operator)
|
||||||
no_warning(restrict)
|
no_warning(restrict)
|
||||||
no_warning(free-nonheap-object)
|
no_warning(free-nonheap-object)
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
|
no_warning(stringop-overflow)
|
||||||
|
endif()
|
@ -31,7 +31,7 @@ RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
|||||||
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
|
case ${DOCKER_TAG} in *"-debug"*) BUILD_TYPE="Debug";; esac && \
|
||||||
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
|
case ${DOCKER_TAG} in *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
|
||||||
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
|
echo "Building ${BUILD_TYPE} with ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} BUILD_TOOLS=${BUILD_TOOLS}" && \
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=On && \
|
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS} -DBUILD_TOOLS=${BUILD_TOOLS} -DENABLE_LTO=OFF && \
|
||||||
make -j${NPROC} install && \
|
make -j${NPROC} install && \
|
||||||
cd ../profiles && \
|
cd ../profiles && \
|
||||||
cp -r * /opt && \
|
cp -r * /opt && \
|
||||||
|
@ -21,7 +21,7 @@ COPY . /src
|
|||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
RUN NPROC=${BUILD_CONCURRENCY:-$(nproc)} && \
|
||||||
export CXXFLAGS="-Wno-array-bounds -Wno-uninitialized" && \
|
export CXXFLAGS="-Wno-array-bounds -Wno-uninitialized -Wno-stringop-overflow" && \
|
||||||
echo "Building OSRM ${DOCKER_TAG}" && \
|
echo "Building OSRM ${DOCKER_TAG}" && \
|
||||||
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
||||||
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#if (_MSC_VER >= 1928)
|
|
||||||
#ifdef _DEBUG
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
namespace extractor
|
namespace extractor
|
||||||
@ -37,8 +35,6 @@ const ByEdgeOrByMeterValue::ValueByMeter ByEdgeOrByMeterValue::by_meter;
|
|||||||
} // namespace extractor
|
} // namespace extractor
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace osrm::extractor
|
namespace osrm::extractor
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user