提交 45824560 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

No Alloc constant folding when no clients

This is because either: - There will never be any client and thus the node will be pruned, so performing constant folding would be a waste of time, or - Someone will add clients later and will re-run the constant folding phase, in which case we will want to use the client-dependent logic to decide whether constant folding should be applied or not.
上级 2015d28c
......@@ -3370,7 +3370,7 @@ class Alloc(gof.Op):
return self.make_node(eval_points[0], *inputs[1:]).outputs
def do_constant_folding(self, node):
if not hasattr(node.outputs[0], 'clients'):
if not getattr(node.outputs[0], 'clients', []):
# If there are no clients then there is no point doing constant
# folding.
return False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论