[pypy-svn] pypy jit-short_from_state: Removing duplicated ovf ops does not work if there are lazy setfields. They will be inserted between int_add_ovf and guard_no_overflow prevent the optimization. Later on operations are swapped in newoperations to place int_add_ovf and guard_no_overflow next to eachother in the final optimized trace.
hakanardo
commits-noreply at bitbucket.org
Fri May 6 09:49:41 CEST 2011
Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r43920:15e6730794b8
Date: 2011-05-06 09:48 +0200
http://bitbucket.org/pypy/pypy/changeset/15e6730794b8/
Log: Removing duplicated ovf ops does not work if there are lazy
setfields. They will be inserted between int_add_ovf and
guard_no_overflow prevent the optimization. Later on operations are
swapped in newoperations to place int_add_ovf and guard_no_overflow
next to eachother in the final optimized trace.
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
@@ -2911,6 +2911,42 @@
"""
self.optimize_loop(ops, expected, preamble)
+ def test_remove_duplicate_pure_op_ovf_with_lazy_setfield(self):
+ ops = """
+ [i1, p1]
+ i3 = int_add_ovf(i1, 1)
+ guard_no_overflow() []
+ i3b = int_is_true(i3)
+ guard_true(i3b) []
+ setfield_gc(p1, i1, descr=valuedescr)
+ i4 = int_add_ovf(i1, 1)
+ guard_no_overflow() []
+ i4b = int_is_true(i4)
+ guard_true(i4b) []
+ escape(i3)
+ escape(i4)
+ jump(i1, p1)
+ """
+ preamble = """
+ [i1, p1]
+ i3 = int_add_ovf(i1, 1)
+ guard_no_overflow() []
+ i3b = int_is_true(i3)
+ guard_true(i3b) []
+ setfield_gc(p1, i1, descr=valuedescr)
+ escape(i3)
+ escape(i3)
+ jump(i1, p1, i3)
+ """
+ expected = """
+ [i1, p1, i3]
+ setfield_gc(p1, i1, descr=valuedescr)
+ escape(i3)
+ escape(i3)
+ jump(i1, p1, i3)
+ """
+ self.optimize_loop(ops, expected, preamble)
+
def test_ovf_guard_in_short_preamble1(self):
ops = """
[p8, p11, i24]
@@ -2946,6 +2982,7 @@
setfield_gc(p8, i28, descr=nextdescr)
i34 = getfield_gc_pure(p11, descr=valuedescr)
i35 = getfield_gc_pure(p26, descr=adescr)
+ guard_nonnull(p12) []
i36 = int_add_ovf(i34, i35)
guard_no_overflow() []
p38 = new_with_vtable(ConstClass(node_vtable))
More information about the Pypy-commit
mailing list