From: simonpj Date: Mon, 5 Nov 2001 16:45:02 +0000 (+0000) Subject: [project @ 2001-11-05 16:45:02 by simonpj] X-Git-Tag: Approximately_9120_patches~639 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d5f79e6e7bab767de9c528ac343132d8daeab0da;p=ghc-hetmet.git [project @ 2001-11-05 16:45:02 by simonpj] Wibble to eta reduction --- diff --git a/ghc/compiler/simplCore/SimplUtils.lhs b/ghc/compiler/simplCore/SimplUtils.lhs index ffeb43c..51504c6 100644 --- a/ghc/compiler/simplCore/SimplUtils.lhs +++ b/ghc/compiler/simplCore/SimplUtils.lhs @@ -546,7 +546,11 @@ tryEtaReduce bndrs body go [] (Var fun) | ok_fun fun = Just (Var fun) -- Success! go _ _ = Nothing -- Failure! - ok_fun fun = not (fun `elem` bndrs) + ok_fun fun = not (fun `elem` bndrs) && + isEvaldUnfolding (idUnfolding fun) + -- The exprIsValue is because eta reduction is not + -- valid in general: \x. bot /= bot + -- So we need to be sure that the "fun" is a value. ok_arg b arg = varToCoreExpr b `cheapEqExpr` arg \end{code}