[GHC] #14790: eqTypeRep does not inline

GHC ghc-devs at haskell.org
Mon Feb 12 10:46:46 UTC 2018


#14790: eqTypeRep does not inline
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.1-alpha2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 I looked at the interface file for `Data.Typeable.Internal` where
 `eqTypeRep` is defined. Here is the unfolding for `eqTypeRep`.

 {{{
 855825a70951c01dfa45bc3067373660
   eqTypeRep ::
     forall k1 k2 (a :: k1) (b :: k2).
     TypeRep a -> TypeRep b -> Maybe (a :~~: b)
   {- Arity: 2, Strictness: <S,1*U><S,1*U>,
      Unfolding: (\ @ k1
                    @ k2
                    @ a :: k1
                    @ b :: k2
                    (a1 :: TypeRep a)
                    (b1 :: TypeRep b) ->
                  let {
                    $j :: Word# -> Word# -> Maybe (a :~~: b)
                      <join 2> {- Arity: 2, Strictness: <S,U><L,U> -}
                    = \ (dt :: Word#)[OneShot] (dt1 :: Word#)[OneShot] ->
                      case b1 of wild {
                        TrType co co1
                        -> case fpTYPELiftedRep of wild1 { Fingerprint dt2
 dt3 ->
                           case eqWord# dt dt2 of lwild {
                             DEFAULT -> Nothing @ (a :~~: b)
                             1#
                             -> case eqWord# dt1 dt3 of lwild1 {
                                  DEFAULT -> Nothing @ (a :~~: b)
                                  1# -> eqTypeRep1 @ k1 @ a @ k2 @ b } } }
                        TrTyCon dt2 dt3 ds ds1 ds2
                        -> case eqWord# dt dt2 of lwild {
                             DEFAULT -> Nothing @ (a :~~: b)
                             1#
                             -> case eqWord# dt1 dt3 of lwild1 {
                                  DEFAULT -> Nothing @ (a :~~: b)
                                  1# -> eqTypeRep1 @ k1 @ a @ k2 @ b } }
                        TrApp k4 a2 b2 co dt2 dt3 ds ds1 ds2
                        -> case eqWord# dt dt2 of lwild {
                             DEFAULT -> Nothing @ (a :~~: b)
                             1#
                             -> case eqWord# dt1 dt3 of lwild1 {
                                  DEFAULT -> Nothing @ (a :~~: b)
                                  1# -> eqTypeRep1 @ k1 @ a @ k2 @ b } }
                        TrFun r1 r2 a2 b2 co co1 dt2 dt3 ds ds1
                        -> case eqWord# dt dt2 of lwild {
                             DEFAULT -> Nothing @ (a :~~: b)
                             1#
                             -> case eqWord# dt1 dt3 of lwild1 {
                                  DEFAULT -> Nothing @ (a :~~: b)
                                  1# -> eqTypeRep1 @ k1 @ a @ k2 @ b } } }
                  } in
                  case a1 of wild {
                    TrType co co1
                    -> case fpTYPELiftedRep of wild1 { Fingerprint dt dt1
 ->
                       $j dt dt1 }
                    TrTyCon dt dt1 ds ds1 ds2 -> $j dt dt1
                    TrApp k4 a2 b2 co dt dt1 ds ds1 ds2 -> $j dt dt1
 TrFun r1 r2 a2 b2 co co1 dt dt1 ds ds1 -> $j dt dt1 }) -}
 }}}

 It appears that both functions I mentioned above are inlined (to no great
 effect) which make the definition quite large.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14790#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list