Improve eta reduction, to reduce Simplifier iterations
authorsimonpj@microsoft.com <unknown>
Mon, 3 Dec 2007 15:00:39 +0000 (15:00 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 3 Dec 2007 15:00:39 +0000 (15:00 +0000)
commita5f2ab64f2f1306c803c0c20e21238973070f74b
tree683164b3ca3f984b0b9603fdb5f66dbb28fc7565
parent1dbdb89fd0d4a191a12dc1734c6f80004c6fa4a2
Improve eta reduction, to reduce Simplifier iterations

I finally got around to investigating why the Simplifier was sometimes
iterating so often.  There's a nice example in Text.ParserCombinators.ReadPrec,
which produced:

NOTE: Simplifier still going after 3 iterations; bailing out.  Size = 339
NOTE: Simplifier still going after 3 iterations; bailing out.  Size = 339
NOTE: Simplifier still going after 3 iterations; bailing out.  Size = 339

No progress is being made.  It turned out that an interaction between
eta-expansion, casts, and eta reduction was responsible. The change is
small and simple, in SimplUtils.mkLam: do not require the body to be
a Lam when floating the cast outwards.

I also discovered a missing side condition in the same equation, so fixing
that is good too.  Now there is no loop when compiling ReadPrec.

Should do a full nofib run though.
compiler/simplCore/SimplUtils.lhs