ThinLTO on OS X!
Johan Engelen via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Wed Oct 26 06:52:13 PDT 2016
On Tuesday, 27 September 2016 at 18:52:46 UTC, Johan Engelen
wrote:
> Hi all,
> The new XCode 8 features LLVM's ThinLTO in the linker. With
> some patching in LDC, I got it to work pretty easily.
A brief update.
So there were a number of issues to be straightened out, some in
LDC, some in LLVM, but now I think things are starting to look
good for LTO :)
What is super cool is that when you have mixed C++/D source, and
are using Clang/LDC, you get cross-language inlining with LTO! ^_^
<file b.cpp>
```
void doesNothing() {}
```
<file a.d>
```
extern(C++) void doesNothing(); // declaration only
void main() {
for (ulong i = 0; i < 100_000_000; ++i) {
doesNothing();
}
}
```
The runtime is zero of the program when using `flto=thin` for
both clang and LDC.
Without LTO, it takes a few seconds.
cheers,
Johan
More information about the digitalmars-d-ldc
mailing list