[Issue 17676] [REG 2.075] bad inlining of functions with multiple return statements

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jul 23 08:03:58 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17676

uplink.coder at googlemail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uplink.coder at googlemail.com

--- Comment #1 from uplink.coder at googlemail.com ---
please consider adding the -vcg-ast output for such issues in the future.
It is there to help debugging inliner issues amongst other things :)

The -vcg-ast output shows that the return is indeed removed:

import object;
import core.stdc.stdio;
__gshared bool bgEnable = true;
nothrow void smallAlloc()
{
    {
        if (bgEnable)
            fullcollectTrigger();
        fullcollectNow();
    }
}
nothrow ulong fullcollect()
{
    if (bgEnable)
        return fullcollectTrigger();
    return fullcollectNow();
}
nothrow ulong fullcollectNow()
{
    printf("fullcollectNow\x0a");
    return 1LU;
}
nothrow ulong fullcollectTrigger()
{
    printf("fullcollectTrigger\x0a");
    return 0LU;
}
void main()
{
    {
        {
            if (bgEnable)
                fullcollectTrigger();
            fullcollectNow();
        }
    }
    return 0;
}

--


More information about the Digitalmars-d-bugs mailing list