[pypy-svn] r21265 - in pypy/dist/pypy/translator/backendopt: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sun Dec 18 12:44:40 CET 2005
Author: cfbolz
Date: Sun Dec 18 12:44:38 2005
New Revision: 21265
Modified:
pypy/dist/pypy/translator/backendopt/all.py
pypy/dist/pypy/translator/backendopt/test/test_propagate.py
Log:
make this test pass again (and test something meaningful) after my recent
changes to the inliner: the test was supposed to test whether calls can be
folded as well. The new inliner just inlined the call, so the folding did not
work. Now I don't inline at all in this test (which involved changing to a for
to a while loop, because in a for-loop the calls to the iterator etc. would
need to be inlined).
Modified: pypy/dist/pypy/translator/backendopt/all.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/all.py (original)
+++ pypy/dist/pypy/translator/backendopt/all.py Sun Dec 18 12:44:38 2005
@@ -10,7 +10,7 @@
def backend_optimizations(translator, inline_threshold=1,
mallocs=True,
ssa_form=True,
- merge_if_blocks_to_switch=False,
+ merge_if_blocks_to_switch=True,
propagate=False):
# remove obvious no-ops
for graph in translator.graphs:
Modified: pypy/dist/pypy/translator/backendopt/test/test_propagate.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/test/test_propagate.py (original)
+++ pypy/dist/pypy/translator/backendopt/test/test_propagate.py Sun Dec 18 12:44:38 2005
@@ -4,11 +4,12 @@
from pypy.rpython.llinterp import LLInterpreter
-def get_graph(fn, signature):
+def get_graph(fn, signature, inline_threshold=True):
t = TranslationContext()
t.buildannotator().build_types(fn, signature)
t.buildrtyper().specialize()
- backend_optimizations(t, ssa_form=False, propagate=False)
+ backend_optimizations(t, inline_threshold=inline_threshold,
+ ssa_form=False, propagate=False)
graph = graphof(t, fn)
return graph, t
@@ -59,12 +60,14 @@
def test_constant_fold_call():
def s(x):
res = 0
- for i in range(1, x + 1):
+ i = 1
+ while i <= x:
res += i
+ i += 1
return res
def g(x):
return s(100) + s(1) + x
- graph, t = get_graph(g, [int])
+ graph, t = get_graph(g, [int], inline_threshold=0)
while constant_folding(graph, t):
pass
assert len(graph.startblock.operations) == 1
More information about the Pypy-commit
mailing list