Expand use and support for LTO and FDO builds
Adds LTO to the CI build for Linux, which bring it as close as possible to the planned formal release, which will additionally use FDO. Adds some helper scripts to work with FDO files. Improves the build notes for how to create and use FDO files.
This commit is contained in:
parent
0759165f45
commit
78ae277d28
9 changed files with 393 additions and 71 deletions
|
@ -3,10 +3,10 @@ cc="${ccache}clang${postfix}"
|
|||
cxx="${ccache}clang++${postfix}"
|
||||
|
||||
# Flag additions
|
||||
TYPES+=(debug warnmore profile)
|
||||
cflags_release=("${cflags[@]}" -Os)
|
||||
TYPES+=(debug warnmore pgotrain)
|
||||
cflags_release=("${cflags[@]}" -O3)
|
||||
cflags_debug=("${cflags[@]}" -g -fno-omit-frame-pointer)
|
||||
cflags_profile=("${cflags_debug[@]}" -fprofile-instr-generate -fcoverage-mapping)
|
||||
cflags_pgotrain=("${cflags_debug[@]}" -fprofile-instr-generate -fcoverage-mapping)
|
||||
cflags_warnmore=("${cflags_debug[@]}" -Wextra -Wshadow -Wcast-align -Wunused
|
||||
-Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion
|
||||
-Wdouble-promotion -Wformat=2)
|
||||
|
@ -19,5 +19,4 @@ fi
|
|||
|
||||
# Modifier additions
|
||||
MODIFIERS=(fdo)
|
||||
ldflags_fdo=(-fprofile-instr-generate)
|
||||
cflags_fdo=("-fprofile-sample-use=${FDO_FILE:-}")
|
||||
cflags_fdo=("-fprofile-sample-use=${FDO_FILE:-${repo_root}/current.afdo}")
|
||||
|
|
|
@ -6,18 +6,20 @@ ld="gcc${postfix}"
|
|||
ranlib="gcc-ranlib${postfix}"
|
||||
|
||||
# Flag additions
|
||||
TYPES+=(debug warnmore profile)
|
||||
TYPES+=(debug warnmore pgotrain fdotrain)
|
||||
|
||||
cflags+=(-fstack-protector -fdiagnostics-color=auto)
|
||||
cflags_debug=("${cflags[@]}" -g -fno-omit-frame-pointer)
|
||||
cflags_release=("${cflags[@]}" -Ofast -ffunction-sections -fdata-sections)
|
||||
cflags_profile=("${cflags_debug[@]}" -pg)
|
||||
cflags_release=("${cflags[@]}" -DNDEBUG -O3 -ffunction-sections -fdata-sections)
|
||||
cflags_pgotrain=("${cflags_debug[@]}" -pg)
|
||||
cflags_warnmore=("${cflags_debug[@]}" -pedantic -Wcast-align -Wdouble-promotion
|
||||
-Wduplicated-branches -Wduplicated-cond -Wextra -Wformat=2
|
||||
-Wlogical-op -Wmisleading-indentation -Wnull-dereference
|
||||
-Wshadow -Wunused)
|
||||
cxxonly_warnmore=(-Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wuseless-cast)
|
||||
cflags_fdotrain=("${cflags[@]}" -DNDEBUG -g1 -fno-omit-frame-pointer)
|
||||
|
||||
# Modifier additions
|
||||
MODIFIERS=(fdo)
|
||||
cflags_fdo=("-fauto-profile=${FDO_FILE:-}")
|
||||
# Override the prior optimization flag because O2 does better w/ feedback
|
||||
cflags_fdo=("-O2 -fauto-profile=${FDO_FILE:-${repo_root}/current.afdo}")
|
||||
|
|
|
@ -109,7 +109,10 @@ function perform_steps() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
cd "$(dirname "$0")/automator"
|
||||
cd "$(dirname "$0")"/..
|
||||
export repo_root
|
||||
repo_root="$PWD"
|
||||
cd scripts/automator
|
||||
if [[ -z "${data_dir:-}" ]]; then data_dir="$(basename "$0" '.sh')"; fi
|
||||
parse_args "$@"
|
||||
construct_environment
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue