From 9d3f982f526931f005c266cca72a802a59935914 Mon Sep 17 00:00:00 2001 From: krcroft Date: Sat, 11 Apr 2020 13:52:31 -0700 Subject: [PATCH] Enable strict aliasing for release builds --- .github/workflows/linux.yml | 5 ++++- .github/workflows/macos.yml | 2 +- scripts/automator/build/gcc-defaults | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a67ee298..f43605e3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -101,7 +101,10 @@ jobs: CXX: ccache g++ LD: gcc RANLIB: gcc-ranlib - FLAGS: -O3 -flto -ffunction-sections -fdata-sections -DNDEBUG -pipe + FLAGS: >- + -O3 -fstrict-aliasing -fno-signed-zeros -fno-trapping-math + -fassociative-math -mfpmath=sse -msse4.2 -flto -ffunction-sections + -fdata-sections -DNDEBUG -pipe LINKFLAGS: -Wl,--as-needed run: | set -x diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 95aaf596..547d6ec4 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -58,7 +58,7 @@ jobs: env: CC: ccache clang CXX: ccache clang++ - FLAGS: -O3 -DNDEBUG -pipe -march=nehalem + FLAGS: -DNDEBUG -O3 -fno-math-errno -fstrict-aliasing -march=nehalem -flto=thin -pipe steps: - uses: actions/checkout@v1 - name: Install C++ compiler and libraries diff --git a/scripts/automator/build/gcc-defaults b/scripts/automator/build/gcc-defaults index d4ac7988..a0ea354b 100644 --- a/scripts/automator/build/gcc-defaults +++ b/scripts/automator/build/gcc-defaults @@ -15,7 +15,7 @@ cflags_debug+=("${cflags[@]}" -g -fno-omit-frame-pointer) # Note: associative-math is needed for vectorization of floating point # calculations, which also relies on no-signed-zeros and # no-trapping-math. -cflags_release+=("${cflags[@]}" -DNDEBUG -O3 -fno-strict-aliasing +cflags_release+=("${cflags[@]}" -DNDEBUG -O3 -fstrict-aliasing -fno-signed-zeros -fno-trapping-math -fassociative-math -frename-registers -ffunction-sections -fdata-sections) cflags_pgotrain+=("${cflags_debug[@]}" -pg -ftree-vectorize)