[pypy-commit] pypy default: Test and fix for "[None] * some_r_uint_number".
arigo
noreply at buildbot.pypy.org
Wed Feb 26 09:17:35 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r69452:1e265793f593
Date: 2014-02-26 09:16 +0100
http://bitbucket.org/pypy/pypy/changeset/1e265793f593/
Log: Test and fix for "[None] * some_r_uint_number".
diff --git a/rpython/rtyper/test/test_rlist.py b/rpython/rtyper/test/test_rlist.py
--- a/rpython/rtyper/test/test_rlist.py
+++ b/rpython/rtyper/test/test_rlist.py
@@ -1619,3 +1619,17 @@
rgc.ll_arraycopy = old_arraycopy
#
assert 2 <= res <= 10
+
+ def test_alloc_and_set(self):
+ def fn(i):
+ lst = [0] * r_uint(i)
+ return lst
+ t, rtyper, graph = self.gengraph(fn, [int])
+ block = graph.startblock
+ seen = 0
+ for op in block.operations:
+ if op.opname in ['cast_int_to_uint', 'cast_uint_to_int']:
+ continue
+ assert op.opname == 'direct_call'
+ seen += 1
+ assert seen == 1
diff --git a/rpython/translator/transform.py b/rpython/translator/transform.py
--- a/rpython/translator/transform.py
+++ b/rpython/translator/transform.py
@@ -30,7 +30,7 @@
# [a] * b
# -->
# c = newlist(a)
-# d = mul(c, int b)
+# d = mul(c, b)
# -->
# d = alloc_and_set(b, a)
@@ -44,8 +44,7 @@
len(op.args) == 1):
length1_lists[op.result] = op.args[0]
elif (op.opname == 'mul' and
- op.args[0] in length1_lists and
- self.gettype(op.args[1]) is int):
+ op.args[0] in length1_lists):
new_op = SpaceOperation('alloc_and_set',
(op.args[1], length1_lists[op.args[0]]),
op.result)
More information about the pypy-commit
mailing list