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
|
||||
CXXCOMPILER: clang++-15
|
||||
CUCUMBER_TIMEOUT: 60000
|
||||
ENABLE_LTO: OFF
|
||||
|
||||
- name: clang-15-debug
|
||||
continue-on-error: false
|
||||
@ -210,6 +211,7 @@ jobs:
|
||||
CCOMPILER: clang-15
|
||||
CXXCOMPILER: clang++-15
|
||||
CUCUMBER_TIMEOUT: 60000
|
||||
ENABLE_LTO: OFF
|
||||
|
||||
- name: clang-18-debug-clang-tidy
|
||||
continue-on-error: false
|
||||
@ -232,6 +234,7 @@ jobs:
|
||||
CCOMPILER: clang-14
|
||||
CXXCOMPILER: clang++-14
|
||||
CUCUMBER_TIMEOUT: 60000
|
||||
ENABLE_LTO: OFF
|
||||
|
||||
- name: clang-13-release
|
||||
continue-on-error: false
|
||||
@ -242,6 +245,7 @@ jobs:
|
||||
CCOMPILER: clang-13
|
||||
CXXCOMPILER: clang++-13
|
||||
CUCUMBER_TIMEOUT: 60000
|
||||
ENABLE_LTO: OFF
|
||||
|
||||
- name: conan-linux-debug-asan-ubsan
|
||||
continue-on-error: false
|
||||
@ -253,6 +257,7 @@ jobs:
|
||||
CXXCOMPILER: clang++-15
|
||||
ENABLE_CONAN: ON
|
||||
ENABLE_SANITIZER: ON
|
||||
ENABLE_LTO: OFF
|
||||
|
||||
- name: conan-linux-release
|
||||
continue-on-error: false
|
||||
@ -263,6 +268,7 @@ jobs:
|
||||
CCOMPILER: clang-15
|
||||
CXXCOMPILER: clang++-15
|
||||
ENABLE_CONAN: ON
|
||||
ENABLE_LTO: OFF
|
||||
|
||||
- name: gcc-14-release
|
||||
continue-on-error: false
|
||||
@ -361,6 +367,7 @@ jobs:
|
||||
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
|
||||
OSRM_CONNECTION_RETRIES: ${{ matrix.OSRM_CONNECTION_RETRIES }}
|
||||
OSRM_CONNECTION_EXP_BACKOFF_COEF: ${{ matrix.OSRM_CONNECTION_EXP_BACKOFF_COEF }}
|
||||
ENABLE_LTO: ${{ matrix.ENABLE_LTO }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build machine architecture
|
||||
@ -521,6 +528,7 @@ jobs:
|
||||
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
|
||||
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
|
||||
-DENABLE_CCACHE=ON \
|
||||
-DENABLE_LTO=${ENABLE_LTO:-ON} \
|
||||
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
|
||||
make --jobs=${JOBS}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
- NodeJS:
|
||||
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
|
||||
- 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: 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)
|
||||
|
@ -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_COVERAGE "Build with coverage instrumentalisation" 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_NODE_BINDINGS "Build NodeJs bindings" OFF)
|
||||
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
|
||||
|
||||
|
||||
if (ENABLE_CLANG_TIDY)
|
||||
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
|
||||
if(NOT CLANG_TIDY_COMMAND)
|
||||
@ -57,6 +58,18 @@ if (POLICY CMP0074)
|
||||
endif()
|
||||
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
|
||||
if (APPLE)
|
||||
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")
|
||||
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 "")
|
||||
if (ENABLE_COVERAGE)
|
||||
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")
|
||||
set_property(TARGET MICROTAR PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
target_no_warning(MICROTAR unused-variable)
|
||||
target_no_warning(MICROTAR format)
|
||||
|
||||
|
@ -64,7 +64,6 @@ add_warning(init-self)
|
||||
add_warning(bool-compare)
|
||||
add_warning(logical-not-parentheses)
|
||||
add_warning(logical-op)
|
||||
add_warning(maybe-uninitialized)
|
||||
add_warning(misleading-indentation)
|
||||
# `no-` prefix is part of warning name(i.e. doesn't mean we are disabling it)
|
||||
add_warning(no-return-local-addr)
|
||||
@ -84,3 +83,6 @@ no_warning(comma-subscript)
|
||||
no_warning(ambiguous-reversed-operator)
|
||||
no_warning(restrict)
|
||||
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 *"-assertions"*) BUILD_TYPE="RelWithDebInfo" && ENABLE_ASSERTIONS="On" && BUILD_TOOLS="On";; esac && \
|
||||
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 && \
|
||||
cd ../profiles && \
|
||||
cp -r * /opt && \
|
||||
|
@ -21,7 +21,7 @@ COPY . /src
|
||||
WORKDIR /src
|
||||
|
||||
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}" && \
|
||||
git show --format="%H" | head -n1 > /opt/OSRM_GITSHA && \
|
||||
echo "Building OSRM gitsha $(cat /opt/OSRM_GITSHA)" && \
|
||||
|
@ -62,7 +62,7 @@ SET test_region_ch=ch\monaco
|
||||
SET test_region_corech=corech\monaco
|
||||
SET test_region_mld=mld\monaco
|
||||
SET test_osm=%test_region%.osm.pbf
|
||||
COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm%
|
||||
COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm%
|
||||
%CONFIGURATION%\osrm-extract.exe -p %PROJECT_DIR%\profiles\car.lua %test_osm%
|
||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <vector>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if (_MSC_VER >= 1928)
|
||||
#ifdef _DEBUG
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
@ -37,8 +35,6 @@ const ByEdgeOrByMeterValue::ValueByMeter ByEdgeOrByMeterValue::by_meter;
|
||||
} // namespace extractor
|
||||
} // namespace osrm
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace osrm::extractor
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user