[pypy-commit] pypy type-specialized-instances: make sure that if you tag the same thing twice you reuse the result

cfbolz noreply at buildbot.pypy.org
Fri Jan 11 17:06:00 CET 2013


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: type-specialized-instances
Changeset: r59954:3eb981d2713e
Date: 2013-01-11 17:05 +0100
http://bitbucket.org/pypy/pypy/changeset/3eb981d2713e/

Log:	make sure that if you tag the same thing twice you reuse the result

diff --git a/pypy/jit/metainterp/optimizeopt/intbounds.py b/pypy/jit/metainterp/optimizeopt/intbounds.py
--- a/pypy/jit/metainterp/optimizeopt/intbounds.py
+++ b/pypy/jit/metainterp/optimizeopt/intbounds.py
@@ -195,6 +195,7 @@
                 maxbounds = IntBound((-sys.maxint-1) >> 1, sys.maxint >> 1)
                 v1.intbound.intersect(maxbounds)
                 self.pure(rop.INT_UNTAG, [result], args[0])
+                self.pure(rop.INT_TAG, args[:], result)
         self.emit_operation(op)
 
     def optimize_GUARD_OVERFLOW(self, op):
diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -5335,6 +5335,28 @@
         """
         self.optimize_loop(ops, expected, preamble)
 
+    def test_int_tag_ovf_not_repeated(self):
+        ops = """
+        [i0]
+        i1 = int_tag_ovf(i0)
+        guard_no_overflow() []
+        i2 = int_tag_ovf(i0)
+        guard_no_overflow() []
+        i5 = int_add(i2, 1)
+        escape(i5)
+        jump(i5)
+        """
+        expected = """
+        [i0]
+        i1 = int_tag_ovf(i0)
+        guard_no_overflow() []
+        i5 = int_add(i1, 1)
+        escape(i5)
+        jump(i5)
+        """
+        self.optimize_loop(ops, expected)
+
+
     def test_mul_ovf(self):
         ops = """
         [i0, i1]


More information about the pypy-commit mailing list