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
Gesh
GHC
Commits
e8437f81
Commit
e8437f81
authored
26 years ago
by
Simon Peyton Jones
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-06-10 08:31:57 by simonpj]
Fix float-in bug
parent
6f0be895
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/simplCore/FloatIn.lhs
+17
-21
17 additions, 21 deletions
ghc/compiler/simplCore/FloatIn.lhs
with
17 additions
and
21 deletions
ghc/compiler/simplCore/FloatIn.lhs
+
17
−
21
View file @
e8437f81
...
...
@@ -352,35 +352,31 @@ sepBindsByDropPoint drop_pts []
sepBindsByDropPoint drop_pts floaters
= let
(per_drop_pt, must_stay_here, _)
--= sep drop_pts emptyIdSet{-fvs of prev drop_pts-} floaters
= split' drop_pts floaters [] empty_boxes
empty_boxes = nOfThem (length drop_pts) []
(must_stay_here : per_drop_pt)
= split' floaters ((emptyIdSet : drop_pts) `zip` repeat [])
in
(
map reverse
per_drop_pt,
reverse
must_stay_here)
(per_drop_pt, must_stay_here)
where
split' drop_pts_fvs [] mult_branch drop_boxes
= (drop_boxes, mult_branch, drop_pts_fvs)
split' drop_pts_fvs (bind:binds) mult_branch drop_boxes
| no_of_branches == 1 -- Exactly one branch
= split' drop_pts_fvs' binds mult_branch drop_boxes'
| otherwise -- Zero or many branches; drop it here
= split' drop_pts_fvs binds (bind:mult_branch) drop_boxes
split' [] drop_boxes = map (reverse . snd) drop_boxes
split' (bind:binds) drop_boxes
= split' binds drop_boxes'
where
drop_boxes' = zipWith drop drop_flags drop_boxes
drop_flags | no_of_branches == 1 -- Exactly one branch
= used_in_flags
| otherwise -- Zero or many branches; drop it here
= True : repeat False
binders = bindersOf (fst bind)
no_of_branches = length [() | True <-
in_branch
_flags]
in_branch
_flags = [ any (`elementOfIdSet` branch_fvs) binders
| branch_fvs <- drop_
pts_fv
s ]
no_of_branches = length [() | True <-
used_in
_flags]
used_in
_flags
= [ any (`elementOfIdSet` branch_fvs) binders
|
(
branch_fvs
,_)
<- drop_
boxe
s ]
(drop_pts_fvs', drop_boxes') = unzip (zipWith3 drop in_branch_flags drop_pts_fvs drop_boxes)
drop True drop_fvs box = (drop_fvs `unionIdSets` fvsOfBind bind, bind:box)
drop False drop_fvs box = (drop_fvs, box)
drop True (drop_fvs, box) = (drop_fvs `unionIdSets` fvsOfBind bind, bind:box)
drop False (drop_fvs, box) = (drop_fvs, box)
-------------------------
fvsOfBind (_,fvs) = fvs
floatedBindsFVs :: FloatingBinds -> FreeVarsSet
...
...
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