From 62eeda5aed31173b234b2965ccf4bd6979ffd9a4 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Tue, 13 Jan 2009 16:49:53 +0000 Subject: Rewrite CorePrep and improve eta expansion This patch does two main things a) Rewrite most of CorePrep to be much easier to understand (I hope!). The invariants established by CorePrep are now written out, and the code is more perspicuous. It is surpringly hard to get right, and the old code had become quite incomprehensible. b) Rewrite the eta-expander so that it does a bit of simplifying on-the-fly, and thereby guarantees to maintain the CorePrep invariants. This make it much easier to use from CorePrep, and is a generally good thing anyway. A couple of pieces of re-structuring: * I moved the eta-expander and arity analysis stuff into a new module coreSyn/CoreArity. Max will find that the type CoreArity.EtaInfo looks strangely familiar. * I moved a bunch of comments from Simplify to OccurAnal; that's why it looks as though there's a lot of lines changed in those modules. On the way I fixed various things - Function arguments are eta expanded f (map g) ===> let s = \x. map g x in f s - Trac #2368 The result is a modest performance gain, I think mainly due to the first of these changes: -------------------------------------------------------------------------------- Program Size Allocs Runtime Elapsed -------------------------------------------------------------------------------- Min -1.0% -17.4% -19.1% -46.4% Max +0.3% +0.5% +5.4% +53.8% Geometric Mean -0.1% -0.3% -7.0% -10.2% --- compiler/ghc.cabal.in | 1 + 1 file changed, 1 insertion(+) (limited to 'compiler/ghc.cabal.in') diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 22181fd2ea..80132a64e2 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -241,6 +241,7 @@ Library ClosureInfo CodeGen SMRep + CoreArity CoreFVs CoreLint CorePrep -- cgit v1.2.1