[GHC] #3697: Method selectors aren't floated out of loops

GHC ghc-devs at haskell.org
Mon Feb 10 16:45:25 UTC 2014


#3697: Method selectors aren't floated out of loops
--------------------------------------------+------------------------------
        Reporter:  rl                       |            Owner:
            Type:  bug                      |           Status:  closed
        Priority:  low                      |        Milestone:  7.6.2
       Component:  Compiler                 |          Version:  6.13
      Resolution:  fixed                    |         Keywords:
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  Runtime performance bug  |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------
Changes (by nomeata):

 * status:  new => closed
 * difficulty:   => Unknown
 * resolution:   => fixed


Comment:

 With todays HEAD, I get good code:

 {{{
 T3697.foo =
   \ (@ a)
     ($dEq :: GHC.Classes.Eq a)
     ($dNum :: GHC.Num.Num a)
     (as :: [a]) ->
     let {
       ds :: a
       [LclId, Str=DmdType]
       ds = GHC.Num.fromInteger @ a $dNum T3697.foo1 } in
     let {
       lvl :: a -> a -> GHC.Types.Bool
       [LclId, Str=DmdType]
       lvl = GHC.Classes./= @ a $dEq } in
     let {
       lvl1 :: a -> a -> a
       [LclId, Str=DmdType]
       lvl1 = GHC.Num.- @ a $dNum } in
     letrec {
       go [Occ=LoopBreaker] :: [a] -> [a]
       [LclId, Arity=1, Str=DmdType <S,1*U>]
       go =
         \ (ds1 :: [a]) ->
           case ds1 of _ [Occ=Dead] {
             [] -> GHC.Types.[] @ a;
             : y ys ->
               let {
                 x :: a
                 [LclId, Str=DmdType]
                 x = lvl1 y y } in
               case lvl x ds of _ [Occ=Dead] {
                 GHC.Types.False -> go ys;
                 GHC.Types.True -> GHC.Types.: @ a x (go ys)
               }
           }; } in
     go as
 }}}

 Given the age of the bug, I don’t dare to guess what has fixed this. Also,
 hard to make a useful testcase here.

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


More information about the ghc-tickets mailing list