noinline, forceinline, builtin_expect

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 2 13:40:58 PST 2015


On 1/2/2015 6:34 AM, Martin Nowak wrote:
> The compiler can't make good decisions here, because it lacks information about
> which branches are executed rarely.

The dmd optimizer assumes that for:

    if (e)
       e1;
    else
       e2;

that e1 is executed more often than e2. Of more interest, though, is not 
inlining very rarely executed code, because it will cause suboptimal register 
allocation.


More information about the Digitalmars-d mailing list