From 7f7b6cefcfbcf81ca3abd18c65498c5ba4860204 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Mon, 5 Feb 2007 17:34:56 +0000 Subject: [PATCH] Use exprIsCheap in floating, just as the simplifier does --- compiler/simplCore/FloatOut.lhs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/FloatOut.lhs b/compiler/simplCore/FloatOut.lhs index d554451..1991531 100644 --- a/compiler/simplCore/FloatOut.lhs +++ b/compiler/simplCore/FloatOut.lhs @@ -11,7 +11,7 @@ module FloatOut ( floatOutwards ) where #include "HsVersions.h" import CoreSyn -import CoreUtils ( mkSCC, exprIsHNF, exprIsTrivial ) +import CoreUtils import DynFlags ( DynFlags, DynFlag(..), FloatOutSwitches(..) ) import ErrUtils ( dumpIfSet_dyn ) @@ -224,7 +224,7 @@ floatCaseAlt lvl arg -- Used rec rhss, and case-alternative rhss floatRhs lvl arg -- Used for nested non-rec rhss, and fn args -- See Note [Floating out of RHS] = case (floatExpr lvl arg) of { (fsa, floats, arg') -> - if exprIsHNF arg' || exprIsTrivial arg' then + if exprIsCheap arg' then (fsa, floats, arg') else case (partitionByMajorLevel lvl floats) of { (floats', heres) -> @@ -250,6 +250,9 @@ floatRhs lvl arg -- Used for nested non-rec rhss, and fn args -- bindings just after the '='. And some of them might (correctly) -- be strict even though the 'let f' is lazy, because f, being a value, -- gets its demand-info zapped by the simplifier. +-- +-- We use exprIsCheap because that is also what's used by the simplifier +-- to decide whether to float a let out of a let floatExpr _ (Var v) = (zeroStats, [], Var v) floatExpr _ (Type ty) = (zeroStats, [], Type ty) -- 1.7.10.4