[pypy-svn] r55615 - pypy/branch/c-backend-fun/pypy/translator/oosupport

fijal at codespeak.net fijal at codespeak.net
Fri Jun 6 01:13:59 CEST 2008


Author: fijal
Date: Fri Jun  6 01:13:58 2008
New Revision: 55615

Modified:
   pypy/branch/c-backend-fun/pypy/translator/oosupport/treebuilder.py
Log:
Force inlining more often


Modified: pypy/branch/c-backend-fun/pypy/translator/oosupport/treebuilder.py
==============================================================================
--- pypy/branch/c-backend-fun/pypy/translator/oosupport/treebuilder.py	(original)
+++ pypy/branch/c-backend-fun/pypy/translator/oosupport/treebuilder.py	Fri Jun  6 01:13:58 2008
@@ -33,7 +33,12 @@
 
 # TODO: analyze graphs to determine which functions calls could have
 # side effects and which can be inlined safely.
-def can_be_inlined(op):
+def can_be_inlined(op, block):
+    for exit in block.exits:
+        if op.result in exit.args:
+            break
+    else:
+        return True
     try:
         llop = LL_OPERATIONS[op.opname]
         return llop.canfold
@@ -64,7 +69,7 @@
         for i, v in enumerate(op.args):
             if var_count.get(v, None) == 1 and v not in block.inputargs: # "inline" the operation
                 sub_i, sub_op = var_to_op[v]
-                if can_be_inlined(sub_op):
+                if can_be_inlined(sub_op, block):
                     op.args[i] = SubOperation(sub_op)
                     block.operations[sub_i] = None
     if block.operations != ():



More information about the Pypy-commit mailing list