Question about the new codegen in GHC

Jan Stolarek jan.stolarek at
Thu Jul 4 14:44:12 CEST 2013

Hi Simon,

as part of my internship at MSR I'm working on optimizing the new code generator. My starting point is Krzysztof Woś's project "Low-level code optimizations in the Glasgow Haskell Compiler" [1]. Right now I'm trying to figure out which of the described optimisations are currently implemented and which ones are not. Looking at a simple factorial program, which was used throughout Krzysztof's project, I see that the code gets optimized properly. Does this mean that all the optimizations described in that work are implemented? Two things I'm particularily interested in are:
  * do tail calls always call the entry code, or can it happen that a tail call is done indirectly (e.g. via another label that does immediate jump to the entry code)?
  * commentary on the wiki says that Common Block Elimination "essentially implements the Adams optimisation, we believe". Is that really the case, or are there situations when two similar blocks could be eliminated by Adams optimization, but will not be eliminated by CBE?



More information about the ghc-devs mailing list