Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Naïm Favier
GHC
Commits
78896592
Commit
78896592
authored
6 years ago
by
Simon Peyton Jones
Browse files
Options
Downloads
Patches
Plain Diff
Minor comments in CSE
parent
4d30bc86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/simplCore/CSE.hs
+8
-8
8 additions, 8 deletions
compiler/simplCore/CSE.hs
with
8 additions
and
8 deletions
compiler/simplCore/CSE.hs
+
8
−
8
View file @
78896592
...
...
@@ -276,8 +276,8 @@ We could try and be careful by tracking which join points are still valid at
each subexpression, but since join points aren't allocated or shared, there's
less to gain by trying to CSE them. (#13219)
Note [
Don’t tryForCSE the RHS of a J
oin
P
oint]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~
Note [
Look inside j
oin
-p
oint
binders
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Another way how CSE for joint points is tricky is
let join foo x = (x, 42)
...
...
@@ -293,9 +293,9 @@ naively, CSE would turn this into
but now bar is a join point that claims arity one, but its right-hand side
is not a lambda, breaking the join-point invariant (this was #15002).
Therefore,
`cse_bind`
will
zoom past the lambdas of a join point (using
`collectNBinders`) and resume searching for CSE opportunities only in
the body
of the join point.
So
`cse_bind`
must
zoom past the lambdas of a join point (using
`collectNBinders`) and resume searching for CSE opportunities only in
the body
of the join point.
Note [CSE for recursive bindings]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
@@ -372,10 +372,10 @@ cse_bind :: TopLevelFlag -> CSEnv -> (InId, InExpr) -> OutId -> (CSEnv, (OutId,
cse_bind
toplevel
env
(
in_id
,
in_rhs
)
out_id
|
isTopLevel
toplevel
,
exprIsTickedString
in_rhs
-- See Note [Take care with literal strings]
=
(
env'
,
(
out_id
,
in_rhs
))
=
(
env'
,
(
out_id
'
,
in_rhs
))
|
Just
arity
<-
isJoinId_maybe
in_id
-- See Note [
Don’t tryForCSE the RHS of a J
oin
P
oint]
-- See Note [
Look inside j
oin
-p
oint
binders
]
=
let
(
params
,
in_body
)
=
collectNBinders
arity
in_rhs
(
env'
,
params'
)
=
addBinders
env
params
out_body
=
tryForCSE
env'
in_body
...
...
@@ -384,8 +384,8 @@ cse_bind toplevel env (in_id, in_rhs) out_id
|
otherwise
=
(
env'
,
(
out_id'
,
out_rhs
))
where
out_rhs
=
tryForCSE
env
in_rhs
(
env'
,
out_id'
)
=
addBinding
env
in_id
out_id
out_rhs
out_rhs
=
tryForCSE
env
in_rhs
addBinding
::
CSEnv
-- Includes InId->OutId cloning
->
InVar
-- Could be a let-bound type
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment