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: [email protected]
Reporter: [email protected]
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.
--
