Hi Kai,
> For me, it looks like optimizer.cpp duplicates a lot of
> lib/Transform/IPO/PassManagerBuilder.cpp from LLVM. Is there a good reason
> not to use this builder? (E.g. clang does use it!)
No, there is no reason I'd be aware of – in fact, replacing our code
with PassManagerBuilder is also on my todo list. I was looking for
benchmarks to make sure the changed pass scheduling doesn't lead to
_worse_ performance, though (IIRC, the LDC setup includes quite a few
duplicate runs) – but that might just be overly cautious.
> I rewrote optimizer.cpp to use PassManagerBuilder. This changes the inlining
> behaviour. If not explicit disabled then inlining is always performed but
> with different threshholds. This sounds reasonable for me. The net result is
> that the commandline option -enable-inlining goes away (-disable-inlining is
> still present).
LDC currently also performs inlining without -inline being passed on
-O3 (and higher, but -O<4-5> are really the same as -O3 atm). When I
looked at Clang some while back, I found the inline handling strategy
to be quite sensible – maybe we could just copy it? Doesn't Clang also
have a flag similar to "enable-inling"?
> What surprises me is the fact the global.params.useInline (which guides the
> DMD frontend inliner) is always false. Is this intentional?
Yes, this is intentional, the DMD inliner tends to do more harm than
good (which is probably the reason why it isn't enabled by default in
-O builds). I'll add a comment to the source.
> - Otherwise the -inline option of ldmd2 becomes a no-op.
It would become a no-op for higher optimization levels, just as it is now, no?
David