[commit: ghc] master: Scrutinee Constant Folding (d3b546b)
git at git.haskell.org
git at git.haskell.org
Fri Dec 9 16:17:56 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d3b546b1a6058f26d5659c7f2000a7b25b7ea2ba/ghc
>---------------------------------------------------------------
commit d3b546b1a6058f26d5659c7f2000a7b25b7ea2ba
Author: Sylvain Henry <sylvain at haskus.fr>
Date: Fri Dec 9 10:26:34 2016 -0500
Scrutinee Constant Folding
This patch introduces new rules to perform constant folding through
case-expressions.
E.g.,
```
case t -# 10# of _ { ===> case t of _ {
5# -> e1 15# -> e1
8# -> e2 18# -> e2
DEFAULT -> e DEFAULT -> e
```
The initial motivation is that it allows "Merge Nested Cases"
optimization to kick in and to further simplify the code
(see Trac #12877).
Currently we recognize the following operations for Word# and Int#: Add,
Sub, Xor, Not and Negate (for Int# only).
Test Plan: validate
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2762
GHC Trac Issues: #12877
>---------------------------------------------------------------
d3b546b1a6058f26d5659c7f2000a7b25b7ea2ba
compiler/basicTypes/Literal.hs | 41 +++++++--
compiler/main/DynFlags.hs | 3 +
compiler/prelude/PrelRules.hs | 57 +++++++++++-
compiler/simplCore/SimplUtils.hs | 76 +++++++++++++++-
docs/users_guide/using-optimisation.rst | 21 ++++-
testsuite/tests/perf/compiler/T12877.hs | 117 +++++++++++++++++++++++++
testsuite/tests/perf/compiler/T12877.stdout | 1 +
testsuite/tests/perf/compiler/all.T | 13 +++
utils/mkUserGuidePart/Options/Optimizations.hs | 5 ++
9 files changed, 322 insertions(+), 12 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 d3b546b1a6058f26d5659c7f2000a7b25b7ea2ba
More information about the ghc-commits
mailing list