[GHC] #10694: CPR analysis too optimistic when returning a component of a product

GHC ghc-devs at haskell.org
Tue Jul 28 00:32:27 UTC 2015


#10694: CPR analysis too optimistic when returning a component of a product
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:  10678
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 To demonstrate the problem, if I build with `-funfolding-use-threshold=1`
 to induce w/w to run, I get this core (with `-dsuppress-all`):
 {{{
 -- RHS size: {terms: 11, types: 9, coercions: 0}
 $wm
 $wm =
   \ w_sDP w1_sDQ ->
     case pm w_sDP w1_sDQ of _ { (pr_as8, mr_as9) ->
     case mr_as9 of _ { I# ww1_sDT -> ww1_sDT }
     }

 -- RHS size: {terms: 9, types: 3, coercions: 0}
 m
 m =
   \ w_sDP w1_sDQ ->
     case $wm w_sDP w1_sDQ of ww_sDT { __DEFAULT -> I# ww_sDT }
 }}}
 This can only lose, never gain, compared to not generating a
 worker/wrapper pair.

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


More information about the ghc-tickets mailing list