diff options
Diffstat (limited to 'compiler/GHC/Core/Opt/Simplify/Env.hs')
-rw-r--r-- | compiler/GHC/Core/Opt/Simplify/Env.hs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/compiler/GHC/Core/Opt/Simplify/Env.hs b/compiler/GHC/Core/Opt/Simplify/Env.hs index d1b33b0290..43d28cffe2 100644 --- a/compiler/GHC/Core/Opt/Simplify/Env.hs +++ b/compiler/GHC/Core/Opt/Simplify/Env.hs @@ -70,6 +70,7 @@ import GHC.Types.Basic import GHC.Utils.Monad import GHC.Utils.Outputable import GHC.Utils.Panic +import GHC.Utils.Panic.Plain import GHC.Utils.Misc import GHC.Utils.Logger import GHC.Types.Unique.FM ( pprUniqFM ) @@ -336,17 +337,17 @@ bumpCaseDepth env = env { seCaseDepth = seCaseDepth env + 1 } --------------------- extendIdSubst :: SimplEnv -> Id -> SimplSR -> SimplEnv extendIdSubst env@(SimplEnv {seIdSubst = subst}) var res - = ASSERT2( isId var && not (isCoVar var), ppr var ) + = assertPpr (isId var && not (isCoVar var)) (ppr var) $ env { seIdSubst = extendVarEnv subst var res } extendTvSubst :: SimplEnv -> TyVar -> Type -> SimplEnv extendTvSubst env@(SimplEnv {seTvSubst = tsubst}) var res - = ASSERT2( isTyVar var, ppr var $$ ppr res ) + = assertPpr (isTyVar var) (ppr var $$ ppr res) $ env {seTvSubst = extendVarEnv tsubst var res} extendCvSubst :: SimplEnv -> CoVar -> Coercion -> SimplEnv extendCvSubst env@(SimplEnv {seCvSubst = csubst}) var co - = ASSERT( isCoVar var ) + = assert (isCoVar var) $ env {seCvSubst = extendVarEnv csubst var co} --------------------- @@ -516,7 +517,7 @@ emptyJoinFloats = nilOL unitLetFloat :: OutBind -> LetFloats -- This key function constructs a singleton float with the right form -unitLetFloat bind = ASSERT(all (not . isJoinId) (bindersOf bind)) +unitLetFloat bind = assert (all (not . isJoinId) (bindersOf bind)) $ LetFloats (unitOL bind) (flag bind) where flag (Rec {}) = FltLifted @@ -526,12 +527,12 @@ unitLetFloat bind = ASSERT(all (not . isJoinId) (bindersOf bind)) -- String literals can be floated freely. -- See Note [Core top-level string literals] in GHC.Core. | exprOkForSpeculation rhs = FltOkSpec -- Unlifted, and lifted but ok-for-spec (eg HNF) - | otherwise = ASSERT2( not (isUnliftedType (idType bndr)), ppr bndr ) + | otherwise = assertPpr (not (isUnliftedType (idType bndr))) (ppr bndr) FltCareful -- Unlifted binders can only be let-bound if exprOkForSpeculation holds unitJoinFloat :: OutBind -> JoinFloats -unitJoinFloat bind = ASSERT(all isJoinId (bindersOf bind)) +unitJoinFloat bind = assert (all isJoinId (bindersOf bind)) $ unitOL bind mkFloatBind :: SimplEnv -> OutBind -> (SimplFloats, SimplEnv) @@ -618,7 +619,7 @@ mkRecFloats :: SimplFloats -> SimplFloats mkRecFloats floats@(SimplFloats { sfLetFloats = LetFloats bs _ff , sfJoinFloats = jbs , sfInScope = in_scope }) - = ASSERT2( isNilOL bs || isNilOL jbs, ppr floats ) + = assertPpr (isNilOL bs || isNilOL jbs) (ppr floats) $ SimplFloats { sfLetFloats = floats' , sfJoinFloats = jfloats' , sfInScope = in_scope } @@ -654,7 +655,7 @@ wrapJoinFloats join_floats body getTopFloatBinds :: SimplFloats -> [CoreBind] getTopFloatBinds (SimplFloats { sfLetFloats = lbs , sfJoinFloats = jbs}) - = ASSERT( isNilOL jbs ) -- Can't be any top-level join bindings + = assert (isNilOL jbs) $ -- Can't be any top-level join bindings letFloatBinds lbs {-# INLINE mapLetFloats #-} @@ -786,7 +787,7 @@ simplRecBndrs :: SimplEnv -> [InBndr] -> SimplM SimplEnv -- Recursive let binders simplRecBndrs env@(SimplEnv {}) ids -- See Note [Bangs in the Simplifier] - = ASSERT(all (not . isJoinId) ids) + = assert (all (not . isJoinId) ids) $ do { let (!env1, ids1) = mapAccumL substIdBndr env ids ; seqIds ids1 `seq` return env1 } @@ -832,7 +833,7 @@ subst_id_bndr :: SimplEnv -> (SimplEnv, OutBndr) subst_id_bndr env@(SimplEnv { seInScope = in_scope, seIdSubst = id_subst }) old_id adjust_type - = ASSERT2( not (isCoVar old_id), ppr old_id ) + = assertPpr (not (isCoVar old_id)) (ppr old_id) (env { seInScope = new_in_scope, seIdSubst = new_subst }, new_id) -- It's important that both seInScope and seIdSubst are updated with @@ -933,7 +934,7 @@ simplRecJoinBndrs :: SimplEnv -> [InBndr] -- context being pushed inward may change types -- See Note [Return type for join points] simplRecJoinBndrs env@(SimplEnv {}) ids mult res_ty - = ASSERT(all isJoinId ids) + = assert (all isJoinId ids) $ do { let (env1, ids1) = mapAccumL (simplJoinBndr mult res_ty) env ids ; seqIds ids1 `seq` return env1 } @@ -960,7 +961,7 @@ adjustJoinPointType :: Mult -- INVARIANT: If any of the first n binders are foralls, those tyvars -- cannot appear in the original result type. See isValidJoinPointType. adjustJoinPointType mult new_res_ty join_id - = ASSERT( isJoinId join_id ) + = assert (isJoinId join_id) $ setIdType join_id new_join_ty where orig_ar = idJoinArity join_id |