[Haskell-cafe] Re: GHC optimisations

Simon Marlow simonmarhaskell at gmail.com
Thu Aug 30 08:23:06 EDT 2007

Simon Peyton-Jones wrote:
> GHC does some constant folding, but little by way of strength reduction, or using shifts instead of multiplication.  It's pretty easy to add more: it's all done in a single module.  Look at primOpRules in the module PrelRules.

Although it isn't done at the Core level as Simon says, GHC's native code 
generator does turn multiplies into shifts, amongst various other low-level 
optimisations.  In fact it's not clear that this kind of thing *should* be 
done at a high level, since it's likely to be machine-dependent.


More information about the Haskell-Cafe mailing list