Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a build target for bolt-optimized ldc? #4228

Open
JohanEngelen opened this issue Sep 26, 2022 · 4 comments
Open

Add a build target for bolt-optimized ldc? #4228

JohanEngelen opened this issue Sep 26, 2022 · 4 comments

Comments

@JohanEngelen
Copy link
Member

See this for clang: https://reviews.llvm.org/rG3dab7fede201

@JohanEngelen
Copy link
Member Author

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
Copy link
Member

kinke commented Dec 1, 2022

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
Copy link
Member Author

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
Copy link
Member

kinke commented Dec 1, 2022

including LLVM LTO libraries

Oh wow! :D - I tried that once, took ages and resulted in no measurable performance gains IIRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants