Commits

Maciej Fijalkowski committed 4db1084

hooray 11 tests passing

  • Participants
  • Parent commits 9961edc
  • Branches result-in-resops

Comments (0)

Files changed (2)

File pypy/jit/metainterp/optimizeopt/intbounds.py

             return op
 
     def optimize_INT_GT(self, op):
-        v1 = self.getvalue(op.getarg(0))
-        v2 = self.getvalue(op.getarg(1))
+        v1 = self.getforwarded(op.getarg(0))
+        v2 = self.getforwarded(op.getarg(1))
         if v1.getintbound().known_gt(v2.getintbound()):
             self.make_constant_int(op, 1)
         elif v1.getintbound().known_le(v2.getintbound()) or v1 is v2:
             self.make_constant_int(op, 0)
         else:
-            self.emit_operation(op)
+            return op
 
     def optimize_INT_LE(self, op):
-        v1 = self.getvalue(op.getarg(0))
-        v2 = self.getvalue(op.getarg(1))
+        v1 = self.getforwarded(op.getarg(0))
+        v2 = self.getforwarded(op.getarg(1))
         if v1.getintbound().known_le(v2.getintbound()) or v1 is v2:
             self.make_constant_int(op, 1)
         elif v1.getintbound().known_gt(v2.getintbound()):
                 self.make_int_le(op.getarg(0), op.getarg(1))
 
     def propagate_bounds_INT_LE(self, op):
-        r = self.getvalue(op)
+        r = self.getforwarded(op)
         if r.is_constant():
-            if r.op.same_constant(CONST_1):
+            if r.same_constant(CONST_1):
                 self.make_int_le(op.getarg(0), op.getarg(1))
             else:
                 self.make_int_gt(op.getarg(0), op.getarg(1))

File pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py

         ops = """
         [i0]
         i1 = int_gt(i0, 0)
-        guard_true(i1) []
+        guard_true(i1)
         i2 = int_le(i0, 0)
-        guard_false(i2) []
+        guard_false(i2)
         jump(i0)
         """
         expected = """
         [i0]
         i1 = int_gt(i0, 0)
-        guard_true(i1) []
+        guard_true(i1)
         jump(i0)
         """
         self.optimize_loop(ops, expected)
         ops = """
         [i0]
         i1 = int_gt(i0, 0)
-        guard_true(i1) []
+        guard_true(i1)
         i2 = int_lt(0, i0)
-        guard_true(i2) []
+        guard_true(i2)
         jump(i0)
         """
         expected = """
         [i0]
         i1 = int_gt(i0, 0)
-        guard_true(i1) []
+        guard_true(i1)
         jump(i0)
         """
         self.optimize_loop(ops, expected)
         ops = """
         [i0]
         i1 = int_gt(i0, 0)
-        guard_true(i1) []
+        guard_true(i1)
         i2 = int_ge(0, i0)
-        guard_false(i2) []
+        guard_false(i2)
         jump(i0)
         """
         expected = """
         [i0]
         i1 = int_gt(i0, 0)
-        guard_true(i1) []
+        guard_true(i1)
         jump(i0)
         """
         self.optimize_loop(ops, expected)
     def test_remove_consecutive_guard_value_constfold(self):
         ops = """
         [i0]
-        guard_value(i0, 0) []
+        guard_value(i0, 0)
         i1 = int_add(i0, 1)
-        guard_value(i1, 1) []
+        guard_value(i1, 1)
         i2 = int_add(i1, 2)
         escape(i2)
         jump(i0)
         """
         expected = """
         [i0]
-        guard_value(i0, 0) []
+        guard_value(i0, 0)
         escape(3)
         jump(0)
         """
     def test_remove_guard_value_if_constant(self):
         ops = """
         [p1]
-        guard_value(p1, ConstPtr(myptr)) []
+        guard_value(p1, ConstPtr(myptr))
         jump(ConstPtr(myptr))
         """
         expected = """