[pypy-commit] pypy expressions-2: fix checkgraph()

rlamy noreply at buildbot.pypy.org
Mon Nov 17 19:59:15 CET 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: expressions-2
Changeset: r74556:42077fcf55a4
Date: 2014-11-09 03:04 +0000
http://bitbucket.org/pypy/pypy/changeset/42077fcf55a4/

Log:	fix checkgraph()

diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -570,10 +570,11 @@
                 "variable %r used in more than one block" % (v,))
             vars[v] = only_in_link
 
-        def usevar(v, in_link=None):
-            assert v in vars
-            if in_link is not None:
-                assert vars[v] is None or vars[v] is in_link
+        def usevar(var, in_link=None):
+            for v in var.dependencies:
+                assert v in vars
+                if in_link is not None:
+                    assert vars[v] is None or vars[v] is in_link
 
 
         for block in graph.iterblocks():
@@ -591,10 +592,7 @@
                 for v in op.args:
                     assert isinstance(v, (Constant, Variable))
                     if isinstance(v, Variable):
-                        if type(v) is Variable:
-                            usevar(v)
-                        else:
-                            usevar(v.arg)
+                        usevar(v)
                     else:
                         assert v.value is not last_exception
                         #assert v.value != last_exc_value
@@ -664,7 +662,7 @@
                     assert link.last_exc_value is None
                 for v in link.args:
                     assert isinstance(v, (Constant, Variable))
-                    if type(v) is Variable:
+                    if isinstance(v, Variable):
                         usevar(v, in_link=link)
                         if exc_link:
                             assert v != block.operations[-1].result


More information about the pypy-commit mailing list