X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FNormalize.hs;h=0995dbd1fa9653708892d790e0fd4359c8f35579;hb=7c6e864337ffbc1c58950548bef04c7aaa3cf849;hp=53bec0278f492c759fa069c4faaa96e698a7952b;hpb=e74b5270eaa6133386aa5a793700acf079dfc97d;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git 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 []