Author: Armin Rigo <[email protected]>
Branch:
Changeset: r80609:2ba6394918d5
Date: 2015-11-09 13:27 +0100
http://bitbucket.org/pypy/pypy/changeset/2ba6394918d5/
Log: Fix for guard_true/guard_false with vector argument. Add an assert
that guard_true/guard_false is otherwise only used on values 0 or 1,
not any integer.
diff --git a/rpython/jit/backend/llgraph/runner.py
b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -1150,11 +1150,13 @@
def _test_true(self, arg):
if isinstance(arg, list):
return all(arg)
+ assert arg in (0, 1)
return arg
def _test_false(self, arg):
if isinstance(arg, list):
return any(arg)
+ assert arg in (0, 1)
return arg
def execute_guard_true(self, descr, arg):
diff --git a/rpython/jit/backend/llsupport/rewrite.py
b/rpython/jit/backend/llsupport/rewrite.py
--- a/rpython/jit/backend/llsupport/rewrite.py
+++ b/rpython/jit/backend/llsupport/rewrite.py
@@ -196,6 +196,8 @@
opnum = op.getopnum()
if not (opnum == rop.GUARD_TRUE or opnum == rop.GUARD_FALSE):
return
+ if op.getarg(0).is_vector:
+ return
try:
i = op.getfailargs().index(op.getarg(0))
except ValueError:
diff --git a/rpython/jit/backend/test/runner_test.py
b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -4897,7 +4897,8 @@
force_spill(i7)
force_spill(i8)
force_spill(i9)
- guard_true(i9) [i3, i4, i5, i6, i7, i8, i9]
+ i10 = int_is_true(i9)
+ guard_true(i10) [i3, i4, i5, i6, i7, i8, i9]
finish(i9, descr=finaldescr)
""", namespace={'finaldescr': BasicFinalDescr(42),
'faildescr2': BasicFailDescr(1),
diff --git a/rpython/jit/backend/test/test_random.py
b/rpython/jit/backend/test/test_random.py
--- a/rpython/jit/backend/test/test_random.py
+++ b/rpython/jit/backend/test/test_random.py
@@ -800,6 +800,10 @@
"Got %r, expected %r" % (fail,
self.should_fail_by.getdescr()))
for i, v in enumerate(self.get_fail_args()):
+ if v not in self.expected:
+ assert v.getopnum() == rop.SAME_AS_I # special case
+ assert isinstance(v.getarg(0), ConstInt)
+ self.expected[v] = v.getarg(0).getint()
if v.type == FLOAT:
value = cpu.get_float_value(deadframe, i)
else:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit