
#2439: Missed optimisation with dictionaries and loops ---------------------------------+------------------------------------------ Reporter: rl | Owner: simonpj Type: bug | Status: new Priority: lowest | Milestone: 7.6.2 Component: Compiler | Version: 6.9 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Runtime performance bug Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Comment(by morabbin): For the original example, `-fdicts-strict` seems to make no difference now (i.e., it seems the "right" code is now produced even without `-fdicts- strict`): {{{ Foo.sum' :: forall a_aeH. GHC.Num.Num a_aeH => [a_aeH] -> a_aeH [GblId, Arity=2, Caf=NoCafRefs] Foo.sum' = \ (@ a_c) ($dNum_afi :: GHC.Num.Num a_c) (xs_afb :: [a_c]) -> let { f_af2 :: a_c -> a_c -> a_c [LclId] f_af2 = GHC.Num.+ @ a_c $dNum_afi } in case GHC.Num.fromInteger @ a_c $dNum_afi (__integer 0) of z_Xf9 { __DEFAULT -> letrec { loop_aff [Occ=LoopBreaker] :: a_c -> [a_c] -> a_c [LclId, Arity=2] loop_aff = \ (z1_af6 :: a_c) (ds_dfG :: [a_c]) -> case z1_af6 of z2_Xfg { __DEFAULT -> case ds_dfG of _ { [] -> z2_Xfg; : x_af8 xs1_af9 -> loop_aff (f_af2 z2_Xfg x_af8) xs1_af9 } }; } in loop_aff z_Xf9 xs_afb } }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2439#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler