#4943: Another odd missed SpecConstr opportunity
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |        Owner:                         
        Type:  bug               |       Status:  new                    
    Priority:  normal            |    Milestone:                         
   Component:  Compiler          |      Version:  7.1                    
    Keywords:                    |     Testcase:                         
   Blockedby:                    |   Difficulty:                         
          Os:  Unknown/Multiple  |     Blocking:                         
Architecture:  Unknown/Multiple  |      Failure:  Runtime performance bug
---------------------------------+------------------------------------------

Comment(by batterseapower):

 I *do* get that result if I disable case liberation. The issue is that it
 totally fails to happen if I turn case liberation off. I don't have a
 build of HEAD on this laptop, but the attached code compiles as follows
 with 6.12:

 {{{
 Rec {
 $wa_r1y9
   :: forall s_aGn.
      Data.Array.Base.STUArray s_aGn GHC.Types.Int GHC.Types.Int
      -> GHC.Types.Int
      -> GHC.Prim.Int#
      -> GHC.Prim.Int#
      -> GHC.Prim.State# s_aGn
      -> (# GHC.Prim.State# s_aGn, () #)
 [GblId, Arity=5, Caf=NoCafRefs, Str=DmdType LLLLL]
 $wa_r1y9 =
   \ (@ s_aGn)
     (w_s1wz
        :: Data.Array.Base.STUArray s_aGn GHC.Types.Int GHC.Types.Int)
     (w1_s1wA :: GHC.Types.Int)
     (ww_s1wD :: GHC.Prim.Int#)
     (ww1_s1wH :: GHC.Prim.Int#)
     (w2_s1wJ :: GHC.Prim.State# s_aGn) ->
     case GHC.Prim.># ww_s1wD ww1_s1wH of _ {
       GHC.Bool.False ->
         case w_s1wz
         of wild1_aPx
         { Data.Array.Base.STUArray ds2_aPz ds3_aPA ds4_aPB marr#_aPC ->
         case GHC.Prim.readIntArray# @ s_aGn marr#_aPC ww_s1wD w2_s1wJ
         of _ { (# s2#_aPK, e#_aPL #) ->
         case w1_s1wA of wild11_aQm { GHC.Types.I# y_aQo ->
         case GHC.Prim.writeIntArray#
                @ s_aGn marr#_aPC ww_s1wD (GHC.Prim.+# e#_aPL y_aQo)
 s2#_aPK
         of s2#1_aQc { __DEFAULT ->
         $wa_r1y9
           @ s_aGn
           wild1_aPx
           wild11_aQm
           (GHC.Prim.+# ww_s1wD 1)
           ww1_s1wH
           s2#1_aQc
         }
         }
         }
         };
       GHC.Bool.True -> (# w2_s1wJ, GHC.Unit.() #)
     }
 end Rec }
 }}}

 This is bad. The command line was:

 {{{
 ghc -O2 -fno-liberate-case -ddump-simpl -c -fforce-recomp STUArray-
 Rewrite2.hs
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to