Skip to content

Commit

Permalink
fix inferlocations
Browse files Browse the repository at this point in the history
  • Loading branch information
vidsinghal committed Nov 10, 2024
1 parent bd2747b commit 315dbac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gibbon-compiler/src/Gibbon/Passes/InferLocations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,10 +1427,11 @@ fixProj renam pvar proj e =


-- Runs after projTups in the SpawnE case in inferExp.
moveProjsAfterSync :: Var -> Exp2 -> Exp2
moveProjsAfterSync sv ex = go [] (S.singleton sv) ex
moveProjsAfterSync :: LocVar -> Exp2 -> Exp2
moveProjsAfterSync sv ex = case sv of
l@(Single loc) -> go [] (S.singleton l) ex
where
go :: [Binds (Exp2)] -> S.Set Var -> Exp2 -> Exp2
go :: [Binds (Exp2)] -> S.Set LocVar -> Exp2 -> Exp2
go acc1 pending ex =
case ex of
VarE{} -> ex
Expand All @@ -1447,7 +1448,7 @@ moveProjsAfterSync sv ex = go [] (S.singleton sv) ex
let vars = allFreeVars rhs
in if S.null (S.intersection vars pending)
then LetE (v, locs, ty, rhs) (go acc1 pending bod)
else go ((v, locs, ty, rhs):acc1) (S.insert v pending) bod
else go ((v, locs, ty, rhs):acc1) (S.insert (singleLocVar v) pending) bod
IfE a b c -> IfE (go acc1 pending a) (go acc1 pending b) (go acc1 pending c)
MkProdE ls -> MkProdE $ L.map (go acc1 pending) ls
ProjE i arg -> ProjE i $ go acc1 pending arg
Expand Down

0 comments on commit 315dbac

Please sign in to comment.