From: simonpj Date: Fri, 20 Jul 2001 10:08:56 +0000 (+0000) Subject: [project @ 2001-07-20 10:08:56 by simonpj] X-Git-Tag: Approximately_9120_patches~1497 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=debd4f60f37ca2658f3470a343476542253760ab;hp=98a74c9da8b10a3ba8fa2c261c2e26970c56a811;p=ghc-hetmet.git [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. --- 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,