diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2016-08-06 22:17:09 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2017-01-09 16:36:39 +0000 |
commit | 75cba70113e47fa4f3e60ab6d18594f7a6dfb1bc (patch) | |
tree | 948ab0829e6b35946bd2164add7ddf0bce662769 /compiler/specialise/Specialise.hs | |
parent | 8c7250379d0d2bad1d07dfd556812ff7aa2c42e8 (diff) | |
download | haskell-wip/all-inlinable.tar.gz |
Always expose unfoldings for overloaded functions.wip/all-inlinable
Summary:
Users expect their overloaded functions to be specialised at call sites,
however, this is only the case if they are either lucky and GHC chooses to
include the unfolding or they mark their definition with an INLINABLE pragma.
This leads to library authors marking all their functions with `INLINABLE` (or
more accurately `INLINE`) so they ensure that downstream consumers pay no cost
for their abstraction.
A more sensible default is to do this job for the library author and give more
predictable guarantees about specialisation.
Empirically, I compiled a selection of 1150 packages with (a similar) patch applied. The total size of the interface files before the patch was 519mb and after 634mb. On modern machines, I think this increase is justified for the result.
Reviewers: simonpj, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2929
Conflicts:
compiler/specialise/Specialise.hs
Diffstat (limited to 'compiler/specialise/Specialise.hs')
-rw-r--r-- | compiler/specialise/Specialise.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 33ce1acbde..159fbf7248 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -753,13 +753,17 @@ wantSpecImport dflags unf NoUnfolding -> False OtherCon {} -> False DFunUnfolding {} -> True - CoreUnfolding { uf_src = src, uf_guidance = _guidance } + CoreUnfolding { uf_src = src, uf_guidance = _guidance } -> True + +{- | gopt Opt_SpecialiseAggressively dflags -> True | isStableSource src -> True -- Specialise even INLINE things; it hasn't inlined yet, -- so perhaps it never will. Moreover it may have calls -- inside it that we want to specialise | otherwise -> False -- Stable, not INLINE, hence INLINEABLE + | otherwise -> False -- Stable, not INLINE, hence INLINABLE +-} {- Note [Warning about missed specialisations] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |