Skip to content

Commit d381ec2

Browse files
authored
CI-unixish.yml: added profile-guided optimization (PGO) to callgrind step (#580)
1 parent 6ddb8c6 commit d381ec2

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

.github/workflows/CI-unixish.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ jobs:
4343
sudo apt-get update
4444
sudo apt-get install valgrind
4545
46+
# llvm contains llvm-profdata
4647
- name: Install missing software on ubuntu (clang++)
4748
if: contains(matrix.os, 'ubuntu') && matrix.compiler == 'clang++'
4849
run: |
4950
sudo apt-get update
50-
sudo apt-get install libc++-dev
51+
sudo apt-get install libc++-dev llvm
5152
5253
# coreutils contains "nproc"
5354
- name: Install missing software on macos
@@ -145,15 +146,34 @@ jobs:
145146
run: |
146147
wget https://github.com/danmar/simplecpp/archive/refs/tags/1.5.1.tar.gz
147148
tar xvf 1.5.1.tar.gz
149+
rm -f 1.5.1.tar.gz
150+
148151
make clean
149-
make -j$(nproc) CXXOPTS="-O2 -g3"
152+
make -j$(nproc) CXXOPTS="-O2 -g3" simplecpp
150153
VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind.log || (cat callgrind.log && false)
151154
cat callgrind.log
155+
156+
# PGO - start
157+
make clean
158+
make -j$(nproc) CXXOPTS="-O2 -g3 -fprofile-generate" LDOPTS="-fprofile-generate" simplecpp
159+
SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >/dev/null
160+
161+
if compgen -G "default_*.profraw" > /dev/null; then
162+
llvm-profdata merge -output=default.profdata default_*.profraw
163+
fi
164+
165+
make clean
166+
make -j$(nproc) CXXOPTS="-O2 -g3 -fprofile-use" LDOPTS="-fprofile-use" simplecpp
167+
VALGRIND_TOOL=callgrind SIMPLECPP_PATH=simplecpp-1.5.1 ./selfcheck.sh >callgrind_pgo.log || (cat callgrind_pgo.log && false)
168+
cat callgrind_pgo.log
169+
# PGO - end
170+
152171
for f in callgrind.out.*;
153172
do
154173
callgrind_annotate --auto=no $f > $f.annotated.log
155174
head -50 $f.annotated.log
156175
done
176+
rm -rf simplecpp-1.5.1
157177
158178
- uses: actions/upload-artifact@v4
159179
if: matrix.os == 'ubuntu-24.04'

0 commit comments

Comments
 (0)