Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/0741ca5c410ecf6d21796a0887213673a3ebc373 >--------------------------------------------------------------- commit 0741ca5c410ecf6d21796a0887213673a3ebc373 Author: Simon Peyton Jones <[email protected]> Date: Mon Mar 12 09:04:32 2012 +0000 Fix another bug in CorePrep eta-reduction (fixes Trac #5915) CorePrep has its own eta reducer (for tiresome reasons) and it was being sloppy about making sure it didn't change termination behaviour. Thanks to Michal Palka for discovering this. >--------------------------------------------------------------- compiler/coreSyn/CorePrep.lhs | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/coreSyn/CorePrep.lhs b/compiler/coreSyn/CorePrep.lhs index ed28809..7f10713 100644 --- a/compiler/coreSyn/CorePrep.lhs +++ b/compiler/coreSyn/CorePrep.lhs @@ -870,10 +870,12 @@ get to a partial application: \begin{code} tryEtaReducePrep :: [CoreBndr] -> CoreExpr -> Maybe CoreExpr tryEtaReducePrep bndrs expr@(App _ _) - | ok_to_eta_reduce f && - n_remaining >= 0 && - and (zipWith ok bndrs last_args) && - not (any (`elemVarSet` fvs_remaining) bndrs) + | ok_to_eta_reduce f + , n_remaining >= 0 + , and (zipWith ok bndrs last_args) + , not (any (`elemVarSet` fvs_remaining) bndrs) + , exprIsHNF remaining_expr -- Don't turn value into a non-value + -- else the behaviour with 'seq' changes = Just remaining_expr where (f, args) = collectArgs expr @@ -885,9 +887,9 @@ tryEtaReducePrep bndrs expr@(App _ _) ok bndr (Var arg) = bndr == arg ok _ _ = False - -- we can't eta reduce something which must be saturated. + -- We can't eta reduce something which must be saturated. ok_to_eta_reduce (Var f) = not (hasNoBinding f) - ok_to_eta_reduce _ = False --safe. ToDo: generalise + ok_to_eta_reduce _ = False -- Safe. ToDo: generalise tryEtaReducePrep bndrs (Let bind@(NonRec _ r) body) | not (any (`elemVarSet` fvs) bndrs) _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
