Author: Ronan Lamy <[email protected]>
Branch: ssa-flow
Changeset: r74495:08a17311eb3a
Date: 2014-11-13 00:30 +0000
http://bitbucket.org/pypy/pypy/changeset/08a17311eb3a/

Log:    move SSA_to_SSI() call from build_flow() to simplify_graph()

diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -7,7 +7,6 @@
 import __builtin__
 
 from rpython.tool.error import source_lines
-from rpython.translator.backendopt.ssa import SSA_to_SSI
 from rpython.translator.simplify import eliminate_empty_blocks
 from rpython.rlib import rstackovf
 from rpython.flowspace.argument import CallSpec
@@ -84,8 +83,6 @@
     for block in graph.iterblocks():
         if isinstance(block, SpamBlock):
             del block.framestate     # memory saver
-    eliminate_empty_blocks(graph)
-    SSA_to_SSI(graph)
 
 # ____________________________________________________________
 
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -30,7 +30,7 @@
 
 def build_flow(func):
     """
-    Create the flow graph for the function.
+    Create the flow graph (in SSA form) for the function.
     """
     _assert_rpythonic(func)
     if (isgeneratorfunction(func) and
@@ -41,7 +41,6 @@
     ctx = FlowContext(graph, code)
     ctx.build_flow()
     fixeggblocks(graph)
-    checkgraph(graph)
     if code.is_generator:
         tweak_generator_graph(graph)
     return graph
diff --git a/rpython/flowspace/test/test_objspace.py 
b/rpython/flowspace/test/test_objspace.py
--- a/rpython/flowspace/test/test_objspace.py
+++ b/rpython/flowspace/test/test_objspace.py
@@ -635,6 +635,7 @@
 
     def test_highly_branching_example(self):
         x = self.codetest(self.highly_branching_example)
+        simplify_graph(x)
         # roughly 20 blocks + 30 links
         assert len(list(x.iterblocks())) + len(list(x.iterlinks())) < 60
 
diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py
--- a/rpython/translator/simplify.py
+++ b/rpython/translator/simplify.py
@@ -14,6 +14,7 @@
 from rpython.translator import unsimplify
 from rpython.translator.backendopt import ssa
 from rpython.rtyper.lltypesystem import lloperation, lltype
+from rpython.translator.backendopt.ssa import SSA_to_SSI
 
 def get_graph(arg, translator):
     if isinstance(arg, Variable):
@@ -961,6 +962,7 @@
 
 all_passes = [
     eliminate_empty_blocks,
+    SSA_to_SSI,
     remove_assertion_errors,
     join_blocks,
     coalesce_bool,
@@ -976,7 +978,6 @@
     """inplace-apply all the existing optimisations to the graph."""
     if passes is True:
         passes = all_passes
-    checkgraph(graph)
     for pass_ in passes:
         pass_(graph)
     checkgraph(graph)
@@ -984,6 +985,7 @@
 def cleanup_graph(graph):
     checkgraph(graph)
     eliminate_empty_blocks(graph)
+    SSA_to_SSI(graph)
     join_blocks(graph)
     remove_identical_vars(graph)
     checkgraph(graph)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to