[commit: ghc] master: Use evaldUnfolding for proxyHashId (99cf459)

git at git.haskell.org git
Wed Oct 9 14:50:05 UTC 2013


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/99cf45942a395e116394712c529b05744d0b136b/ghc

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

commit 99cf45942a395e116394712c529b05744d0b136b
Author: Austin Seipp <austin at well-typed.com>
Date:   Wed Oct 9 08:49:19 2013 -0500

    Use evaldUnfolding for proxyHashId
    
    Edward and I noticed this - like realWorld#, we want things applied to
    proxy# which are INLINE more likely to be inlined - we do this by
    marking proxy# as having an evaldUnfolding, which in turn makes it look
    like the primitive is evaluated and makes the simplifier more willing to
    do so.
    
    See Note [evaldUnfoldings] in MkId.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

99cf45942a395e116394712c529b05744d0b136b
 compiler/basicTypes/MkId.lhs |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/compiler/basicTypes/MkId.lhs b/compiler/basicTypes/MkId.lhs
index 4a0b7d7..d398b3f 100644
--- a/compiler/basicTypes/MkId.lhs
+++ b/compiler/basicTypes/MkId.lhs
@@ -1056,7 +1056,8 @@ proxyName         = mkWiredInIdName gHC_PRIM (fsLit "proxy#")        proxyHashKe
 -- proxy# :: forall a. Proxy# a
 proxyHashId :: Id
 proxyHashId
-  = pcMiscPrelId proxyName ty noCafIdInfo
+  = pcMiscPrelId proxyName ty
+       (noCafIdInfo `setUnfoldingInfo` evaldUnfolding) -- Note [evaldUnfoldings]
   where
     ty      = mkForAllTys [kv, tv] (mkProxyPrimTy k t)
     kv      = kKiVar
@@ -1297,11 +1298,15 @@ This comes up in strictness analysis
 realWorldPrimId :: Id
 realWorldPrimId -- :: State# RealWorld
   = pcMiscPrelId realWorldName realWorldStatePrimTy
-                 (noCafIdInfo `setUnfoldingInfo` evaldUnfolding)
-        -- The evaldUnfolding makes it look that realWorld# is evaluated
-        -- which in turn makes Simplify.interestingArg return True,
-        -- which in turn makes INLINE things applied to realWorld# likely
-        -- to be inlined
+      (noCafIdInfo `setUnfoldingInfo` evaldUnfolding)  -- Note [evaldUnfoldings]
+
+{- Note [evaldUnfoldings]
+~~~~~~~~~~~~~~~~~~~~~~~~~
+The evaldUnfolding makes it look that some primitive value is
+evaluated, which in turn makes Simplify.interestingArg return True,
+which in turn makes INLINE things applied to said value likely to be
+inlined.
+-}
 
 voidArgId :: Id
 voidArgId       -- :: State# RealWorld




More information about the ghc-commits mailing list