From 5b23914fdeff79691b1f3ac18e7b87cff3cf9b78 Mon Sep 17 00:00:00 2001 From: Fabio Luporini Date: Thu, 12 Apr 2018 11:00:24 +0200 Subject: [PATCH] ir: Fix group_expressions --- devito/ir/support/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/devito/ir/support/utils.py b/devito/ir/support/utils.py index a1726c6b98..3dead3f007 100644 --- a/devito/ir/support/utils.py +++ b/devito/ir/support/utils.py @@ -209,12 +209,15 @@ def group_expressions(exprs): # Partion based on data dependences mapper = OrderedDict() ngroups = 0 - for i, e1 in enumerate(exprs): + for e1 in exprs: if e1 in mapper: + # Optimization: we know already that a group for `e1` has been found continue found = False - for e2 in exprs[i+1:]: - if Scope([e1, e2]).has_dep: + for e2 in exprs: + if e1 is e2: + continue + elif Scope([e1, e2]).has_dep: v = mapper.get(e1, mapper.get(e2)) if v is None: ngroups += 1