digitalmars.D.bugs - [Issue 22116] New: optimize values based on prior comparisons
- d-bugmail puremagic.com (20/20) Jul 11 2021 https://issues.dlang.org/show_bug.cgi?id=22116
https://issues.dlang.org/show_bug.cgi?id=22116 Issue ID: 22116 Summary: optimize values based on prior comparisons Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: bugzilla digitalmars.com Consider: bool b = (a == 3) ? a : 0; which can be replaced with: bool b = (a == 3); The idea is to do data flow analysis and note that `a` has the value of 3 or !=3 when on a leg of a conditional code path. --
Jul 11 2021