[GHC] #7367: Optimiser / Linker Problem on amd64

GHC ghc-devs at haskell.org
Wed Aug 28 14:28:52 UTC 2013


#7367: Optimiser / Linker Problem on amd64
--------------------------------------------+------------------------------
        Reporter:  wurmli                   |            Owner:
            Type:  bug                      |           Status:  new
        Priority:  normal                   |        Milestone:  7.8.1
       Component:  Build System             |          Version:  7.6.1
      Resolution:                           |         Keywords:
Operating System:  Linux                    |     Architecture:  x86_64
 Type of failure:  Runtime performance bug  |  (amd64)
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------

Comment (by simonpj):

 Oh I missed that. `go` is recursive, but it only calls `f` as it exits.
 This refactoring would make that much clearer (including to the
 programmer), and GHC might even spot the linearity:
 {{{
 flopS :: Perm -> (Int -> IO a) -> IO a
 flopS !xs f = do
         let go !acc = do
                 k <- peekElemOff xs 0
                 if k == 0 then return acc else flop (fromIntegral k) xs >>
 go (acc+1)
         acc <- go 0
         f acc
 }}}
 However your points about controlling floating remain.  It would not be
 hard to add flags for "only float if the thing will get to top level" or
 "only float existing bindings, don't create new thunks".

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




More information about the ghc-tickets mailing list