An LLVM bug that affect both LDC and SDC. Worth pushing for

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 18 14:22:35 PDT 2014


On 18 June 2014 19:20, deadalnix via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Wednesday, 18 June 2014 at 09:29:14 UTC, Iain Buclaw via Digitalmars-d
> wrote:
>>
>> Yeah, I did get that bit. I'm not sure of the optimisation though.
>>
>> IMO, the closure/frame generation should occur *after* inlining.
>
>
> That doesn't really work that way for LLVM. You generate language
> independent IR and optimizations passes run on it. The front can add passes
> of its own in the optimization process to do language dependent
> optimizations.

Likewise here.  But unless I'm missing something (I'm not sure what
magic happens with @allocate, for instance), I'm not sure how you
could expect the optimisation passes to squash closures together.

Am I correct in that it's asking for:
------
int *i = new int;
*i = 42;
return *i;


To be folded into:
------
return 42;


More information about the Digitalmars-d mailing list