Add a build target for bolt-optimized ldc?
JohanEngelen opened this issue · 4 comments
JohanEngelen commented
See this for clang: https://reviews.llvm.org/rG3dab7fede201
JohanEngelen commented
The following optimization of ldc2
with llvm-bolt
results in a 3%-4% faster build time (-O0
) at Weka.
# Instrument LDC
/usr/local/bin/llvm-bolt bin/ldc2 -instrument -o bin/ldc2_instr -instrumentation-file=bolt_profile.fdata
# Run workload which generates a profile
bin/ldc2_instr -c -of=dummy.o include/d/std/*.d include/d/std/regex/*.d include/d/std/regex/internal/*.d -d-version=StdUnittest -unittest -dip1000
# Use the profile to let llvm-bolt optimize our binary
/usr/local/bin/llvm-bolt bin/ldc2 -o bin/ldc2.bolt -data=bolt_profile.fdata \
-reorder-blocks=cache+ -reorder-functions=hfsort+ -split-functions=3 -split-all-cold -icf -split-eh -dyno-stats
kinke commented
That sounds like it might be worth it. Which ldc2
executable did you use exactly? One from an official release, already using LTO+PGO?
JohanEngelen commented
That sounds like it might be worth it. Which
ldc2
executable did you use exactly? One from an official release, already using LTO+PGO?
Forgot to mention, it is on self-built binary with LTO+PGO. (ThinLTO in fact, including LLVM LTO libraries)
kinke commented
including LLVM LTO libraries
Oh wow! :D - I tried that once, took ages and resulted in no measurable performance gains IIRC.