diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2016-12-09 10:26:34 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-12-09 10:27:34 -0500 |
commit | d3b546b1a6058f26d5659c7f2000a7b25b7ea2ba (patch) | |
tree | 96929e66f77af1c5f9ce451c032a24e988de57b3 /utils | |
parent | 61932cd3eb0d5d22cb35d118fb9f87298881cd77 (diff) | |
download | haskell-d3b546b1a6058f26d5659c7f2000a7b25b7ea2ba.tar.gz |
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
Diffstat (limited to 'utils')
-rw-r--r-- | utils/mkUserGuidePart/Options/Optimizations.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/utils/mkUserGuidePart/Options/Optimizations.hs b/utils/mkUserGuidePart/Options/Optimizations.hs index 29d35a0377..b0f9bc5ac8 100644 --- a/utils/mkUserGuidePart/Options/Optimizations.hs +++ b/utils/mkUserGuidePart/Options/Optimizations.hs @@ -15,6 +15,11 @@ optimizationsOptions = , flagType = DynamicFlag , flagReverse = "-fno-case-merge" } + , flag { flagName = "-fcase-folding" + , flagDescription = "Enable constant folding in case expressions. Implied by :ghc-flag:`-O`." + , flagType = DynamicFlag + , flagReverse = "-fno-case-folding" + } , flag { flagName = "-fcmm-elim-common-blocks" , flagDescription = "Enable Cmm common block elimination. Implied by :ghc-flag:`-O`." |