From: Matthijs Kooijman Date: Fri, 14 Aug 2009 13:43:09 +0000 (+0200) Subject: Make letmerge work with non-recursive lets. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=7c6e864337ffbc1c58950548bef04c7aaa3cf849;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Make letmerge work with non-recursive lets. --- diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index 53bec02..0995dbd 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -228,9 +228,10 @@ letremoveunusedtop = everywhere ("letremoveunused", letremoveunused) -- TODO: We would very much like to use GHC's CSE module for this, but that -- doesn't track if something changed or not, so we can't use it properly. letmerge, letmergetop :: Transform -letmerge expr@(Let (Rec binds) res) = do +letmerge expr@(Let _ _) = do + let (binds, res) = flattenLets expr binds' <- domerge binds - return (Let (Rec binds') res) + return $ MkCore.mkCoreLets (map (uncurry NonRec) binds') res where domerge :: [(CoreBndr, CoreExpr)] -> TransformMonad [(CoreBndr, CoreExpr)] domerge [] = return []