https://issues.dlang.org/show_bug.cgi?id=7625
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #6 from [email protected] --- 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. --
