From 7d60f355a116d10adef0a66370d8bfa6a859e8b2 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 14 Aug 2009 14:38:49 +0200 Subject: [PATCH] Don't try to simplify nested lets. This would cause loops with letflat (and possibly with itself as well). --- "c\316\273ash/CLasH/Normalize.hs" | 3 +++ 1 file changed, 3 insertions(+) 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 -- 2.30.2