diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-08 10:26:47 +0000 |
---|---|---|
committer | David Feuer <David.Feuer@gmail.com> | 2017-04-28 18:08:33 -0400 |
commit | 193664d42dbceadaa1e4689dfa17ff1cf5a405a0 (patch) | |
tree | 9288e57ab81dcbf9f633cae13d9920cf38a11754 /testsuite/tests/simplCore/should_compile/T3772.stdout | |
parent | 1cae73aa7a1bf934e3dcae943d0d1686e8b12c26 (diff) | |
download | haskell-193664d42dbceadaa1e4689dfa17ff1cf5a405a0.tar.gz |
Re-engineer caseRules to add tagToEnum/dataToTag
See Note [Scrutinee Constant Folding] in SimplUtils
* Add cases for tagToEnum and dataToTag. This is the main new
bit. It allows the simplifier to remove the pervasive uses
of case tagToEnum (a > b) of
False -> e1
True -> e2
and replace it by the simpler
case a > b of
DEFAULT -> e1
1# -> e2
See Note [caseRules for tagToEnum]
and Note [caseRules for dataToTag] in PrelRules.
* This required some changes to the API of caseRules, and hence
to code in SimplUtils. See Note [Scrutinee Constant Folding]
in SimplUtils.
* Avoid duplication of work in the (unusual) case of
case BIG + 3# of b
DEFAULT -> e1
6# -> e2
Previously we got
case BIG of
DEFAULT -> let b = BIG + 3# in e1
3# -> let b = 6# in e2
Now we get
case BIG of b#
DEFAULT -> let b = b' + 3# in e1
3# -> let b = 6# in e2
* Avoid duplicated code in caseRules
A knock-on refactoring:
* Move Note [Word/Int underflow/overflow] to Literal, as
documentation to accompany mkMachIntWrap etc; and get
rid of PrelRuls.intResult' in favour of mkMachIntWrap
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T3772.stdout')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T3772.stdout | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T3772.stdout b/testsuite/tests/simplCore/should_compile/T3772.stdout index 44aee7b69e..a4ab97da38 100644 --- a/testsuite/tests/simplCore/should_compile/T3772.stdout +++ b/testsuite/tests/simplCore/should_compile/T3772.stdout @@ -1,7 +1,7 @@ ==================== Tidy Core ==================== Result size of Tidy Core - = {terms: 44, types: 19, coercions: 0, joins: 0/0} + = {terms: 43, types: 18, coercions: 0, joins: 0/0} -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} T3772.$trModule4 :: GHC.Prim.Addr# @@ -59,14 +59,14 @@ $wxs } end Rec } --- RHS size: {terms: 11, types: 3, coercions: 0, joins: 0/0} +-- RHS size: {terms: 10, types: 2, coercions: 0, joins: 0/0} T3772.$wfoo [InlPrag=NOINLINE] :: GHC.Prim.Int# -> () [GblId, Arity=1, Caf=NoCafRefs, Str=<S,U>] T3772.$wfoo = \ (ww :: GHC.Prim.Int#) -> - case GHC.Prim.tagToEnum# @ Bool (GHC.Prim.<# 0# ww) of { - False -> GHC.Tuple.(); - True -> $wxs ww + case GHC.Prim.<# 0# ww of { + __DEFAULT -> GHC.Tuple.(); + 1# -> $wxs ww } -- RHS size: {terms: 6, types: 3, coercions: 0, joins: 0/0} |