diff options
| author | Joachim Breitner <mail@joachim-breitner.de> | 2014-01-24 13:35:21 +0000 | 
|---|---|---|
| committer | Joachim Breitner <mail@joachim-breitner.de> | 2014-02-11 15:36:23 +0000 | 
| commit | d557d8c34b80a9513b6ea36aeab6453173d83fa3 (patch) | |
| tree | d70aaa9c014041d442ad9d28101780415dbb08ef /compiler | |
| parent | f4fb94f366cc3c25f0d77e977611105ac75d9aa5 (diff) | |
| download | haskell-d557d8c34b80a9513b6ea36aeab6453173d83fa3.tar.gz | |
In simpleOptExpr, unfold compulsary unfoldings
such as that of coerce.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/coreSyn/CoreSubst.lhs | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/compiler/coreSyn/CoreSubst.lhs b/compiler/coreSyn/CoreSubst.lhs index 8531f92562..20394f2bc0 100644 --- a/compiler/coreSyn/CoreSubst.lhs +++ b/compiler/coreSyn/CoreSubst.lhs @@ -966,6 +966,10 @@ simple_app subst (Lam b e) (a:as)    where      (subst', b') = subst_opt_bndr subst b      b2 = add_info subst' b b' +simple_app subst (Var v) as +  | isCompulsoryUnfolding (idUnfolding v) +  -- See Note [Unfold compulsory unfoldings in LHSs] +  =  simple_app subst (unfoldingTemplate (idUnfolding v)) as  simple_app subst e as    = foldl App (simple_opt_expr subst e) as @@ -1112,6 +1116,13 @@ we don't know what phase we're in.  Here's an example  When inlining 'foo' in 'bar' we want the let-binding for 'inner'   to remain visible until Phase 1 +Note [Unfold compulsory unfoldings in LHSs] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When the user writes `map coerce = coerce` as a rule, the rule will only ever +match if we replace coerce by its unfolding on the LHS, because that is the +core that the rule matching engine will find. So do that for everything that +has a compulsory unfolding. Also see Note [Desugaring coerce as cast]  %************************************************************************  %*                                                                      * | 
