[GHC] #5997: GHC fails to make function tail recursive

GHC cvs-ghc at haskell.org
Fri Apr 20 18:44:18 CEST 2012


#5997: GHC fails to make function tail recursive
-------------------------------+--------------------------------------------
  Reporter:  Khudyakov         |          Owner:                  
      Type:  bug               |         Status:  closed          
  Priority:  normal            |      Milestone:                  
 Component:  Compiler          |        Version:  7.4.1           
Resolution:  duplicate         |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown         
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------

Comment(by simonpj@…):

 commit b8ff4448d899f783fc112f3774aab626979a4f22
 {{{
 Author: Simon Peyton Jones <simonpj at microsoft.com>
 Date:   Fri Apr 13 17:38:32 2012 +0100

     Fix worker/wrapper for CPR functions

     A long-standing and egregious bug in the worker/wrapper code meant
     that some functions with the CPR property weren't getting a CPR
     w/w. And that had the effect of making a tail-recursive function not
     tail recursive.  As well as increasing allocation.

     Fixes Trac #5920, and #5997.

     Nofib results (highlights):

             Program           Size    Allocs   Runtime   Elapsed  TotalMem
 --------------------------------------------------------------------------------
              boyer2          -0.1%    -15.3%      0.01      0.01     +0.0%
             mandel2          -0.0%     -8.1%      0.01      0.01     +0.0%
                para          -0.1%    -11.8%     -7.9%     -7.8%     +0.0%
 --------------------------------------------------------------------------------
                 Min          -0.1%    -15.3%     -7.9%     -7.8%    -33.3%
                 Max          +0.0%     +0.2%     +6.3%     +6.3%     +3.7%
      Geometric Mean          -0.0%     -0.4%     +0.1%     +0.1%     -0.5%

     Looks like a clear win.  And I have not even recompiled the libraries,
 so
     it'll probably be a bit better in the ed.

  compiler/stranal/DmdAnal.lhs |   13 ++++++-------
  compiler/stranal/WwLib.lhs   |   25 ++++++++++++++++---------
  2 files changed, 22 insertions(+), 16 deletions(-)
 }}}

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



More information about the Glasgow-haskell-bugs mailing list