[pypy-commit] pypy guard-compatible: pass the first unroll test (way too easy???)

cfbolz pypy.commits at gmail.com
Wed Jun 22 06:18:04 EDT 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: guard-compatible
Changeset: r85327:b5babc443dd9
Date: 2016-06-22 12:17 +0200
http://bitbucket.org/pypy/pypy/changeset/b5babc443dd9/

Log:	pass the first unroll test (way too easy???)

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_compatible.py b/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
@@ -3,6 +3,8 @@
     LLtypeMixin)
 from rpython.jit.metainterp.optimizeopt.test.test_optimizebasic import (
     BaseTestBasic)
+from rpython.jit.metainterp.optimizeopt.test.test_optimizeopt import (
+    BaseTestWithUnroll)
 from rpython.jit.metainterp.history import ConstInt, ConstPtr
 from rpython.jit.metainterp.optimize import InvalidLoop
 
@@ -278,3 +280,25 @@
             (ConstInt(123), ConstPtr(self.quasiptr), ConstInt(-4247)): ConstInt(5),
         }
         self.optimize_loop(ops, expected, call_pure_results)
+
+
+class TestCompatibleUnroll(BaseTestWithUnroll, LLtypeMixin):
+
+    def test_remove_guard_compatible(self):
+        ops = """
+        [p0]
+        guard_compatible(p0, ConstPtr(myptr)) []
+        guard_compatible(p0, ConstPtr(myptr)) []
+        jump(p0)
+        """
+        preamble = """
+        [p0]
+        guard_compatible(p0, ConstPtr(myptr)) []
+        jump(p0)
+        """
+        expected = """
+        [p0]
+        jump(p0)
+        """
+        self.optimize_loop(ops, expected, expected_preamble=preamble)
+
diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py
--- a/rpython/jit/metainterp/optimizeopt/unroll.py
+++ b/rpython/jit/metainterp/optimizeopt/unroll.py
@@ -85,6 +85,10 @@
                 op.set_forwarded(str_info)
             if preamble_info.is_nonnull():
                 self.make_nonnull(op)
+            if preamble_info._compatibility_conditions:
+                info_in_loop = op.get_forwarded()
+                if info_in_loop is not None:
+                    info_in_loop._compatibility_conditions = preamble_info._compatibility_conditions
         elif isinstance(preamble_info, intutils.IntBound):
             if preamble_info.lower > MININT/2 or preamble_info.upper < MAXINT/2:
                 intbound = self.getintbound(op)


More information about the pypy-commit mailing list