Author: Squeaky <squeaky...@gmx.com>
Branch: array-propagate-len
Changeset: r69158:a17311d182d4
Date: 2014-02-15 12:11 +0100
http://bitbucket.org/pypy/pypy/changeset/a17311d182d4/

Log:    failing test for getfield_raw, skip bounds check if descr is None

diff --git a/rpython/jit/metainterp/optimizeopt/__init__.py 
b/rpython/jit/metainterp/optimizeopt/__init__.py
--- a/rpython/jit/metainterp/optimizeopt/__init__.py
+++ b/rpython/jit/metainterp/optimizeopt/__init__.py
@@ -63,7 +63,7 @@
             optimizer.propagate_all_forward()
     finally:
         debug_stop("jit-optimize")
-        
+
 if __name__ == '__main__':
     print ALL_OPTS_NAMES
 
diff --git a/rpython/jit/metainterp/optimizeopt/intbounds.py 
b/rpython/jit/metainterp/optimizeopt/intbounds.py
--- a/rpython/jit/metainterp/optimizeopt/intbounds.py
+++ b/rpython/jit/metainterp/optimizeopt/intbounds.py
@@ -347,12 +347,14 @@
     def optimize_GETARRAYITEM_RAW(self, op):
         self.emit_operation(op)
         descr = op.getdescr()
-        if descr.is_item_integer_bounded():
+        if descr and descr.is_item_integer_bounded():
             v1 = self.getvalue(op.result)
             v1.intbound.make_ge(IntLowerBound(descr.get_item_integer_min()))
             v1.intbound.make_lt(
                 IntUpperBound(descr.get_item_integer_max() + 1))
 
+    optimize_GETARRAYITEM_GC = optimize_GETARRAYITEM_RAW
+
     def optimize_UNICODEGETITEM(self, op):
         self.emit_operation(op)
         v1 = self.getvalue(op.result)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py 
b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -5239,6 +5239,21 @@
         """
         self.optimize_loop(ops, ops)
 
+    def test_getfieldraw_cmp_outside_bounds(self):
+        ops = """
+        [p0]
+        i0 = getfield_raw(p0, descr=chardescr)
+        i1 = int_gt(i0, -1)
+        guard_true(i1) []
+        """
+
+        expected = """
+        [p0]
+        i0 = getfield_raw(p0, descr=chardescr)
+        """
+        self.optimize_loop(ops, expected)
+
+
     def test_rawarray_cmp_outside_intbounds(self):
         ops = """
         [i0]
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to