[commit: ghc] master: Algebraically simplify add/sub with carry/overflow (bb338f2)
git at git.haskell.org
git at git.haskell.org
Tue May 15 21:47:50 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa/ghc
>---------------------------------------------------------------
commit bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa
Author: Sebastian Graf <sebastian.graf at kit.edu>
Date: Tue May 15 13:12:56 2018 -0400
Algebraically simplify add/sub with carry/overflow
Previously, the `{add,sub}{Int,Word}C#` PrimOps weren't handled
in PrelRules (constant folding and algebraic simplification) at all.
This implements the necessary logic, so that using these primitives
isn't too punishing compared to their well-optimised, overflow-unaware
counterparts.
This is so that using these primitives in `enumFromThenTo @Int` can
be optimized by constant folding, reducing closure sizes.
Reviewers: bgamari, simonpj, hsyl20
Reviewed By: bgamari, simonpj
Subscribers: AndreasK, thomie, carter
GHC Trac Issues: #8763
Differential Revision: https://phabricator.haskell.org/D4605
>---------------------------------------------------------------
bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa
compiler/basicTypes/Literal.hs | 48 +++++++++----
compiler/prelude/PrelRules.hs | 79 +++++++++++++++++++++-
testsuite/tests/numeric/should_run/T10962.hs | 26 +++++--
.../tests/numeric/should_run/T10962.stdout-ws-32 | 8 ++-
.../tests/numeric/should_run/T10962.stdout-ws-64 | 8 ++-
testsuite/tests/numeric/should_run/all.T | 2 +-
6 files changed, 150 insertions(+), 21 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 bb338f2eb706a3137bf6675e3ddbf96d4fe4f4aa
More information about the ghc-commits
mailing list