Jump to page: 1 2
Thread overview
[Issue 7625] inlining only works with explicit else branch
Sep 29, 2014
Martin Nowak
Sep 29, 2014
Martin Nowak
Sep 29, 2014
Martin Nowak
Aug 22, 2015
Walter Bright
Apr 03, 2016
Kenji Hara
Apr 05, 2016
Kenji Hara
Feb 18, 2022
Dlang Bot
Feb 18, 2022
Iain Buclaw
Feb 18, 2022
Dlang Bot
August 06, 2014
https://issues.dlang.org/show_bug.cgi?id=7625

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx

--
September 29, 2014
https://issues.dlang.org/show_bug.cgi?id=7625

--- Comment #1 from Martin Nowak <code@dawg.eu> ---
Workaround for a performance regression in std.utf caused by this. https://github.com/D-Programming-Language/phobos/pull/2566

--
September 29, 2014
https://issues.dlang.org/show_bug.cgi?id=7625

--- Comment #2 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/fea9bad209272b032fc8e38d358f06035676b14f workaround inline Issue 7625

- add explicit else branches so that dmd can inline those functions

https://github.com/D-Programming-Language/phobos/commit/335228cb079ccc2060790a2b23bca5db645fa7f0 Merge pull request #2566 from MartinNowak/workaround7625

workaround inline Issue 7625

--
September 29, 2014
https://issues.dlang.org/show_bug.cgi?id=7625

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |performance

--
September 29, 2014
https://issues.dlang.org/show_bug.cgi?id=7625

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P5

--
February 19, 2015
https://issues.dlang.org/show_bug.cgi?id=7625

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to 2.067 at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/fea9bad209272b032fc8e38d358f06035676b14f workaround inline Issue 7625

https://github.com/D-Programming-Language/phobos/commit/335228cb079ccc2060790a2b23bca5db645fa7f0 Merge pull request #2566 from MartinNowak/workaround7625

--
August 22, 2015
https://issues.dlang.org/show_bug.cgi?id=7625

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
https://github.com/D-Programming-Language/dmd/pull/4919

--
September 21, 2015
https://issues.dlang.org/show_bug.cgi?id=7625

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
September 21, 2015
https://issues.dlang.org/show_bug.cgi?id=7625

--- Comment #5 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f5261a2a978831e10a2ff36d3e342770f846dd1b fix Issue 7625 - inlining only works with explicit else branch

https://github.com/D-Programming-Language/dmd/commit/26bd7451bf69051d7662f807978441cf1eefeb2f Merge pull request #4919 from WalterBright/fix7625

fix Issue 7625 - inlining only works with explicit else branch

--
March 30, 2016
https://issues.dlang.org/show_bug.cgi?id=7625

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #6 from hsteoh@quickfur.ath.cx ---
The fix was incomplete. Here's a test case for which dmd fails to inline a function that's basically identical to another inlined function, the only difference being the omission of `else`:

------
int tembo(int x, int y)
{
        if (y == 0) return 0;
        x++;
        return x / y;
}
int pembo(int x, int y)
{
        if (y == 0) return 0;
        else
        {
                x++;
                return x / y;
        }
}
int twiga(int x, int y, int z)
{
        auto w = tembo(x, y);
        return w * z;
}
int simba(int x, int y, int z)
{
        auto w = pembo(x, y);
        return w * z;
}
------

Compiling with `dmd -O -inline` and disassembling, I found that twiga still contains a function call to tembo, whereas simba inlines pembo. Commenting out the x++ from tembo and pembo causes successful inlining of both functions in twiga and simba.  So it seems that the inliner is still unable to deal with the case where the else block (with omitted `else`) contains anything more than just a simple return statement.

--
« First   ‹ Prev
1 2