This CL runs a second round of constant propagation after range
analysis to eliminate additional unreachable code. Range analysis
is changed to mark branches as constant if the constraints they
generate are unsatisfiable.
The second pass of constant propagation only visits branches and
removes unreachable code, but does not do full constant propagation.
This proves useful when inlining array view operations where the
following pattern occurs:
for (i = 0; i < length; i++) {
if (i < 0 || i >= length) {
throw 123;
}
foo();
}
In this example the if-statement will be eliminated completely.
Also, fix a bug in range analyis where constraints of already
constrained values were missing.
Review URL: https://codereview.chromium.org//13469013
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20914 260f80e4-7a28-3924-810f-c04153c831b5
Split it into three phases: initialization, widening and narrowing.
During widening and narrowing phi-ranges change according to classical widening and narrowing operators defined as:
Widening:
[_|_, _|_] v [a, b] = [a, b]
[a, b] v [c, d] = [c < a ? -inf : a, d > b ? +inf : b]
Narrowing:
[a, b] ^ [c, d] = [(a == -inf) ? c : min(a, c), (b == +inf) ? d : max(b, d)]
R=fschneider@google.com
Review URL: https://codereview.chromium.org//10972003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12772 260f80e4-7a28-3924-810f-c04153c831b5