Skip to content
  • Sebastian Graf's avatar
    Make sure forM_ and related functions fuse cleanly · e655aac1
    Sebastian Graf authored and Krzysztof Gogolewski's avatar Krzysztof Gogolewski committed
    Summary:
    It was revealed in #8763 that it's hard to come up with a list fusion
    helper for `efdtIntFB` that doesn't duplicated occurrences of `c`,
    which is crucial in guaranteeing that it is inlined.
    
    Not inlining `c` led to spoiled join points, in turn leading to unnecessary
    heap allocation. This patch tackles the problem from a different angle:
    Fixing all consumers instead of the less often used producer
    `efdtIntFB` by inserting an INLINE pragma in the appropriate places.
    See https://ghc.haskell.org/trac/ghc/ticket/8763#comment:76 and the new
    Note [List fusion and continuations in 'c'].
    
    A quick run of NoFib revealed no regression or improvements whatsoever.
    
    Reviewers: hvr, bgamari, simonpj
    
    Reviewed By: simonpj
    
    Subscribers: simonpj, rwbarton, carter
    
    GHC Trac Issues: #8763
    
    Differential Revision: https://phabricator.haskell.org/D5131
    e655aac1