Transfer INLINE to specialised functions
authorsimonpj@microsoft.com <unknown>
Wed, 21 Jun 2006 22:36:37 +0000 (22:36 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 21 Jun 2006 22:36:37 +0000 (22:36 +0000)
commit8d227e35da15330084dccbd67069d0804adccf4c
tree500d4468ea6019148dd8e150831b7daf8f132152
parent182ce7e265699c9fd326f59d29767923100a2d16
Transfer INLINE to specialised functions

When the Specialise pass generates a specialised copy of a function,
it should transfer the INLINE information to the specialised function.
Otherwise, whether or not the INLNE happens can depend on whether
specialisation happens, which seems wrong.  See Note [Inline specialisation]
in Specialise.lhs

Here's the example Roman reported

    primWriteMU :: UAE e => MUArr e s -> Int -> e -> ST s ()
    {-# INLINE primWriteMU #-}
    primWriteMU = writeMBU . unMUAPrim
    ------

    The problem is that primWriteMU doesn't get inlined *sometimes*, which
    results in code like

    case Data.Array.Parallel.Unlifted.Flat.UArr.$sprimWriteMU
    @ s11_X1nJ
    marr_s25s
    (GHC.Base.I# sc_s27F)
    GHC.Base.False
    new_s_a1Db
    of wild3_a1Dd { (# new_s1_X1F9, r_a1Dc #) -> ...

Note the fact that we have a call to the *specialised* $sprimWriteMU.
compiler/specialise/Specialise.lhs