Optimizing Immutable Data?
Kai Nacke via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Mon Jul 6 12:20:56 PDT 2015
On Monday, 6 July 2015 at 18:40:11 UTC, Jack Stouffer wrote:
> At Dconf, one of the speakers made an off-hand comment that LDC
> could use an LLVM feature to optimize immutable variables by
> storing them differently than mutable data. The LDC developer
> that was there made a response, but the mic didn't pick it up.
>
> Is this something that has already been done? Should a bug
> report be filed so this is tracked?
David was at Dconf. It would be nice if he could repeat his
answer here. I am currently unsure to which LLVM feature the
speaker referred.
Suppose in module imm.d:
int x = 6;
immutable(int) y = 42;
This is translated to the following IR:
@_D3imm1xi = thread_local global i32 6
@_D3imm1yyi = constant i32 42
which is already different.
Regards,
Kai
More information about the digitalmars-d-ldc
mailing list