[commit: ghc] wip/all-inlinable: Inline work start (4e3fc82)

git at git.haskell.org git at git.haskell.org
Fri Jan 6 16:34:37 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/all-inlinable
Link       : http://ghc.haskell.org/trac/ghc/changeset/4e3fc8264c40c312595d664e47b81aa9066cb58b/ghc

>---------------------------------------------------------------

commit 4e3fc8264c40c312595d664e47b81aa9066cb58b
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Sat Aug 6 22:17:09 2016 +0100

    Inline work start


>---------------------------------------------------------------

4e3fc8264c40c312595d664e47b81aa9066cb58b
 compiler/deSugar/DsBinds.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs
index bb1dc50..bb15c95 100644
--- a/compiler/deSugar/DsBinds.hs
+++ b/compiler/deSugar/DsBinds.hs
@@ -361,7 +361,11 @@ makeCorePair :: DynFlags -> Id -> Bool -> Arity -> CoreExpr -> (Id, CoreExpr)
 makeCorePair dflags gbl_id is_default_method dict_arity rhs
   | is_default_method                 -- Default methods are *always* inlined
   = (gbl_id `setIdUnfolding` mkCompulsoryUnfolding rhs, rhs)
-
+  | (isId gbl_id) &&
+    (isEmptyInlineSpec inline_spec) &&
+      (isOverloadedTy (idType gbl_id))
+  = (gbl_id `setIdUnfolding` inlinable_unf, rhs)
+    -- Expose unfolding of overloaded function if we know no better
   | otherwise
   = case inlinePragmaSpec inline_prag of
           EmptyInlineSpec -> (gbl_id, rhs)
@@ -371,6 +375,7 @@ makeCorePair dflags gbl_id is_default_method dict_arity rhs
 
   where
     inline_prag   = idInlinePragma gbl_id
+    inline_spec   = inlinePragmaSpec inline_prag
     inlinable_unf = mkInlinableUnfolding dflags rhs
     inline_pair
        | Just arity <- inlinePragmaSat inline_prag



More information about the ghc-commits mailing list