[GHC] #13369: Float-out is not idempotent

GHC ghc-devs at haskell.org
Fri Mar 3 10:50:15 UTC 2017


#13369: Float-out is not idempotent
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider
 {{{
 f x = BIG
 }}}
 where BIG is bottoming.  In HEAD, the float-out pass decides to float BIG
 to the top level, producing
 {{{
 lvl x = BIG
 f x = lvl x
 }}}
 which is obviously stupid.

 There's a whole Note to explain this problem and how we avoid it:
 {{{
 Note [Floating from a RHS]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 When float the RHS of a let-binding, we don't always want to apply
 lvlMFE to the body of a lambda, as we usually do, because the entire
 binding body is already going to the right place (dest_lvl).

 A particular example is the top level.  Consider
    concat = /\ a -> foldr ..a.. (++) []
 We don't want to float the body of the lambda to get
    lvl    = /\ a -> foldr ..a.. (++) []
    concat = /\ a -> lvl a
 That would be stupid.
 }}}
 But I forgot to take account of the possibility that `abs_vars` might
 abstract over Ids.  Easily fixed.

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


More information about the ghc-tickets mailing list