[pypy-svn] pypy ootype-virtualrefs: fix an obscure case which seems to be produced only with ootype translation. I didn't manage to write a test for it :-(
antocuni
commits-noreply at bitbucket.org
Wed Apr 6 16:43:36 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: ootype-virtualrefs
Changeset: r43173:67fec99826fb
Date: 2011-04-06 16:42 +0200
http://bitbucket.org/pypy/pypy/changeset/67fec99826fb/
Log: fix an obscure case which seems to be produced only with ootype
translation. I didn't manage to write a test for it :-(
diff --git a/pypy/translator/backendopt/merge_if_blocks.py b/pypy/translator/backendopt/merge_if_blocks.py
--- a/pypy/translator/backendopt/merge_if_blocks.py
+++ b/pypy/translator/backendopt/merge_if_blocks.py
@@ -75,14 +75,19 @@
# False link
checkvar = [var for var in current.operations[-1].args
if isinstance(var, Variable)][0]
+ resvar = current.operations[-1].result
case = [var for var in current.operations[-1].args
if isinstance(var, Constant)][0]
- chain.append((current, case))
checkvars.append(checkvar)
falseexit = current.exits[0]
assert not falseexit.exitcase
trueexit = current.exits[1]
targetblock = falseexit.target
+ # if the result of the check is also passed through the link, we
+ # cannot construct the chain
+ if resvar in falseexit.args or resvar in trueexit.args:
+ break
+ chain.append((current, case))
if len(entrymap[targetblock]) != 1:
break
if checkvar not in falseexit.args:
More information about the Pypy-commit
mailing list