summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Opt/FloatIn.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-01-30 08:45:49 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-01 12:29:26 -0500
commit88fba8a4b3c22e953a634b81dd0b67ec66eb5e72 (patch)
tree75a46332ad32cfeaf4f4d52b3b60fd452f2493b6 /compiler/GHC/Core/Opt/FloatIn.hs
parent06185102bb06d6d56e00d40172a6a473fc228501 (diff)
downloadhaskell-88fba8a4b3c22e953a634b81dd0b67ec66eb5e72.tar.gz
Fix a few Note inconsistencies
Diffstat (limited to 'compiler/GHC/Core/Opt/FloatIn.hs')
-rw-r--r--compiler/GHC/Core/Opt/FloatIn.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/GHC/Core/Opt/FloatIn.hs b/compiler/GHC/Core/Opt/FloatIn.hs
index 6e4b724310..37cb23e338 100644
--- a/compiler/GHC/Core/Opt/FloatIn.hs
+++ b/compiler/GHC/Core/Opt/FloatIn.hs
@@ -353,7 +353,7 @@ So: rather than drop \tr{w}'s binding here, we add it onto the list of
things to drop in the outer let's body, and let nature take its
course.
-Note [extra_fvs (1): avoid floating into RHS]
+Note [extra_fvs (1)]: avoid floating into RHS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider let x=\y....t... in body. We do not necessarily want to float
a binding for t into the RHS, because it'll immediately be floated out
@@ -371,7 +371,7 @@ can't have unboxed bindings.
So we make "extra_fvs" which is the rhs_fvs of such bindings, and
arrange to dump bindings that bind extra_fvs before the entire let.
-Note [extra_fvs (2): free variables of rules]
+Note [extra_fvs (2)]: free variables of rules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
let x{rule mentioning y} = rhs in body
@@ -504,7 +504,7 @@ fiBind :: Platform
fiBind platform to_drop (AnnNonRec id ann_rhs@(rhs_fvs, rhs)) body_fvs
= ( extra_binds ++ shared_binds -- Land these before
- -- See Note [extra_fvs (1,2)]
+ -- See Note [extra_fvs (1)] and Note [extra_fvs (2)]
, FB (unitDVarSet id) rhs_fvs' -- The new binding itself
(FloatLet (NonRec id rhs'))
, body_binds ) -- Land these after
@@ -512,12 +512,12 @@ fiBind platform to_drop (AnnNonRec id ann_rhs@(rhs_fvs, rhs)) body_fvs
where
body_fvs2 = body_fvs `delDVarSet` id
- rule_fvs = bndrRuleAndUnfoldingVarsDSet id -- See Note [extra_fvs (2): free variables of rules]
+ rule_fvs = bndrRuleAndUnfoldingVarsDSet id -- See Note [extra_fvs (2)]
extra_fvs | noFloatIntoRhs NonRecursive id rhs
= rule_fvs `unionDVarSet` rhs_fvs
| otherwise
= rule_fvs
- -- See Note [extra_fvs (1): avoid floating into RHS]
+ -- See Note [extra_fvs (1)]
-- No point in floating in only to float straight out again
-- We *can't* float into ok-for-speculation unlifted RHSs
-- But do float into join points
@@ -601,7 +601,7 @@ noFloatIntoArg expr expr_ty
|| all isTyVar (bndr:bndrs) -- Wrinkle 1 (b)
-- See Note [noFloatInto considerations] wrinkle 2
- | otherwise -- Note [noFloatInto considerations] wrinkle 2
+ | otherwise -- See Note [noFloatInto considerations] wrinkle 2
= exprIsTrivial deann_expr || exprIsHNF deann_expr
where
deann_expr = deAnnotate' expr
@@ -742,7 +742,6 @@ sepBindsByDropPoint platform is_case drop_pts floaters
{- Note [Duplicating floats]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
For case expressions we duplicate the binding if it is reasonably
small, and if it is not used in all the RHSs This is good for
situations like