X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fstranal%2FWorkWrap.lhs;h=2f5d38c0691aac0ed2f5c72e0a690eb8537532f1;hb=a4c34367ce3e836f52f0ffb1e379ce81b8d65316;hp=64eba892738b01fd615b78ac70d3d77bd7c4a7f6;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/stranal/WorkWrap.lhs b/compiler/stranal/WorkWrap.lhs index 64eba89..2f5d38c 100644 --- a/compiler/stranal/WorkWrap.lhs +++ b/compiler/stranal/WorkWrap.lhs @@ -26,7 +26,7 @@ import NewDemand ( Demand(..), StrictSig(..), DmdType(..), DmdResult(..), ) import UniqSupply ( UniqSupply, initUs_, returnUs, thenUs, mapUs, getUniqueUs, UniqSM ) import Unique ( hasKey ) -import BasicTypes ( RecFlag(..), isNonRec, Activation(..) ) +import BasicTypes ( RecFlag(..), isNonRec ) import VarEnv ( isEmptyVarEnv ) import Maybes ( orElse ) import DynFlags @@ -137,7 +137,7 @@ wwExpr e@(Note InlineMe expr) = returnUs e wwExpr e@(Var v) | v `hasKey` lazyIdKey = returnUs lazyIdUnfolding | otherwise = returnUs e - -- Inline 'lazy' after strictness analysis + -- HACK alert: Inline 'lazy' after strictness analysis -- (but not inside InlineMe's) wwExpr (Lam binder expr) @@ -153,6 +153,10 @@ wwExpr (Note note expr) = wwExpr expr `thenUs` \ new_expr -> returnUs (Note note new_expr) +wwExpr (Cast expr co) + = wwExpr expr `thenUs` \ new_expr -> + returnUs (Cast new_expr co) + wwExpr (Let bind expr) = wwBind bind `thenUs` \ intermediate_bind -> wwExpr expr `thenUs` \ new_expr -> @@ -256,14 +260,19 @@ splitFun fn_id fn_info wrap_dmds res_info inline_prag rhs work_rhs = work_fn rhs work_id = mkWorkerId work_uniq fn_id (exprType work_rhs) `setInlinePragma` inline_prag + -- Any inline pragma (which sets when inlining is active) + -- on the original function is duplicated on the worker and wrapper + -- It *matters* that the pragma stays on the wrapper + -- It seems sensible to have it on the worker too, although we + -- can't think of a compelling reason. (In ptic, INLINE things are + -- not w/wd) `setIdNewStrictness` StrictSig (mkTopDmdType work_demands work_res_info) -- Even though we may not be at top level, -- it's ok to give it an empty DmdEnv wrap_rhs = wrap_fn work_id wrap_id = fn_id `setIdWorkerInfo` HasWorker work_id arity - `setInlinePragma` AlwaysActive -- Zap any inline pragma; - -- Put it on the worker instead + in returnUs ([(work_id, work_rhs), (wrap_id, wrap_rhs)]) -- Worker first, because wrapper mentions it