From 9f5050b01b3e95ea1974d8e7baf604c3d95f8144 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 12 Dec 2016 16:46:33 +0000 Subject: [PATCH] avoid key shuffling with networkx.Graph --- coffee/rewriter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coffee/rewriter.py b/coffee/rewriter.py index de9710ee..47753dfd 100644 --- a/coffee/rewriter.py +++ b/coffee/rewriter.py @@ -568,7 +568,7 @@ def sharing_graph_rewrite(self): self.licm('only_const').licm('only_outlinear') # Transform the expression based on the sharing graph - nodes, edges = sgraph.nodes(), sgraph.edges() + nodes = [n for n in nodes if n in sgraph.nodes()] if not (nodes and all(sgraph.degree(n) > 0 for n in nodes)): self.factorize(mode='heuristic') self.licm('only_const').licm('only_outlinear')