X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FsimplCore%2FFloatOut.lhs;h=2af48bde13c172814d0cba2abcb65d47857a61a5;hp=d5544517df9e298f73aee006b5d33d0d9f96626e;hb=7fc749a43b4b6b85d234fa95d4928648259584f4;hpb=f42d93f8f8395c6ee84a65ab4e45c52b8b8a5cb4 diff --git a/compiler/simplCore/FloatOut.lhs b/compiler/simplCore/FloatOut.lhs index d554451..2af48bd 100644 --- a/compiler/simplCore/FloatOut.lhs +++ b/compiler/simplCore/FloatOut.lhs @@ -6,12 +6,19 @@ ``Long-distance'' floating of bindings towards the top level. \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + 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 +231,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 +257,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)