[commit: ghc] master: Comments only (28188e0)
git at git.haskell.org
git at git.haskell.org
Fri Dec 21 16:55:14 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/28188e06b4953f589c7cd442ae14787bc74cabf8/ghc
>---------------------------------------------------------------
commit 28188e06b4953f589c7cd442ae14787bc74cabf8
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Mon Dec 10 17:32:34 2018 +0000
Comments only
>---------------------------------------------------------------
28188e06b4953f589c7cd442ae14787bc74cabf8
compiler/rename/RnSource.hs | 6 ++++--
compiler/simplCore/SetLevels.hs | 22 +++++++++++++---------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs
index 78444ba..c76eb31 100644
--- a/compiler/rename/RnSource.hs
+++ b/compiler/rename/RnSource.hs
@@ -698,7 +698,7 @@ rnFamInstEqn :: HsDocContext
-> Maybe (Name, [Name]) -- Nothing => not associated
-- Just (cls,tvs) => associated,
-- and gives class and tyvars of the
- -- parent instance delc
+ -- parent instance decl
-> [Located RdrName] -- Kind variables from the equation's RHS
-> FamInstEqn GhcPs rhs
-> (HsDocContext -> rhs -> RnM (rhs', FreeVars))
@@ -801,7 +801,9 @@ rnFamInstEqn doc mb_cls rhs_kvars
rnFamInstEqn _ _ _ (HsIB _ (XFamEqn _)) _ = panic "rnFamInstEqn"
rnFamInstEqn _ _ _ (XHsImplicitBndrs _) _ = panic "rnFamInstEqn"
-rnTyFamInstDecl :: Maybe (Name, [Name])
+rnTyFamInstDecl :: Maybe (Name, [Name]) -- Just (cls,tvs) => associated,
+ -- and gives class and tyvars of
+ -- the parent instance decl
-> TyFamInstDecl GhcPs
-> RnM (TyFamInstDecl GhcRn, FreeVars)
rnTyFamInstDecl mb_cls (TyFamInstDecl { tfid_eqn = eqn })
diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs
index e685b3a..2f993b7 100644
--- a/compiler/simplCore/SetLevels.hs
+++ b/compiler/simplCore/SetLevels.hs
@@ -462,7 +462,7 @@ lvlCase :: LevelEnv -- Level of in-scope names/tyvars
lvlCase env scrut_fvs scrut' case_bndr ty alts
-- See Note [Floating single-alternative cases]
| [(con@(DataAlt {}), bs, body)] <- alts
- , exprIsHNF (deTagExpr scrut') -- See Note [Check the output scrutinee for okForSpec]
+ , exprIsHNF (deTagExpr scrut') -- See Note [Check the output scrutinee for exprIsHNF]
, not (isTopLvl dest_lvl) -- Can't have top-level cases
, not (floatTopLvlOnly env) -- Can float anywhere
= -- Always float the case if possible
@@ -535,21 +535,25 @@ Things to note:
* We only do this with a single-alternative case
-Note [Check the output scrutinee for okForSpec]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Note [Check the output scrutinee for exprIsHNF]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this:
case x of y {
A -> ....(case y of alts)....
}
+
Because of the binder-swap, the inner case will get substituted to
-(case x of ..). So when testing whether the scrutinee is
-okForSpeculation we must be careful to test the *result* scrutinee ('x'
-in this case), not the *input* one 'y'. The latter *is* ok for
-speculation here, but the former is not -- and indeed we can't float
-the inner case out, at least not unless x is also evaluated at its
-binding site. See Trac #5453.
+(case x of ..). So when testing whether the scrutinee is in HNF we
+must be careful to test the *result* scrutinee ('x' in this case), not
+the *input* one 'y'. The latter *is* in HNF here (because y is
+evaluated), but the former is not -- and indeed we can't float the
+inner case out, at least not unless x is also evaluated at its binding
+site. See Trac #5453.
That's why we apply exprIsHNF to scrut' and not to scrut.
+
+See Note [Floating single-alternative cases] for why
+we use exprIsHNF in the first place.
-}
lvlNonTailMFE :: LevelEnv -- Level of in-scope names/tyvars
More information about the ghc-commits
mailing list