Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
fc8e106e
Commit
fc8e106e
authored
Sep 15, 2010
by
simonpj@microsoft.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments only
parent
09895ff7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
compiler/simplCore/Simplify.lhs
compiler/simplCore/Simplify.lhs
+10
-6
No files found.
compiler/simplCore/Simplify.lhs
View file @
fc8e106e
...
@@ -1503,7 +1503,7 @@ rebuildCase env scrut case_bndr alts cont
...
@@ -1503,7 +1503,7 @@ rebuildCase env scrut case_bndr alts cont
rebuildCase env scrut case_bndr [(_, bndrs, rhs)] cont
rebuildCase env scrut case_bndr [(_, bndrs, rhs)] cont
-- See if we can get rid of the case altogether
-- See if we can get rid of the case altogether
-- See Note [Case elimin
i
ation]
-- See Note [Case elimination]
-- mkCase made sure that if all the alternatives are equal,
-- mkCase made sure that if all the alternatives are equal,
-- then there is now only one (DEFAULT) rhs
-- then there is now only one (DEFAULT) rhs
| all isDeadBinder bndrs -- bndrs are [InId]
| all isDeadBinder bndrs -- bndrs are [InId]
...
@@ -2243,7 +2243,7 @@ The desire not to duplicate is the entire reason that
...
@@ -2243,7 +2243,7 @@ The desire not to duplicate is the entire reason that
mkDupableCont returns a pair of continuations.
mkDupableCont returns a pair of continuations.
Note [Single-a
lt
ernative cases]
Note [Single-a
tl
ernative cases]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This case is just like the ArgOf case. Here's an example:
This case is just like the ArgOf case. Here's an example:
data T a = MkT !a
data T a = MkT !a
...
@@ -2271,10 +2271,14 @@ strict computation enclosing the orginal call to MkT. Then, it won't
...
@@ -2271,10 +2271,14 @@ strict computation enclosing the orginal call to MkT. Then, it won't
"see" the MkT any more, because it's big and won't get duplicated.
"see" the MkT any more, because it's big and won't get duplicated.
And, what is worse, nothing was gained by the case-of-case transform.
And, what is worse, nothing was gained by the case-of-case transform.
When should use this case of mkDupableCont?
So, in circumstances like these, we don't want to build join points
However, matching on *any* single-alternative case is a *disaster*;
and push the outer case into the branches of the inner one. Instead,
don't duplicate the continuation.
When should we use this strategy? We should not use it on *every*
single-alternative case:
e.g. case (case ....) of (a,b) -> (# a,b #)
e.g. case (case ....) of (a,b) -> (# a,b #)
W
e must push the outer case into the inner one!
Here w
e must push the outer case into the inner one!
Other choices:
Other choices:
* Match [(DEFAULT,_,_)], but in the common case of Int,
* Match [(DEFAULT,_,_)], but in the common case of Int,
...
@@ -2296,7 +2300,7 @@ Other choices:
...
@@ -2296,7 +2300,7 @@ Other choices:
the *un-simplified* rhs, which is fine. It might get bigger or
the *un-simplified* rhs, which is fine. It might get bigger or
smaller after simplification; if it gets smaller, this case might
smaller after simplification; if it gets smaller, this case might
fire next time round. NB also that we must test contIsDupable
fire next time round. NB also that we must test contIsDupable
case_cont *
b
too, because case_cont might be big!
case_cont *too, because case_cont might be big!
HOWEVER: I found that this version doesn't work well, because
HOWEVER: I found that this version doesn't work well, because
we can get let x = case (...) of { small } in ...case x...
we can get let x = case (...) of { small } in ...case x...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment