July 11, 2021 [Issue 22116] New: optimize values based on prior comparisons | ||||
|---|---|---|---|---|
| ||||
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. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply