Author: Carl Friedrich Bolz <[email protected]>
Branch: better-storesink
Changeset: r87158:7e9fbd17bdb8
Date: 2016-09-06 19:38 +0200
http://bitbucket.org/pypy/pypy/changeset/7e9fbd17bdb8/
Log: add some logging
diff --git a/rpython/translator/backendopt/cse.py
b/rpython/translator/backendopt/cse.py
--- a/rpython/translator/backendopt/cse.py
+++ b/rpython/translator/backendopt/cse.py
@@ -8,6 +8,8 @@
from rpython.translator.backendopt import ssa
from rpython.translator.backendopt.writeanalyze import WriteAnalyzer
+from rpython.translator.backendopt.support import log
+
def has_side_effects(op):
try:
return getattr(llop, op.opname).sideeffects
@@ -191,7 +193,7 @@
if isinstance(arg, Variable):
return self.variable_families.find_rep(arg)
return arg
- added_some_same_as = False
+ added_same_as = 0
for op in block.operations:
# heap operations
if op.opname == 'getfield':
@@ -200,7 +202,7 @@
if res is not None:
op.opname = 'same_as'
op.args = [res]
- added_some_same_as = True
+ added_same_as += 1
else:
self.heapcache[tup] = op.result
continue
@@ -223,11 +225,11 @@
if res is not None:
op.opname = 'same_as'
op.args = [res]
- added_some_same_as = True
+ added_same_as += 1
self.variable_families.union(res, op.result)
else:
self.purecache[key] = op.result
- return added_some_same_as
+ return added_same_as
def _merge(tuples, variable_families, analyzer, loop_blocks, backedges):
if not tuples:
@@ -266,7 +268,7 @@
caches_to_merge = collections.defaultdict(list)
done = set()
- added_some_same_as = False
+ added_same_as = 0
while todo:
block = todo.popleft()
@@ -279,8 +281,7 @@
cache = _merge(
caches_to_merge[block], variable_families, self.analyzer,
loops.get(block, None), current_backedges)
- changed_block = cache.cse_block(block)
- added_some_same_as = changed_block or added_some_same_as
+ added_same_as += cache.cse_block(block)
else:
cache = Cache(variable_families, self.analyzer)
done.add(block)
@@ -293,8 +294,10 @@
if exit.target not in done and exit.target not in todo: #
XXX
todo.append(exit.target)
caches_to_merge[exit.target].append((exit, cache))
- if added_some_same_as:
+ if added_same_as:
ssa.SSA_to_SSI(graph)
removenoops.remove_same_as(graph)
simplify.transform_dead_op_vars(graph)
+ if added_same_as:
+ log.cse("removed %s ops in graph %s" % (added_same_as, graph))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit