[commit: ghc] master: Run float-inwards immediately before the strictness analyser. (1122857)
git at git.haskell.org
git at git.haskell.org
Thu Aug 28 11:12:29 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1122857e6967795a4595a837f3b080cf5f0e18c2/ghc
>---------------------------------------------------------------
commit 1122857e6967795a4595a837f3b080cf5f0e18c2
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri May 23 13:42:05 2014 +0100
Run float-inwards immediately before the strictness analyser.
Doing so pushes bindings nearer their use site and hence makes
them more likely to be strict. These bindings might only show
up after the inlining from simplification. Example in fulsom,
Csg.calc, where an arg of timesDouble thereby becomes strict.
Very few programs are affected, but it's basically good news.
Program Size Allocs Runtime Elapsed TotalMem
--------------------------------------------------------------------------------
fft -0.2% +1.3% 0.06 0.06 -10.0%
fulsom -0.0% -2.6% -4.3% -4.7% -6.7%
simple +0.0% -0.8% 0.0% 0.0% 0.0%
--------------------------------------------------------------------------------
Min -0.5% -2.6% -4.5% -4.7% -10.0%
Max +0.1% +1.3% +3.3% +3.4% +2.6%
Geometric Mean -0.0% -0.0% -0.6% -0.6% -0.2%
The lossage in fft is the loss of detecting a common sub-expression,
and can be fixed by doing earlier CSE. But that is in any case a bit
of a fluke so I don't mind losing it in exchange for this more reliable
gain.
>---------------------------------------------------------------
1122857e6967795a4595a837f3b080cf5f0e18c2
compiler/simplCore/SimplCore.lhs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/compiler/simplCore/SimplCore.lhs b/compiler/simplCore/SimplCore.lhs
index 1a7fd67..2a70dcf 100644
--- a/compiler/simplCore/SimplCore.lhs
+++ b/compiler/simplCore/SimplCore.lhs
@@ -246,8 +246,6 @@ getCoreToDo dflags
-- but maybe we save some unnecessary to-and-fro in
-- the simplifier.
- runWhen do_float_in CoreDoFloatInwards,
-
simpl_phases,
-- Phase 0: allow all Ids to be inlined now
@@ -262,6 +260,13 @@ getCoreToDo dflags
-- Don't stop now!
simpl_phase 0 ["main"] (max max_iter 3),
+ runWhen do_float_in CoreDoFloatInwards,
+ -- Run float-inwards immediately before the strictness analyser
+ -- Doing so pushes bindings nearer their use site and hence makes
+ -- them more likely to be strict. These bindings might only show
+ -- up after the inlining from simplification. Example in fulsom,
+ -- Csg.calc, where an arg of timesDouble thereby becomes strict.
+
runWhen call_arity $ CoreDoPasses
[ CoreDoCallArity
, simpl_phase 0 ["post-call-arity"] max_iter
More information about the ghc-commits
mailing list