From 315dbac4f0dffc138e57b54b79df756d2ea1487d Mon Sep 17 00:00:00 2001 From: vidsinghal Date: Sun, 10 Nov 2024 09:03:06 -0500 Subject: [PATCH] fix inferlocations --- gibbon-compiler/src/Gibbon/Passes/InferLocations.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/InferLocations.hs b/gibbon-compiler/src/Gibbon/Passes/InferLocations.hs index 50d169be..fe8f069d 100644 --- a/gibbon-compiler/src/Gibbon/Passes/InferLocations.hs +++ b/gibbon-compiler/src/Gibbon/Passes/InferLocations.hs @@ -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 @@ -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