[pypy-commit] pypy better-storesink: don't remove things if they can raise
cfbolz
pypy.commits at gmail.com
Wed Oct 12 11:46:39 EDT 2016
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: better-storesink
Changeset: r87728:e61a042a601e
Date: 2016-09-22 18:49 +0200
http://bitbucket.org/pypy/pypy/changeset/e61a042a601e/
Log: don't remove things if they can raise
diff --git a/rpython/translator/backendopt/cse.py b/rpython/translator/backendopt/cse.py
--- a/rpython/translator/backendopt/cse.py
+++ b/rpython/translator/backendopt/cse.py
@@ -233,7 +233,8 @@
return self._var_rep(arg)
return arg
added_same_as = 0
- for op in block.operations:
+ for opindex in range(len(block.operations) - block.canraise):
+ op = block.operations[opindex]
# heap operations
if op.opname == 'getfield':
fieldname = op.args[1].value
diff --git a/rpython/translator/backendopt/test/test_cse.py b/rpython/translator/backendopt/test/test_cse.py
--- a/rpython/translator/backendopt/test/test_cse.py
+++ b/rpython/translator/backendopt/test/test_cse.py
@@ -565,8 +565,20 @@
def f(x):
return p(x) + p(x)
- self.check(f, [int], fullopts=False, direct_call=1)
+ self.check(f, [int], direct_call=1)
+ def test_remove_duplicate_elidable_call_raises(self):
+ @jit.elidable
+ def p(x):
+ return x + 1
+
+ def f(x):
+ try:
+ return p(x) + p(x)
+ except IndexError:
+ return -5
+
+ self.check(f, [int], direct_call=2)
def fakevar(name='v'):
var = Variable(name)
More information about the pypy-commit
mailing list