[pypy-svn] pypy fold_intadd: Fixed test, cleaned up, working on passing final test.
ademan
commits-noreply at bitbucket.org
Sat Apr 9 05:12:56 CEST 2011
Author: Daniel Roberts <Ademan555 at gmail.com>
Branch: fold_intadd
Changeset: r43240:26bbe3710254
Date: 2011-04-08 20:12 -0700
http://bitbucket.org/pypy/pypy/changeset/26bbe3710254/
Log: Fixed test, cleaned up, working on passing final test.
diff --git a/pypy/jit/metainterp/test/test_optimizeopt.py b/pypy/jit/metainterp/test/test_optimizeopt.py
--- a/pypy/jit/metainterp/test/test_optimizeopt.py
+++ b/pypy/jit/metainterp/test/test_optimizeopt.py
@@ -5561,17 +5561,18 @@
i2 = int_sub(4, i1)
i3 = int_sub(i2, 14)
i4 = int_add(6, i2)
- jump(i3)
+ jump(i4)
"""
expected = """
[i0]
i1 = int_add(i0, 3)
i2 = int_sub(1, i0)
- i3 = int_sub(i0, 13)
- i4 = int_sub(7, i0)
- jump(i3)
- """
+ i3 = int_sub(-13, i0)
+ i4 = int_sub(-7, i0)
+ jump(i4)
+ """
+ self.optimize_loop(ops, expected)
##class TestOOtype(OptimizeOptTest, OOtypeMixin):
diff --git a/pypy/jit/metainterp/optimizeopt/addition.py b/pypy/jit/metainterp/optimizeopt/addition.py
--- a/pypy/jit/metainterp/optimizeopt/addition.py
+++ b/pypy/jit/metainterp/optimizeopt/addition.py
@@ -38,7 +38,7 @@
self.roperands[result] = constant, root
boxed_constant = ConstInt(constant)
- new_op = ResOperation(rop.INT_SUB, [boxed_constant, variable], result)
+ new_op = ResOperation(rop.INT_SUB, [boxed_constant, root], result)
self.emit_operation(new_op)
return
except KeyError:
@@ -88,7 +88,7 @@
rv = self.getvalue(op.getarg(1))
result = op.result
if lv.is_constant() and rv.is_constant():
- self.emit_operation(op) # XXX: there's support for optimizing this elsewhere, right?
+ self.emit_operation(op)
elif lv.is_constant():
constant = lv.box.getint()
self._process_add(constant, op.getarg(1), result)
@@ -103,11 +103,10 @@
rv = self.getvalue(op.getarg(1))
result = op.result
if lv.is_constant() and rv.is_constant():
- self.emit_operation(op) # XXX: there's support for optimizing this elsewhere, right?
+ self.emit_operation(op)
elif lv.is_constant():
constant = lv.box.getint()
self._process_sub(constant, op.getarg(1), result)
- #self.emit_operation(op)
elif rv.is_constant():
constant = rv.box.getint()
self._process_add(-constant, op.getarg(0), result)
More information about the Pypy-commit
mailing list