From 26ad8ba14c7c63978fc51fc81b92888e8e3963ef Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 14 Aug 2009 16:08:08 +0200 Subject: [PATCH] Make letremoveunused work for non-recursive lets. --- "c\316\273ash/CLasH/Normalize.hs" | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index bade853..984d739 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -204,12 +204,13 @@ letremovesimpletop = everywhere ("letremovesimple", inlinebind (\(b, e) -> Trans -- Unused let binding removal -------------------------------- letremoveunused, letremoveunusedtop :: Transform -letremoveunused expr@(Let (Rec binds) res) = do +letremoveunused expr@(Let _ _) = do -- Filter out all unused binds. let binds' = filter dobind binds -- Only set the changed flag if binds got removed - changeif (length binds' /= length binds) (Let (Rec binds') res) + changeif (length binds' /= length binds) (mkNonRecLets binds' res) where + (binds, res) = flattenLets expr bound_exprs = map snd binds -- For each bind check if the bind is used by res or any of the bound -- expressions -- 2.30.2