Operator overloading leads to bad code optimization

max haughton maxhaton at gmail.com
Wed Dec 8 00:19:36 UTC 2021


On Monday, 6 December 2021 at 11:55:08 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 6 December 2021 at 00:41:06 UTC, max haughton wrote:
>> These kinds of wacky phase ordering (I assume) issues is why I 
>> am slightly distrustful of GDC post-inlining decision.
>
> Multiplying with 0.5 only affects the exponent, but the add 
> could overflow/underflow. Maybe that is wacky for D since it 
> specifies IEEE compliance, but in the gcc-family -O# is really 
> a shortcut for a set of options. If I specify -O or -O3 I would 
> expect the same options as gcc. Otherwise people will claim 
> that C++ is faster?

My sentence was referring to Iains decision to refuse to inline 
templates (i.e. defer to LTO). Makes it harder to work out what 
the compiler is going to do / is doing.


More information about the digitalmars-d-ldc mailing list