Skip to content
  • Simon Peyton Jones's avatar
    Transfer INLINE to specialised functions · 8d227e35
    Simon Peyton Jones authored
    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.
    8d227e35