Skip to content
  • Ömer Sinan Ağacan's avatar
    Make small INLINE functions behave properly · 8924224e
    Ömer Sinan Ağacan authored and Marge Bot's avatar Marge Bot committed
    Simon writes:
    
    Currently we check for a type arg rather than isTyCoArg.   This in turn
    makes INLINE things look bigger than they should be, and stops them
    being inlined into boring contexts when they perfectly well could be.
    E.g.
    
        f x = g <refl> x
        {-# INLINE g #-}
    
        ... (map (f x) xs) ...
    
    The context is boring, so don't inline unconditionally.  But f's RHS is
    no bigger than its call, provided you realise that the coercion argument
    is ultimately cost-free.
    
    This happens in practice for $WHRefl. It's not a big deal: at most it
    means we have an extra function call overhead.  But it's untidy, and
    actually worse than what happens without an INLINE pragma.
    
    Fixes #17182
    
    This makes 0.0% change in nofib binary sizes.
    8924224e