[commit: ghc] master: Optimize self-recursive tail calls (d61c3ac)
git at git.haskell.org
git at git.haskell.org
Thu Aug 29 13:56:56 CEST 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d61c3ac186c94021c851f7a2a6d20631e35fc1ba/ghc
>---------------------------------------------------------------
commit d61c3ac186c94021c851f7a2a6d20631e35fc1ba
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date: Thu Aug 29 10:57:04 2013 +0100
Optimize self-recursive tail calls
This patch implements loopification optimization. It was described
in "Low-level code optimisations in the Glasgow Haskell Compiler" by
Krzysztof Woś, but we use a different approach here. Krzysztof's
approach was to perform optimization as a Cmm-to-Cmm pass. Our
approach is to generate properly optimized tail calls in the code
generator, which saves us the trouble of processing Cmm. This idea
was proposed by Simon Marlow. Implementation details are explained
in Note [Self-recursive tail calls].
Performance of most nofib benchmarks is not affected. There are
some benchmarks that show 5-7% improvement, with an average improvement
of 2.6%. It would require some further investigation to check if this
is related to benchamrking noise or does this optimization really
help make some class of programs faster.
As a minor cleanup, this patch renames forkProc to forkLneBody.
It also moves some data declarations from StgCmmMonad to
StgCmmClosure, because they are needed there and it seems that
StgCmmClosure is on top of the whole StgCmm* hierarchy.
>---------------------------------------------------------------
d61c3ac186c94021c851f7a2a6d20631e35fc1ba
compiler/codeGen/StgCmmBind.hs | 16 +++++-
compiler/codeGen/StgCmmClosure.hs | 110 ++++++++++++++++++++++++++-----------
compiler/codeGen/StgCmmExpr.hs | 104 ++++++++++++++++++++++++++++++-----
compiler/codeGen/StgCmmMonad.hs | 86 ++++++++++++++---------------
4 files changed, 222 insertions(+), 94 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d61c3ac186c94021c851f7a2a6d20631e35fc1ba
More information about the ghc-commits
mailing list