[GHC] #2163: GHC makes thunks for Integers we are strict in

GHC trac at galois.com
Mon Mar 17 20:17:40 EDT 2008


#2163: GHC makes thunks for Integers we are strict in
--------------------------------------+-------------------------------------
 Reporter:  igloo                     |          Owner:         
     Type:  run-time performance bug  |         Status:  new    
 Priority:  normal                    |      Milestone:  6.8.3  
Component:  Compiler                  |        Version:  6.9    
 Severity:  normal                    |     Resolution:         
 Keywords:                            |     Difficulty:  Unknown
 Testcase:                            |   Architecture:  Unknown
       Os:  Unknown                   |  
--------------------------------------+-------------------------------------
Changes (by dons):

 * cc: dons at galois.com (added)

Comment:

 Weird, I get this code, with -O

 {{{
 W.lvl :: GHC.Num.Integer
 [GlobalId]
 [NoCafRefs
  Str: DmdType]
 W.lvl = GHC.Num.S# 3

 W.f :: GHC.Num.Integer -> GHC.Num.Integer
 [GlobalId]
 [Arity 1
  NoCafRefs
  Str: DmdType S]
 W.f =
   \ (x_a5l :: GHC.Num.Integer) ->
     case GHC.Num.plusInteger x_a5l W.lvl of wild_ab3 {
       GHC.Num.S# i_ab5 ->
         case GHC.Prim.mulIntMayOflo# i_ab5 i_ab5 of wild2_abb {
           __DEFAULT ->
             case GHC.Prim.int2Integer# i_ab5 of wild3_abc { (# s_abe,
 d_abf #) ->
             GHC.Num.$stimesInteger s_abe d_abf s_abe d_abf
             };
           0 -> GHC.Num.S# (GHC.Prim.*# i_ab5 i_ab5)
         };
       GHC.Num.J# ds_abw ds1_abx ->
         case GHC.Prim.timesInteger# ds_abw ds1_abx ds_abw ds1_abx
         of wild2_abM { (# s_abO, d_abP #) ->
         GHC.Num.J# s_abO d_abP
         }
     }
 }}}

 and -O2:

 {{{W.lvl :: GHC.Num.Integer
 [GlobalId]
 [NoCafRefs
  Str: DmdType]
 W.lvl = GHC.Num.S# 3

 W.f :: GHC.Num.Integer -> GHC.Num.Integer
 [GlobalId]
 [Arity 1
  NoCafRefs
  Str: DmdType S]
 W.f =
   \ (x_a5l :: GHC.Num.Integer) ->
     case GHC.Num.plusInteger x_a5l W.lvl of wild_ab3 {
       GHC.Num.S# i_ab5 ->
         case GHC.Prim.mulIntMayOflo# i_ab5 i_ab5 of wild2_abb {
           __DEFAULT ->
             case GHC.Prim.int2Integer# i_ab5 of wild3_abc { (# s_abe,
 d_abf #) ->
             GHC.Num.$stimesInteger s_abe d_abf s_abe d_abf
             };
           0 -> GHC.Num.S# (GHC.Prim.*# i_ab5 i_ab5)
         };
       GHC.Num.J# ds_abw ds1_abx ->
         case GHC.Prim.timesInteger# ds_abw ds1_abx ds_abw ds1_abx
         of wild2_abM { (# s_abO, d_abP #) ->
         GHC.Num.J# s_abO d_abP
         }
     }
 }}}

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


More information about the Glasgow-haskell-bugs mailing list