From: Matthijs Kooijman Date: Fri, 14 Aug 2009 12:38:49 +0000 (+0200) Subject: Don't try to simplify nested lets. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fc%CE%BBash.git;a=commitdiff_plain;h=7d60f355a116d10adef0a66370d8bfa6a859e8b2 Don't try to simplify nested lets. This would cause loops with letflat (and possibly with itself as well). --- diff --git "a/c\316\273ash/CLasH/Normalize.hs" "b/c\316\273ash/CLasH/Normalize.hs" index 07ded20..6a4825d 100644 --- "a/c\316\273ash/CLasH/Normalize.hs" +++ "b/c\316\273ash/CLasH/Normalize.hs" @@ -146,6 +146,9 @@ letderectop = everywhere ("letderec", letderec) -- let simplification -------------------------------- letsimpl, letsimpltop :: Transform +-- Don't simplify a let that evaluates to another let, since this is already +-- normal form (and would cause infinite loops with letflat below). +letsimpl expr@(Let _ (Let _ _)) = return expr -- Put the "in ..." value of a let in its own binding, but not when the -- expression is already a local variable, or not representable (to prevent loops with inlinenonrep). letsimpl expr@(Let binds res) = do