Skip to content

Commit

Permalink
[use same LTO mode for instrumented & PGO'd build]
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed May 17, 2022
1 parent c3a5dc9 commit 21e425f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/actions/2a-build-pgo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ inputs:
extra_d_flags: # applying to the D executables, not the runtime
required: false
default: ''
lto_mode: # full | thin | none
required: false
default: full
arch:
required: false # Windows only
runs:
Expand All @@ -18,10 +21,11 @@ runs:
cmake_flags: >-
-DBUILD_SHARED_LIBS=OFF
"-DDFLAGS_LDC=-fprofile-generate -vp-counters-per-site=1.5"
-DEXTRA_CXXFLAGS=-fprofile-instr-generate
${{ runner.os == 'Linux' && '-DCMAKE_C_COMPILER="$PWD/../clang/bin/clang"' || '' }}
${{ runner.os == 'Linux' && '-DCMAKE_CXX_COMPILER="$PWD/../clang/bin/clang++"' || '' }}
extra_d_flags: ${{ inputs.extra_d_flags }}
extra_cxx_flags: -fprofile-instr-generate
lto_mode: ${{ inputs.lto_mode }}
arch: ${{ inputs.arch }}
env:
LLVM_PROFILE_FILE: ${{ github.workspace }}/../pgo-ldc/%p.profraw
Expand Down
5 changes: 4 additions & 1 deletion .github/actions/helper-build-ldc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ inputs:
extra_d_flags: # applying to the D executables, not the runtime
required: false
default: ''
extra_cxx_flags: # for the ldc2 executable
required: false
default: ''
with_mimalloc:
required: false
default: false
Expand Down Expand Up @@ -48,7 +51,7 @@ runs:
fi
d_flags=(${{ inputs.extra_d_flags }})
cxx_flags=()
cxx_flags=(${{ inputs.extra_cxx_flags }})
if [[ "$lto_mode" != none ]]; then
d_flags+=(-O -flto="$lto_mode" -defaultlib=phobos2-ldc-lto,druntime-ldc-lto)
cxx_flags+=(-flto="$lto_mode")
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
uses: ./.github/actions/2a-build-pgo
with:
extra_d_flags: ${{ matrix.extra_d_flags }}
lto_mode: ${{ matrix.lto_mode || 'full' }}
arch: ${{ matrix.arch }}
- name: Build LDC & LDC D unittests & defaultlib unittest runners
uses: ./.github/actions/3-build-native
Expand Down Expand Up @@ -176,6 +177,7 @@ jobs:
uses: ./.github/actions/2a-build-pgo
with:
extra_d_flags: ${{ matrix.extra_bootstrap_d_flags }}
lto_mode: ${{ matrix.lto_mode || 'none' }}
- name: Cross-compile LDC to ${{ matrix.os }}-${{ matrix.arch }}
uses: ./.github/actions/3-build-cross
with:
Expand Down

0 comments on commit 21e425f

Please sign in to comment.