Sub-optimal code generated for certain calls to functions with auto ref qualified parameters

kinke kinke at gmx.net
Mon Aug 10 15:40:19 UTC 2020


On Monday, 10 August 2020 at 11:24:36 UTC, Per Nordlöw wrote:
> As a follow-up to recent discussions at
>
> https://github.com/dlang/dmd/pull/11000
>
> I wonder if the compiler generates sub-optimal code for 
> functions with `auto ref` parameters when passed l-values to 
> parameters whose type fit in registers.

It generates code according to the specification of `auto ref` 
(passing by ref for all lvalues and by value for all rvalues, the 
type doesn't matter at all), which isn't the ideal solution for 
passing input parameters in the most efficient way, hence that PR.


More information about the Digitalmars-d mailing list