[GHC] #13080: Constant values are not floated out of the loop

GHC ghc-devs at haskell.org
Sat Jan 7 21:36:16 UTC 2017


#13080: Constant values are not floated out of the loop
-------------------------------------+-------------------------------------
        Reporter:  Feuerbach         |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 I missed something. It seems that `{-# NOINLINE #-}` here is effectively
 preventing `poll` from being specialized within its own RHS. While the
 constant argument ends up going away, the constant `Monad` dictionary does
 not. Writing

 {{{#!hs
 poll :: (Monad m) => x -> m a
 poll = go where
   go action = do
     return ()
     go action
 }}}

 fixes the leak. So maybe something needs to be changed to allow internal
 specialization in the face of `NOINLINE`? Of course, that could have some
 other downside.

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


More information about the ghc-tickets mailing list