diff options
Diffstat (limited to 'compiler/simplCore')
-rw-r--r-- | compiler/simplCore/SimplMonad.hs | 7 | ||||
-rw-r--r-- | compiler/simplCore/SimplUtils.hs | 9 |
2 files changed, 5 insertions, 11 deletions
diff --git a/compiler/simplCore/SimplMonad.hs b/compiler/simplCore/SimplMonad.hs index 732805e9ee..32c277cc55 100644 --- a/compiler/simplCore/SimplMonad.hs +++ b/compiler/simplCore/SimplMonad.hs @@ -36,7 +36,8 @@ import Outputable import FastString import MonadUtils import ErrUtils as Err -import Panic (throwGhcExceptionIO, GhcException (..)) +import Util ( count ) +import Panic (throwGhcExceptionIO, GhcException (..)) import BasicTypes ( IntWithInf, treatZeroAsInf, mkIntWithInf ) import Control.Monad ( ap ) @@ -186,8 +187,8 @@ newJoinId bndrs body_ty = do { uniq <- getUniqueM ; let name = mkSystemVarName uniq (fsLit "$j") join_id_ty = mkLamTypes bndrs body_ty -- Note [Funky mkLamTypes] - -- Note [idArity for join points] in SimplUtils - arity = length (filter isId bndrs) + arity = count isId bndrs + -- arity: See Note [Invariants on join points] invariant 2b, in CoreSyn join_arity = length bndrs details = JoinId join_arity id_info = vanillaIdInfo `setArityInfo` arity diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 4eeb51ceaa..eb57720d9e 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1517,7 +1517,7 @@ tryEtaExpandRhs mode bndr rhs -- Note [Do not eta-expand join points] -- But do return the correct arity and bottom-ness, because -- these are used to set the bndr's IdInfo (#15517) - -- Note [idArity for join points] + -- Note [Invariants on join points] invariant 2b, in CoreSyn | otherwise = do { (new_arity, is_bot, new_rhs) <- try_expand @@ -1611,13 +1611,6 @@ CorePrep comes around, the code is very likely to look more like this: $j2 = if n > 0 then $j1 else (...) eta -Note [idArity for join points] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Because of Note [Do not eta-expand join points] we have it that the idArity -of a join point is always (less than or) equal to the join arity. -Essentially, for join points we set `idArity $j = count isId join_lam_bndrs`. -It really can be less if there are type-level binders in join_lam_bndrs. - Note [Do not eta-expand PAPs] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We used to have old_arity = manifestArity rhs, which meant that we |