X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FsimplCore%2FCSE.lhs;h=3bcc17734e7ae6509a139c0e8850bbe110008e3a;hb=0f91b79dbb535bdd0378b752d72fc057cfe06d80;hp=66d6adc86ed9716de102a58d89c203c65462b205;hpb=7fc749a43b4b6b85d234fa95d4928648259584f4;p=ghc-hetmet.git diff --git a/compiler/simplCore/CSE.lhs b/compiler/simplCore/CSE.lhs index 66d6adc..3bcc177 100644 --- a/compiler/simplCore/CSE.lhs +++ b/compiler/simplCore/CSE.lhs @@ -117,8 +117,8 @@ Instead, we shoudl replace (f x) by (# a,b #). That is, the "reverse mapping" i f x --> (# a,b #) That is why the CSEMap has pairs of expressions. -Note [INLINE and NOINLINE] -~~~~~~~~~~~~~~~~~~~~~~~~~~ +Note [CSE for INLINE and NOINLINE] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We are careful to do no CSE inside functions that the user has marked as INLINE or NOINLINE. In terms of Core, that means @@ -171,7 +171,7 @@ Not CSE-ing inside INLINE also solves an annoying bug in CSE. Consider a worker/wrapper, in which the worker has turned into a single variable: $wf = h f = \x -> ...$wf... -Now CSE may transoform to +Now CSE may transform to f = \x -> ...h... But the WorkerInfo for f still says $wf, which is now dead! This won't happen now that we don't look inside INLINEs (which wrappers are). @@ -216,7 +216,7 @@ do_one env (id, rhs) (env', id') = addBinder env id rhs' | isAlwaysActive (idInlinePragma id) = cseExpr env' rhs | otherwise = rhs - -- See Note [INLINE and NOINLINE] + -- See Note [CSE for INLINE and NOINLINE] tryForCSE :: CSEnv -> CoreExpr -> CoreExpr tryForCSE env (Type t) = Type t @@ -231,7 +231,7 @@ cseExpr env (Type t) = Type t cseExpr env (Lit lit) = Lit lit cseExpr env (Var v) = Var (lookupSubst env v) cseExpr env (App f a) = App (cseExpr env f) (tryForCSE env a) -cseExpr evn (Note InlineMe e) = Note InlineMe e -- See Note [INLINE and NOINLINE] +cseExpr env (Note InlineMe e) = Note InlineMe e -- See Note [CSE for INLINE and NOINLINE] cseExpr env (Note n e) = Note n (cseExpr env e) cseExpr env (Cast e co) = Cast (cseExpr env e) co cseExpr env (Lam b e) = let (env', b') = addBinder env b