[GHC] #13160: Simplify CoreFV.FVAnn
GHC
ghc-devs at haskell.org
Mon Apr 3 21:55:58 UTC 2017
#13160: Simplify CoreFV.FVAnn
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: bgamari
Type: task | Status: new
Priority: high | Milestone: 8.4.1
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3170
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by mpickering:
Old description:
> When introducing type-in-type, Richard elaborated the free varaible
> finder so that it finds three things at once (in `CoreFV`):
> {{{
> data FVAnn = FVAnn { fva_fvs :: DVarSet -- free in expression
> , fva_ty_fvs :: DVarSet -- free only in expression's
> type
> , fva_ty :: Type -- expression's type
> }
> }}}
> I think `fva_ty` is needed only to support `fva_ty_fvs`. And
> `fva_ty_fvs` seems to be used only to support the calls to
> `freeVarsOfType` in `FloatIn`. And those calls in turn are only to
> suppor `used_in_ty` in `FloatIn.sepBindsByDropPoint`.
>
> In conversation yesterday, Richard and I agreed that all this is
> unnecessary. Coercion bindings simply do not float inwards, so we do not
> need to take these precautions. (We should add a Note to explain why
> they don't float, and what problem might arise if they did.)
>
> To confirm this I set `used_in_ty` to `False` and compiled from scratch;
> everything is fine.
>
> So I propose that we
>
> * get rid of the `ty_fvs` argument to `sepBindsByDropPoint`
> * simplfy `FVAnn` to just gather free variables (ie one field only)
>
> Result: it's all simpler.
>
> Richard will do this when he gets a moment. But I really hope for 8.2
New description:
When introducing type-in-type, Richard elaborated the free variable finder
so that it finds three things at once (in `CoreFV`):
{{{
data FVAnn = FVAnn { fva_fvs :: DVarSet -- free in expression
, fva_ty_fvs :: DVarSet -- free only in expression's
type
, fva_ty :: Type -- expression's type
}
}}}
I think `fva_ty` is needed only to support `fva_ty_fvs`. And `fva_ty_fvs`
seems to be used only to support the calls to `freeVarsOfType` in
`FloatIn`. And those calls in turn are only to suppor `used_in_ty` in
`FloatIn.sepBindsByDropPoint`.
In conversation yesterday, Richard and I agreed that all this is
unnecessary. Coercion bindings simply do not float inwards, so we do not
need to take these precautions. (We should add a Note to explain why they
don't float, and what problem might arise if they did.)
To confirm this I set `used_in_ty` to `False` and compiled from scratch;
everything is fine.
So I propose that we
* get rid of the `ty_fvs` argument to `sepBindsByDropPoint`
* simplfy `FVAnn` to just gather free variables (ie one field only)
Result: it's all simpler.
Richard will do this when he gets a moment. But I really hope for 8.2
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13160#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list