diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2016-07-06 15:44:18 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2016-07-11 11:14:39 +0200 |
commit | cc95b211e7d08cda47d3e86632b5f514d5c8a876 (patch) | |
tree | 7f1523520664b5d1d6ac28f5b46aa4cbace472d8 /compiler/coreSyn/CoreSyn.hs | |
parent | 0ab63cf48580abbfe15ece934aec093203f29ed2 (diff) | |
download | haskell-wip/T12370.tar.gz |
Demand analyser: Implement LetUp rule (#12370)wip/T12370
This makes the implementation match the description in the paper more
closely: There, a let binding that is not a function has first its body
analised, and then the binding’s RHS. This way, the demand on the bound
variable by the body can be fed into the RHS, yielding more precise
results.
Performance measurements do unfortunately not show significant
improvements or regessions.
Differential Revision: https://phabricator.haskell.org/D2395
Diffstat (limited to 'compiler/coreSyn/CoreSyn.hs')
-rw-r--r-- | compiler/coreSyn/CoreSyn.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index a6f8f82ec8..9ddad9cea1 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -32,6 +32,7 @@ module CoreSyn ( -- ** Simple 'Expr' access functions and predicates bindersOf, bindersOfBinds, rhssOfBind, rhssOfAlts, collectBinders, collectTyBinders, collectTyAndValBinders, + isLam, collectArgs, collectArgsTicks, flattenBinds, exprToType, exprToCoercion_maybe, @@ -1656,6 +1657,13 @@ collectTyAndValBinders expr (tvs, body1) = collectTyBinders expr (ids, body) = collectValBinders body1 +-- | Is this a lambda (not hidden inside a cast or so)? +-- This relates to 'collectBinders': +-- > isLam e /= null (fst (collectBinders e)) +isLam :: CoreExpr -> Bool +isLam (Lam _ _) = True +isLam _ = False + -- | Takes a nested application expression and returns the the function -- being applied and the arguments to which it is applied collectArgs :: Expr b -> (Expr b, [Arg b]) |