[pypy-commit] pypy expressions: fix transform_dead_op_vars_in_blocks()

rlamy noreply at buildbot.pypy.org
Tue Nov 11 02:39:02 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: expressions
Changeset: r74436:b499e643c6d3
Date: 2014-11-09 01:11 +0000
http://bitbucket.org/pypy/pypy/changeset/b499e643c6d3/

Log:	fix transform_dead_op_vars_in_blocks()

diff --git a/rpython/annotator/expression.py b/rpython/annotator/expression.py
--- a/rpython/annotator/expression.py
+++ b/rpython/annotator/expression.py
@@ -21,3 +21,7 @@
             return V_Type(mapping[self.arg])
         else:
             return self
+
+    @property
+    def dependencies(self):
+        return self.arg.dependencies
diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -325,6 +325,10 @@
     def replace(self, mapping):
         return mapping.get(self, self)
 
+    @property
+    def dependencies(self):
+        return set([self])
+
 
 class Constant(Hashable):
     __slots__ = ["concretetype"]
@@ -356,6 +360,10 @@
     def replace(self, mapping):
         return self
 
+    @property
+    def dependencies(self):
+        return set()
+
 
 class FSException(object):
     def __init__(self, w_type, w_value):
diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py
--- a/rpython/translator/simplify.py
+++ b/rpython/translator/simplify.py
@@ -420,9 +420,11 @@
         # figure out which variables are ever read
         for op in block.operations:
             if not canremove(op, block):   # the inputs are always needed
-                read_vars.update(op.args)
+                for arg in op.args:
+                    read_vars.update(arg.dependencies)
             else:
-                dependencies[op.result].update(op.args)
+                for arg in op.args:
+                    dependencies[op.result].update(arg.dependencies)
 
         if isinstance(block.exitswitch, Variable):
             read_vars.add(block.exitswitch)


More information about the pypy-commit mailing list