diff options
Diffstat (limited to 'compiler/stranal/DmdAnal.hs')
-rw-r--r-- | compiler/stranal/DmdAnal.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 49368cd1db..3d6c376448 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -115,9 +115,9 @@ dmdAnalStar :: AnalEnv -> Demand -- This one takes a *Demand* -> CoreExpr -> (BothDmdArg, CoreExpr) dmdAnalStar env dmd e - | (cd, defer_and_use) <- toCleanDmd dmd (exprType e) + | (defer_and_use, cd) <- toCleanDmd dmd (exprType e) , (dmd_ty, e') <- dmdAnal env cd e - = (postProcessDmdTypeM defer_and_use dmd_ty, e') + = (postProcessDmdType defer_and_use dmd_ty, e') -- Main Demand Analsysis machinery dmdAnal, dmdAnal' :: AnalEnv @@ -197,10 +197,12 @@ dmdAnal' env dmd (Lam var body) (body_ty, Lam var body') | otherwise - = let (body_dmd, defer_and_use@(_,one_shot)) = peelCallDmd dmd - -- body_dmd - a demand to analyze the body - -- one_shot - one-shotness of the lambda - -- hence, cardinality of its free vars + = let (body_dmd, defer_and_use) = peelCallDmd dmd + -- body_dmd: a demand to analyze the body + + one_shot = useCount (getUseDmd defer_and_use) + -- one_shot: one-shotness of the lambda + -- hence, cardinality of its free vars env' = extendSigsWithLam env var (body_ty, body') = dmdAnal env' body_dmd body |