digitalmars.D.bugs - [Issue 22115] New: Optimize if (s.a == 3 ? s : null) to if (s.a == 3)
- d-bugmail puremagic.com (23/23) Jul 10 2021 https://issues.dlang.org/show_bug.cgi?id=22115
https://issues.dlang.org/show_bug.cgi?id=22115 Issue ID: 22115 Summary: Optimize if (s.a == 3 ? s : null) to if (s.a == 3) Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com Currently, dmd often uses the pattern: if (e.isAddExp()) ... isAddExp(), when inlined, becomes code like: if (e.op == TOK.add ? cast(AddExp)this : null) ... This doesn't get optimized to: if (e.op == TOK.add) It should be, in order to make using isAddExp() cost free. --
Jul 10 2021