Does the compiler inline the predicate functions to std.algorithm.sort?

Seb seb at wilzba.ch
Mon Mar 19 12:59:18 UTC 2018


On Monday, 19 March 2018 at 12:45:58 UTC, tipdbmp wrote:
>>(@tipdbmp: The string gets turned into the function 
>>_D3std10functional__T9binaryFunVAyaa5_61203c2062VQra1_61VQza1_62Z__TQBvTiTiZQCdFNaNbNiNfKiKiZb. No references to it remain with -O3; the LLVM IR obtained with -output-ll might be easier to read than assembly.)
>
> I see. It seems that ldc 1.8.0 with "-release -O2|3" inlines 
> it, but dmd 2.079.0 with "-release" (no -O option?) does not.

DMD has a -inline flag to enable inlining - though LDC is a lot 
better in optimization than DMD and thus typically used for 
anything performance related.

>>the LLVM IR obtained with -output-ll might be easier to read 
>>than assembly.)
> I only seem to get assembly on d.godbolt.org, even with the 
> -output-ll option.

You can get IR on run.dlang.io by simply selecting LDC and 
hitting the IR button.


More information about the Digitalmars-d-learn mailing list