X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FsimplCore%2FCSE.lhs;h=4eb977d5bb42e417a99925e77e394bbd8d0560f5;hb=5f087cf4add4e140e7df05d896ee6b271133f822;hp=66038f394c45cb74414927c577319173590ada53;hpb=d364541154457a49e3c35d671d7a1b57c9c4cca3;p=ghc-hetmet.git diff --git a/ghc/compiler/simplCore/CSE.lhs b/ghc/compiler/simplCore/CSE.lhs index 66038f3..4eb977d 100644 --- a/ghc/compiler/simplCore/CSE.lhs +++ b/ghc/compiler/simplCore/CSE.lhs @@ -10,7 +10,7 @@ module CSE ( #include "HsVersions.h" -import CmdLineOpts ( DynFlag(..), DynFlags, dopt ) +import CmdLineOpts ( DynFlag(..), DynFlags ) import Id ( Id, idType ) import CoreUtils ( hashExpr, cheapEqExpr, exprIsBig, mkAltExpr ) import DataCon ( isUnboxedTupleCon ) @@ -21,7 +21,7 @@ import CoreSyn import VarEnv import CoreLint ( showPass, endPass ) import Outputable -import Util ( mapAccumL ) +import Util ( mapAccumL, lengthExceeds ) import UniqFM \end{code} @@ -220,12 +220,14 @@ lookup_list ((x,e):es) expr | cheapEqExpr e expr = Just x addCSEnvItem env id expr | exprIsBig expr = env | otherwise = extendCSEnv env id expr + -- We don't try to CSE big expressions, because they are expensive to compare + -- (and are unlikely to be the same anyway) extendCSEnv (CS cs in_scope sub) id expr = CS (addToUFM_C combine cs hash [(id, expr)]) in_scope sub where hash = hashExpr expr - combine old new = WARN( length result > 4, text "extendCSEnv: long list:" <+> ppr result ) + combine old new = WARN( result `lengthExceeds` 4, text "extendCSEnv: long list:" <+> ppr result ) result where result = new ++ old