diff options
author | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2020-04-29 21:44:47 +0200 |
---|---|---|
committer | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2020-04-29 21:44:47 +0200 |
commit | e8d8baac2db4efcb141caf4ab5e5605a162fefda (patch) | |
tree | 8e61273625dc1e920a320161a51b6879d514ee7d /rpython | |
parent | remove copy-pasted comment (diff) | |
download | pypy-e8d8baac2db4efcb141caf4ab5e5605a162fefda.tar.gz pypy-e8d8baac2db4efcb141caf4ab5e5605a162fefda.tar.bz2 pypy-e8d8baac2db4efcb141caf4ab5e5605a162fefda.zip |
add a comment about something that I have to re-learn every time I read this code
Diffstat (limited to 'rpython')
-rw-r--r-- | rpython/jit/metainterp/optimizeopt/intbounds.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rpython/jit/metainterp/optimizeopt/intbounds.py b/rpython/jit/metainterp/optimizeopt/intbounds.py index c87d545f3d..a9445a5f8e 100644 --- a/rpython/jit/metainterp/optimizeopt/intbounds.py +++ b/rpython/jit/metainterp/optimizeopt/intbounds.py @@ -155,6 +155,12 @@ class OptIntBounds(Optimization): b2 = self.getintbound(op.getarg(1)) r = self.getintbound(op) b = b1.add_bound(b2) + # NB: the result only gets its bound updated if b has an upper and a + # lower bound. This is important, to do the right thing in the presence + # of overflow. Example: + # y = x + 1 where x >= 0 + # here it's tempting to give a bound of y >= 1, but that would be + # wrong, due to wraparound if b.bounded(): r.intersect(b) |