Bug 15296 – [REG2.069] cannot inline simple function that calls use non-inlinable statements

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-06T11:19:00Z
Last change time
2016-02-29T19:57:04Z
Keywords
pull
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2015-11-06T11:19:24Z
The inliner is getting worse: struct GCBits { void setWords(size_t , size_t ) { for(size_t w = 0; false; ) {} } pragma(inline,true) void setRange(size_t target, size_t len) { setWords(target, len); } } void foo() { GCBits bits; bits.setRange(0, 0); } This used to compile with "-inline" with dmd 2.068, but does no longer with dmd 2.069 and git HEAD.
Comment #1 by dlang-bugzilla — 2015-11-09T19:26:12Z
Comment #2 by k.hara.pg — 2015-11-20T09:18:48Z
Comment #3 by github-bugzilla — 2015-11-21T15:20:46Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4c0c8088d34aca637aef07122ec8a26ce1244fe3 fix Issue 15296 - cannot inline simple function that calls use non-inlinable statements Add workaround to do inlining same with the old code. https://github.com/D-Programming-Language/dmd/commit/6a407df2384446cb14eea854860e391c5db59377 Merge pull request #5277 from 9rnsr/fix15296 [REG2.069] Issue 15296 - cannot inline simple function that calls use non-inlinable statements
Comment #4 by github-bugzilla — 2015-12-01T13:22:35Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4c0c8088d34aca637aef07122ec8a26ce1244fe3 fix Issue 15296 - cannot inline simple function that calls use non-inlinable statements https://github.com/D-Programming-Language/dmd/commit/6a407df2384446cb14eea854860e391c5db59377 Merge pull request #5277 from 9rnsr/fix15296
Comment #5 by github-bugzilla — 2016-02-29T19:57:04Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/25453b66de52148e92531c4936de471e5b2cf54b Properly fix Issue 15296 - expand CallExp in ExpStatement as statements If a `CallExp`, `CondExp`, or `CommaExp` appears in `ExpStatement`, it can be inlined as statements. It provides more inlining opportunity. Even if the called function contains some statements which cannot be expanded as expressions (e.g. `ForStatement`), the function call can be inlined. In `expandInline`, if `vthis` is a temporary variable, its dtor call should be deferred till the end of expanded function body statements. https://github.com/D-Programming-Language/dmd/commit/06133fd5bfa17beba18bbe122ba1ef1e5a344f42 Merge pull request #5292 from 9rnsr/fix15296x Properly fix Issue 15296 - expand CallExp in ExpStatement as statements