@@ -41,7 +41,7 @@ def _drop_reduction_halospots(iet):
4141
4242 # If all HaloSpot reads pertain to reductions, then the HaloSpot is useless
4343 for hs , expressions in MapNodes (HaloSpot , Expression ).visit (iet ).items ():
44- scope = Scope ([ i .expr for i in expressions ] )
44+ scope = Scope (i .expr for i in expressions )
4545 for f , v in scope .reads .items ():
4646 if f in hs .fmapper and all (i .is_reduction for i in v ):
4747 mapper [hs ].add (f )
@@ -79,7 +79,7 @@ def _hoist_redundant_from_conditionals(iet):
7979
8080 mapper = HaloSpotMapper ()
8181 for it , halo_spots in iter_mapper .items ():
82- scope = Scope ([ e .expr for e in FindNodes (Expression ).visit (it )] )
82+ scope = Scope (e .expr for e in FindNodes (Expression ).visit (it ))
8383
8484 for hs0 in halo_spots :
8585 conditions = cond_mapper [hs0 ]
@@ -156,6 +156,7 @@ def _merge_halospots(iet):
156156 # `hsf1` out of `it`, otherwise we just drop it
157157 if hsf0 .loc_values != hsf1 .loc_values :
158158 continue
159+
159160 mapper .drop (hs1 , f )
160161
161162 iet = mapper .apply (iet )
@@ -278,7 +279,7 @@ def _mark_overlappable(iet):
278279 if not expressions :
279280 continue
280281
281- scope = Scope ([ i .expr for i in expressions ] )
282+ scope = Scope (i .expr for i in expressions )
282283
283284 # Comp/comm overlaps is legal only if the OWNED regions can grow
284285 # arbitrarly, which means all of the dependences must be carried
@@ -448,8 +449,8 @@ def _make_cond_mapper(iet):
448449 """
449450 Return a mapper from HaloSpots to the Conditionals that contain them.
450451 """
451- return { hs : tuple ( i for i in v if i . is_Conditional )
452- for hs , v in MapHaloSpots (). visit ( iet ) .items ()}
452+ mapper = MapHaloSpots (). visit ( iet )
453+ return { hs : tuple ( i for i in v if i . is_Conditional ) for hs , v in mapper .items ()}
453454
454455
455456def _derive_scope (it , hs0 , hs1 ):
@@ -458,7 +459,7 @@ def _derive_scope(it, hs0, hs1):
458459 and ends at the HaloSpot `hs1`.
459460 """
460461 expressions = FindWithin (Expression , hs0 , stop = hs1 ).visit (it )
461- return Scope ([ e .expr for e in expressions ] )
462+ return Scope (e .expr for e in expressions )
462463
463464
464465def _check_control_flow (hs0 , hs1 , cond_mapper ):
0 commit comments