From debd4f60f37ca2658f3470a343476542253760ab Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 20 Jul 2001 10:08:56 +0000 Subject: [PATCH] [project @ 2001-07-20 10:08:56 by simonpj] -------------------------------------------- Hack around an infelicity in the simplifier ------------------------------------------- Use 3 iterations of the simplifier (instead of the previous 2) because otherwise we land up with huge dead expressions. Reason: an infelicity in the simpifier. let k = BIG in foldr k z xs ==> let k = BIG in letrec go = \xs -> ...(k x).... in go xs ==> let k = BIG in letrec go = \xs -> ...(BIG x).... in go xs Don't stop now! I couldn't see an easy way to make the simplifier avoid this big intermediate, so I hacked round it like this. --- ghc/compiler/main/DriverState.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index e9e8aec..75f2cea 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverState.hs,v 1.49 2001/07/17 15:28:30 simonpj Exp $ +-- $Id: DriverState.hs,v 1.50 2001/07/20 10:08:56 simonpj Exp $ -- -- Settings for the driver -- @@ -243,9 +243,17 @@ buildCoreToDo = do ]), CoreDoSimplify (isAmongSimpl [ - MaxSimplifierIterations 2 + MaxSimplifierIterations 3 -- No -finline-phase: allow all Ids to be inlined now -- This gets foldr inlined before strictness analysis + -- + -- At least 3 iterations because otherwise we land up with + -- huge dead expressions because of an infelicity in the + -- simpifier. + -- let k = BIG in foldr k z xs + -- ==> let k = BIG in letrec go = \xs -> ...(k x).... in go xs + -- ==> let k = BIG in letrec go = \xs -> ...(BIG x).... in go xs + -- Don't stop now! ]), if cpr then CoreDoCPResult else CoreDoNothing, -- 1.7.10.4