Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add LTO support (full and thin), with `-flto=thin|full`. #1840
LTO needs linker support: I am only aware of support on OS X and Linux (through the LLVMgold plugin).
I chose the cmdline option
Resolves #693 .
Yes, using clang's options seems like the obvious choice.
Only have a vague idea what this fthinlto-index option is, also see [ThinLTO] Option to invoke ThinLTO backend passes and importing.
Bug : When there are module ctors/dtors in different modules, not all of them are run :(
Edit: I think I found the cause. There is a latent bug in our llvm.used emission. ThinLTO is very aggressively optimizing and thus things break. Working on a fix. (edit: #1855)
Edit2: nice! With that fix, I managed to build LDC with LTO, mixing C++ and D LTO! In other words: cross-language cross-module inlining.