diff options
Diffstat (limited to 'compiler/GHC/Core/Utils.hs')
-rw-r--r-- | compiler/GHC/Core/Utils.hs | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs index d84bcdd774..fb22885f47 100644 --- a/compiler/GHC/Core/Utils.hs +++ b/compiler/GHC/Core/Utils.hs @@ -162,7 +162,7 @@ isExprLevPoly = go go e@(Cast {}) = check_type e go (Tick _ e) = go e go e@(Type {}) = pprPanic "isExprLevPoly ty" (ppr e) - go (Coercion {}) = False -- this case can happen in SetLevels + go (Coercion {}) = False -- this case can happen in GHC.Core.Op.SetLevels check_type = isTypeLevPoly . exprType -- slow approach @@ -625,7 +625,7 @@ for 'Red'. That's because 'lvl' is unreachable. So rather than crashing we generate (error "Inaccessible alternative"). Similar things can happen (augmented by GADTs) when the Simplifier -filters down the matching alternatives in Simplify.rebuildCase. +filters down the matching alternatives in GHC.Core.Op.Simplify.rebuildCase. -} --------------------------------- @@ -817,9 +817,9 @@ case e of C2 -> e0 ``` -It isn't obvious that refineDefaultAlt does this but if you look at its one -call site in SimplUtils then the `imposs_deflt_cons` argument is populated with -constructors which are matched elsewhere. +It isn't obvious that refineDefaultAlt does this but if you look at its one call +site in GHC.Core.Op.Simplify.Utils then the `imposs_deflt_cons` argument is +populated with constructors which are matched elsewhere. -} @@ -874,7 +874,7 @@ Note [Combine identical alternatives: wrinkles] isDeadBinder (see #7360). You can see this in the call to combineIdenticalAlts in - SimplUtils.prepareAlts. Here the alternatives have type InAlt + GHC.Core.Op.Simplify.Utils.prepareAlts. Here the alternatives have type InAlt (the "In" meaning input) rather than OutAlt. * combineIdenticalAlts does not work well for nullary constructors @@ -882,9 +882,10 @@ Note [Combine identical alternatives: wrinkles] [] -> f [] (_:_) -> f y Here we won't see that [] and y are the same. Sigh! This problem - is solved in CSE, in CSE.combineAlts, which does a better version of - combineIdenticalAlts. But sadly it doesn't have the occurrence info - we have here. See Note [Combine case alts: awkward corner] in CSE). + is solved in CSE, in GHC.Core.Op.CSE.combineAlts, which does a better version + of combineIdenticalAlts. But sadly it doesn't have the occurrence info we have + here. + See Note [Combine case alts: awkward corner] in GHC.Core.Op.CSE). Note [Care with impossible-constructors when combining alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1675,10 +1676,10 @@ isDivOp _ = False ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ exprOkForSpeculation accepts very special case expressions. Reason: (a ==# b) is ok-for-speculation, but the litEq rules -in PrelRules convert it (a ==# 3#) to +in GHC.Core.Op.ConstantFold convert it (a ==# 3#) to case a of { DEFAULT -> 0#; 3# -> 1# } for excellent reasons described in - PrelRules Note [The litEq rule: converting equality to case]. + GHC.Core.Op.ConstantFold Note [The litEq rule: converting equality to case]. So, annoyingly, we want that case expression to be ok-for-speculation too. Bother. @@ -1692,12 +1693,12 @@ But we restrict it sharply: Does the RHS of v satisfy the let/app invariant? Previously we said yes, on the grounds that y is evaluated. But the binder-swap done - by SetLevels would transform the inner alternative to + by GHC.Core.Op.SetLevels would transform the inner alternative to DEFAULT -> ... (let v::Int# = case x of { ... } in ...) .... which does /not/ satisfy the let/app invariant, because x is not evaluated. See Note [Binder-swap during float-out] - in SetLevels. To avoid this awkwardness it seems simpler + in GHC.Core.Op.SetLevels. To avoid this awkwardness it seems simpler to stick to unlifted scrutinees where the issue does not arise. @@ -1718,7 +1719,7 @@ But we restrict it sharply: ----- Historical note: #15696: -------- - Previously SetLevels used exprOkForSpeculation to guide + Previously GHC.Core.Op.SetLevels used exprOkForSpeculation to guide floating of single-alternative cases; it now uses exprIsHNF Note [Floating single-alternative cases]. @@ -1728,8 +1729,8 @@ But we restrict it sharply: A -> ... _ -> ...(case (case x of { B -> p; C -> p }) of I# r -> blah)... - If SetLevels considers the inner nested case as - ok-for-speculation it can do case-floating (in SetLevels). + If GHC.Core.Op.SetLevels considers the inner nested case as + ok-for-speculation it can do case-floating (in GHC.Core.Op.SetLevels). So we'd float to: case e of x { DEAFULT -> case (case x of { B -> p; C -> p }) of I# r -> @@ -2063,7 +2064,7 @@ we don't want Lint to complain. The 'y' is evaluated, so the case in the RHS of the binding for 'v' is fine. But only if we *know* that 'y' is evaluated. -c.f. add_evals in Simplify.simplAlt +c.f. add_evals in GHC.Core.Op.Simplify.simplAlt ************************************************************************ * * @@ -2332,7 +2333,7 @@ There are some particularly delicate points here: * Note [Arity care]: we need to be careful if we just look at f's arity. Currently (Dec07), f's arity is visible in its own RHS (see - Note [Arity robustness] in SimplEnv) so we must *not* trust the + Note [Arity robustness] in GHC.Core.Op.Simplify.Env) so we must *not* trust the arity when checking that 'f' is a value. Otherwise we will eta-reduce f = \x. f x |