Author: Remi Meier <remi.me...@gmail.com> Branch: fix-longevity Changeset: r82509:a1c4102f1903 Date: 2016-02-25 16:16 +0100 http://bitbucket.org/pypy/pypy/changeset/a1c4102f1903/
Log: (plan_rich,remi) fix and test for call survival condition diff --git a/rpython/jit/backend/llsupport/regalloc.py b/rpython/jit/backend/llsupport/regalloc.py --- a/rpython/jit/backend/llsupport/regalloc.py +++ b/rpython/jit/backend/llsupport/regalloc.py @@ -817,7 +817,7 @@ start, end = self.longevity[var] dist = self.dist_to_next_call[position] assert end >= position - if end-position < dist: + if dist >= 0 and position + dist < end: # the variable is used after the call instr return True return False diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py --- a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py +++ b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py @@ -203,6 +203,24 @@ lrs = compute_var_live_ranges(loop.inputargs, loop.operations) assert lrs.dist_to_next_call == [2, 1, 0, -4, -5] + def test_survives_call(self): + ops = ''' + [p0,i0] + i1 = int_add(i0,i0) + i2 = int_sub(i0,i1) + call_n(p0, i1, descr=raising_calldescr) + i3 = int_mul(i2,i0) + guard_true(i3) [] + i5 = int_mul(i2,i0) + jump(p0,i2) + ''' + loop = self.parse(ops) + lrs = compute_var_live_ranges(loop.inputargs, loop.operations) + assert not lrs.survives_call(loop.operations[0], 0) + assert lrs.survives_call(loop.operations[1], 1) + assert not lrs.survives_call(loop.operations[3], 3) + assert not lrs.exists(loop.operations[5]) + def test_simple_loop(self): ops = ''' _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit