Fun with GHC's optimiser

Manuel M. T. Chakravarty [email protected]
Thu, 14 Dec 2000 18:40:20 +1100


Simon Peyton-Jones <[email protected]> wrote,

> Meanwhile, in the head, if you specify -O2 you'll get better
> code for some of your loops, namely the ones that repeatedly
> evaluate a free variable every time round the loop.  The 
> loop is duplicated and everything is nice.
[..]
> You mentioned something like this before.
> 
> The amount of code duplication is controlled by -fliberate-case-threshold20
> (say)
> The default is set pretty low.  And it all only happens with -O2.

It works nicely :-)

In what kind of unit is the number after the
-fliberate-case-threshold option.  I really need to use 20
for it to work on the current version of the array code
(where the loop that is to be optimised is much more
involved than the initial example that I posted).

Thanks,
Manuel