New issue 1921: Problematic introduction of promote in presence of int switches
https://bitbucket.org/pypy/pypy/issue/1921/problematic-introduction-of-promote-in

Carl Friedrich Bolz:

The following code lead to very confusing behaviour on Pycket recently:

```
#!python

from rpython.rtyper.raisingops import int_floordiv_ovf

...
        if y == 0:
            raise SchemeException("zero_divisor")
        try:
            res = int_floordiv_ovf(x, y) # misnomer, should be int_truncdiv or 
so
        except OverflowError:
            return 
self.arith_quotient(values.W_Bignum(rbigint.fromint(other.value)))

```

(we were intentionally using int_floordiv_ovf, to get the C integer division 
behaviour). What happened was that int_floordiv_ovf was inlined. That function 
starts with ``if y == -1: ...``. The two conditions on y were turned into a 
switch, which lead to the JIT introducing a promote just before it. This is 
clearly nonsense.

How do we solve this? do the if-to-switch conversion before inlining? require 
an explicit promote before switches where that is safe (probably breaks some 
existing code)?


_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to