Understanding core2core optimisation pipeline

Jan Stolarek jan.stolarek at p.lodz.pl
Mon Jul 28 10:27:17 UTC 2014


The wiki page just went live:

https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Core2CorePipeline

It's not yet perfect but it should be a good start.

> Roughtly, a complete run of the simplifier means "run the simplifier
> repeatedly until nothing further happens".  The iterations are the
> successive iterations of this loop. Currently there's a (rather arbitrary)
> limit of four such iterations before we give up and declare victory.
A limit or a default value for that limit?

To Ilya:
> If you grep for the "late_dmd_anal" option variable in the compiler/simplCore/SimplCore.lhs
> module, you'll see that it triggers a phase close to the endo of getCoreToDo's tasks, which
> contains, in particular, the "CoreDoStrictness" pass. This is the "late" phase.
The paper said that the late pass is run to detect single-entry thunks and the reason why it is 
run late in the pipeline is that if it were run earlier this information could be invalidated by 
the transformations. But in the source code I see that this late pass is followed by the 
simplifier, which can invalidate the information. Also, the documentation for -flate-dmd-anal 
says: "We found some opportunities for discovering strictness that were not visible earlier; and 
optimisations like -fspec-constr can create functions with unused arguments which are eliminated 
by late demand analysis". This says nothing about single-netry thunks. So, is the single-entry 
thunk optimisation performed by GHC?

Janek


More information about the ghc-devs mailing list