mkUnpackCase, mkProductBox )
import TysWiredIn ( tupleCon )
import Type ( Type, isUnLiftedType, mkFunTys,
- splitForAllTys, splitFunTys, splitRecNewType_maybe, isAlgType
+ splitForAllTys, splitFunTys, isAlgType
)
-import Coercion ( Coercion, mkSymCoercion, splitRecNewTypeCo_maybe )
+import Coercion ( mkSymCoercion, splitNewTypeRepCo_maybe )
import BasicTypes ( Boxity(..) )
import Var ( Var, isId )
import UniqSupply ( returnUs, thenUs, getUniquesUs, UniqSM )
mkWWcpr res_ty res_info
else
returnUs (id, id, res_ty)
- ) `thenUs` \ (wrap_fn_cpr, work_fn_cpr, cpr_res_ty) ->
+ ) `thenUs` \ (wrap_fn_cpr, work_fn_cpr, _cpr_res_ty) ->
- returnUs ([idNewDemandInfo v | v <- work_args, isId v],
+ returnUs ([idNewDemandInfo v | v <- work_call_args, isId v],
Note InlineMe . wrap_fn_args . wrap_fn_cpr . wrap_fn_str . applyToVars work_call_args . Var,
mkLams work_lam_args. work_fn_str . work_fn_cpr . work_fn_args)
-- We use an INLINE unconditionally, even if the wrapper turns out to be
Type) -- Type of wrapper body
mkWWargs fun_ty demands one_shots
- | Just (rep_ty, co) <- splitRecNewTypeCo_maybe fun_ty
+ | Just (rep_ty, co) <- splitNewTypeRepCo_maybe fun_ty
-- The newtype case is for when the function has
-- a recursive newtype after the arrow (rare)
-- We check for arity >= 0 to avoid looping in the case
-- simply coerces.
= mkWWargs rep_ty demands one_shots `thenUs` \ (wrap_args, wrap_fn_args, work_fn_args, res_ty) ->
returnUs (wrap_args,
- \ e -> Cast (wrap_fn_args e) co,
- \ e -> work_fn_args (Cast e (mkSymCoercion co)),
+ \ e -> Cast (wrap_fn_args e) (mkSymCoercion co),
+ \ e -> work_fn_args (Cast e co),
res_ty)
| notNull demands
= getUniquesUs `thenUs` \ wrap_uniqs ->
-- Unpack case
Eval (Prod cs)
- | Just (arg_tycon, tycon_arg_tys, data_con, inst_con_arg_tys)
+ | Just (_arg_tycon, _tycon_arg_tys, data_con, inst_con_arg_tys)
<- deepSplitProductType_maybe (idType arg)
-> getUniquesUs `thenUs` \ uniqs ->
let
unpk_args = zipWith mk_ww_local uniqs inst_con_arg_tys
unpk_args_w_ds = zipWithEqual "mkWWstr" set_worker_arg_info unpk_args cs
- unbox_fn = mkUnpackCase (sanitiseCaseBndr arg) (Var arg) (idType arg) unpk_args data_con
+ unbox_fn = mkUnpackCase (sanitiseCaseBndr arg) (Var arg) unpk_args data_con
rebox_fn = Let (NonRec arg con_app)
con_app = mkProductBox unpk_args (idType arg)
in
con_app = mkProductBox [arg] body_ty
in
returnUs (\ wkr_call -> Case wkr_call (arg) (exprType con_app) [(DEFAULT, [], con_app)],
- \ body -> workerCase (work_wild) body body_ty [arg] data_con (Var arg),
+ \ body -> workerCase (work_wild) body [arg] data_con (Var arg),
con_arg_ty1)
| otherwise -- The general case
con_app = mkProductBox args body_ty
in
returnUs (\ wkr_call -> Case wkr_call (wrap_wild) (exprType con_app) [(DataAlt ubx_tup_con, args, con_app)],
- \ body -> workerCase (work_wild) body body_ty args data_con ubx_tup_app,
+ \ body -> workerCase (work_wild) body args data_con ubx_tup_app,
ubx_tup_ty)
where
- (_, tycon_arg_tys, data_con, con_arg_tys) = deepSplitProductType "mkWWcpr" body_ty
+ (_arg_tycon, _tycon_arg_tys, data_con, con_arg_tys) = deepSplitProductType "mkWWcpr" body_ty
n_con_args = length con_arg_tys
con_arg_ty1 = head con_arg_tys
-- This transform doesn't move work or allocation
-- from one cost centre to another
-workerCase bndr (Note (SCC cc) e) ty args con body = Note (SCC cc) (mkUnpackCase bndr e ty args con body)
-workerCase bndr e ty args con body = mkUnpackCase bndr e ty args con body
+workerCase bndr (Note (SCC cc) e) args con body = Note (SCC cc) (mkUnpackCase bndr e args con body)
+workerCase bndr e args con body = mkUnpackCase bndr e args con body
\end{code}