Skip to content
  • Simon Peyton Jones's avatar
    Fix INLINE pragmas in desugarer · 3d5cb335
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    In #19969 we discovered that GHC has has a bug *forever* that means it
    sometimes essentially discarded INLINE pragams.  This happened when you have
    * Two more more mutually recursive functions
    * Some of which (presumably not all!) have an INLINE pragma
    * Completely monomorphic.
    
    This hits a particular case in GHC.HsToCore.Binds.dsAbsBinds, which was
    simply wrong -- it put the INLINE pragma on the wrong binder.
    
    This patch fixes the bug, rather easily, by adjusting the
    no-tyvar, no-dict case of GHC.HsToCore.Binds.dsAbsBinds.
    
    I also discovered that the GHC.Core.Opt.Pipeline.shortOutIndirections
    was not doing a good job for
    
        {-# INLINE lcl_id #-}
        lcl_id = BIG
    
        gbl_id = lcl_id
    
    Here we want to transfer the stable unfolding to gbl_id (we do), but
    we also want to remove it from lcl_id (we were not doing that).
    Otherwise both Ids have large stable unfoldings.  Easily fixed.
    Note [Transferring IdInfo] explains.
    3d5cb335