We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d165087 commit 1c96965Copy full SHA for 1c96965
1 file changed
devito/passes/clusters/cse.py
@@ -1,4 +1,4 @@
1
-from collections import defaultdict
+from collections import defaultdict, Counter
2
from functools import cached_property, singledispatch
3
4
import numpy as np
@@ -230,13 +230,14 @@ def _compact(exprs, exclude):
230
231
# Find all the CTemps in expression right-hand-sides without removing duplicates
232
ctemps = retrieve_ctemps([e.rhs for e in exprs])
233
+ ctemp_count = Counter(ctemps)
234
235
# If there are ctemps in the expressions, then add any to the mapper which only
236
# appear once
237
# TODO: Double check this is exactly the prior behaviour
238
if ctemps:
239
mapper.update({e.lhs: e.rhs for e in candidates
- if ctemps.count(e.lhs) == 1})
240
+ if ctemp_count[e.lhs] == 1})
241
242
processed = []
243
for e in exprs:
0 commit comments