Carl Friedrich Bolz-Tereick pushed to branch branch/fix-intutils-ovf-bug at 
PyPy / pypy


Commits:
350a1e9c by Carl Friedrich Bolz-Tereick at 2022-10-15T15:24:27+02:00
int_neg also has a bug

also add some consistency checks between the methods

--HG--
branch : fix-intutils-ovf-bug

- - - - -
ca0788f3 by Carl Friedrich Bolz-Tereick at 2022-10-15T19:02:42+02:00
get rid of has_upper and has_lower completely

Their meaning was basically never super obvious, and you need to be careful to
understand it correctly everywhere. Instead, we now have:

- methods that check whether overflow is known to not occur for certain
  operations (add/sub/.._bound_cannot_overflow)

- the default add/sub/mul/..._bound methods will return result bounds that are
  correct whether overflow happens or not.

- for int_add_ovf/guard_no_overflow there is another new method on the bounds,
  add_bound_no_overflow that returns the tighter range that applies if we know
  from the guard that overflow has not occurred.

--HG--
branch : fix-intutils-ovf-bug

- - - - -
92e91d51 by Carl Friedrich Bolz-Tereick at 2022-10-15T19:41:08+02:00
another incorrect test, about int_neg:

the following implication is wrong in the presence of overflow:
-x <= 0 ⇒ x >= 0
with the (only) counterexample of x = MININT

the inverse one holds:
-x >= 0 ⇒ x <= 0

in practice, int_neg is mostly preceded by int_eq(x, MINIT), guard_false, so
make things work in that case

--HG--
branch : fix-intutils-ovf-bug

- - - - -


7 changed files:

- rpython/jit/metainterp/optimizeopt/intbounds.py
- rpython/jit/metainterp/optimizeopt/intutils.py
- rpython/jit/metainterp/optimizeopt/rewrite.py
- rpython/jit/metainterp/optimizeopt/test/test_intbound.py
- rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
- rpython/jit/metainterp/optimizeopt/unroll.py
- rpython/jit/metainterp/optimizeopt/vstring.py


View it on Heptapod: 
https://foss.heptapod.net/pypy/pypy/-/compare/cba4ba4fcbdc602c7e50d91ab5e19faa554cf827...92e91d515a3234c03cf94fd7cff4693a3e61c037

-- 
View it on Heptapod: 
https://foss.heptapod.net/pypy/pypy/-/compare/cba4ba4fcbdc602c7e50d91ab5e19faa554cf827...92e91d515a3234c03cf94fd7cff4693a3e61c037
You're receiving this email because of your account on foss.heptapod.net.


_______________________________________________
pypy-commit mailing list -- pypy-commit@python.org
To unsubscribe send an email to pypy-commit-le...@python.org
https://mail.python.org/mailman3/lists/pypy-commit.python.org/
Member address: arch...@mail-archive.com

Reply via email to