[GHC] #14186: CSE fails to CSE two identical large top-level functions

GHC ghc-devs at haskell.org
Tue Sep 5 23:23:39 UTC 2017


#14186: CSE fails to CSE two identical large top-level functions
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Ha ha.   This is caused by two things

 1.  We don't CSE things with an INLINE pragma: see `Note [CSE for INLINE
 and NOINLINE]` in `CSE.hs`

 2.  The worker/wrapper pass (right after demand analysis) gives the
 wrapper an inline pragma of `INLINE[0]`.

 So (2) means that (1) means no CSE for `foo` and `bar`.  Sigh.  What to
 do?

 Well

 * `InlinePragma` already distinguishse between the `inl_inline` field and
 `inl_act`.  See `Note [inl_inline and inl_act]` in `BasicTypes`.

 * So we should be able to distinguish between a user-supplied INLINE
 pragma `inl_inline` and one supplied the w/w pass.

 * If we could distinguish then CSDE could fail on the user-supplied kind,
 but succeed on the w/w supplied kind.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14186#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list