From 0a831b28a4037047c19aa15ecf140fa56e3c088c Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 17 Dec 2001 12:32:05 +0000 Subject: [PATCH] [project @ 2001-12-17 12:32:05 by simonmar] mkLocalNonRec bug fix: we always want to generate a case when the rhs of a binding is an unlifted type. Previously the two cases for an unlifted rhs and a strict binding were handled together which caused some confusion, so now the cases are separate. --- ghc/compiler/coreSyn/CorePrep.lhs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/coreSyn/CorePrep.lhs b/ghc/compiler/coreSyn/CorePrep.lhs index 1948974..da19ebd 100644 --- a/ghc/compiler/coreSyn/CorePrep.lhs +++ b/ghc/compiler/coreSyn/CorePrep.lhs @@ -504,11 +504,17 @@ mkLocalNonRec :: Id -> RhsDemand -- Lhs: id with demand -> UniqSM (OrdList FloatingBind) mkLocalNonRec bndr dem floats rhs - | isUnLiftedType (idType bndr) || isStrict dem - -- It's a strict let, or the binder is unlifted, - -- so we definitely float all the bindings + | isUnLiftedType (idType bndr) + -- If this is an unlifted binding, we always make a case for it. = ASSERT( not (isUnboxedTupleType (idType bndr)) ) - let -- Don't make a case for a value binding, + let + float = FloatCase bndr rhs (exprOkForSpeculation rhs) + in + returnUs (floats `snocOL` float) + + | isStrict dem + -- It's a strict let so we definitely float all the bindings + = let -- Don't make a case for a value binding, -- even if it's strict. Otherwise we get -- case (\x -> e) of ...! float | exprIsValue rhs = FloatLet (NonRec bndr rhs) -- 1.7.10.4