Author: Carl Friedrich Bolz-Tereick <cfb...@gmx.de> Branch: regalloc-playground Changeset: r92309:2534cf818d52 Date: 2017-09-03 09:01 +0200 http://bitbucket.org/pypy/pypy/changeset/2534cf818d52/
Log: don't crash with unused operation diff --git a/rpython/jit/backend/x86/reghint.py b/rpython/jit/backend/x86/reghint.py --- a/rpython/jit/backend/x86/reghint.py +++ b/rpython/jit/backend/x86/reghint.py @@ -24,6 +24,8 @@ self.longevity = longevity for i in range(len(operations)): op = operations[i] + if rop.has_no_side_effect(op.opnum) and op not in self.longevity: + continue oplist[op.getopnum()](self, op, i) def not_implemented_op(self, op, position): diff --git a/rpython/jit/backend/x86/test/test_regalloc.py b/rpython/jit/backend/x86/test/test_regalloc.py --- a/rpython/jit/backend/x86/test/test_regalloc.py +++ b/rpython/jit/backend/x86/test/test_regalloc.py @@ -61,6 +61,18 @@ for l in self.log: print l + def test_unused(self): + ops = ''' + [i0, i1, i2, i3] + i7 = int_add(i0, i1) # unused + i9 = int_add(i2, i3) + finish(i9) + ''' + # does not crash + self.interpret(ops, [5, 6, 7, 8]) + assert len([entry for entry in self.log if entry.args[0] == "int_add"]) == 1 + + def test_call_use_correct_regs(self): ops = ''' [i0, i1, i2, i3] _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit