summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreLint.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2019-02-07 15:34:07 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-30 20:23:21 -0400
commit014ed644eea9037427c1ebeaac16189b00f9dbc7 (patch)
tree4e41d1183e559e81a0fbdb1cf9c16fae0448ee43 /compiler/coreSyn/CoreLint.hs
parent1abb76ab8e32e7be224631506201d1beec62a5c2 (diff)
downloadhaskell-014ed644eea9037427c1ebeaac16189b00f9dbc7.tar.gz
Compute demand signatures assuming idArity
This does four things: 1. Look at `idArity` instead of manifest lambdas to decide whether to use LetUp 2. Compute the strictness signature in LetDown assuming at least `idArity` incoming arguments 3. Remove the special case for trivial RHSs, which is subsumed by 2 4. Don't perform the W/W split when doing so would eta expand a binding. Otherwise we would eta expand PAPs, causing unnecessary churn in the Simplifier. NoFib Results -------------------------------------------------------------------------------- Program Allocs Instrs -------------------------------------------------------------------------------- fannkuch-redux +0.3% 0.0% gg -0.0% -0.1% maillist +0.2% +0.2% minimax 0.0% +0.8% pretty 0.0% -0.1% reptile -0.0% -1.2% -------------------------------------------------------------------------------- Min -0.0% -1.2% Max +0.3% +0.8% Geometric Mean +0.0% -0.0%
Diffstat (limited to 'compiler/coreSyn/CoreLint.hs')
-rw-r--r--compiler/coreSyn/CoreLint.hs26
1 files changed, 3 insertions, 23 deletions
diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index 2210716fd5..ef4e858568 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -570,15 +570,9 @@ lintSingleBinding top_lvl_flag rec_flag (binder,rhs)
(addWarnL (text "INLINE binder is (non-rule) loop breaker:" <+> ppr binder))
-- Only non-rule loop breakers inhibit inlining
- -- Check whether arity and demand type are consistent (only if demand analysis
- -- already happened)
- --
- -- Note (Apr 2014): this is actually ok. See Note [Demand analysis for trivial right-hand sides]
- -- in DmdAnal. After eta-expansion in CorePrep the rhs is no longer trivial.
- -- ; let dmdTy = idStrictness binder
- -- ; checkL (case dmdTy of
- -- StrictSig dmd_ty -> idArity binder >= dmdTypeDepth dmd_ty || exprIsTrivial rhs)
- -- (mkArityMsg binder)
+ -- We used to check that the dmdTypeDepth of a demand signature never
+ -- exceeds idArity, but that is an unnecessary complication, see
+ -- Note [idArity varies independently of dmdTypeDepth] in DmdAnal
-- Check that the binder's arity is within the bounds imposed by
-- the type and the strictness signature. See Note [exprArity invariant]
@@ -2565,20 +2559,6 @@ mkKindErrMsg tyvar arg_ty
hang (text "Arg type:")
4 (ppr arg_ty <+> dcolon <+> ppr (typeKind arg_ty))]
-{- Not needed now
-mkArityMsg :: Id -> MsgDoc
-mkArityMsg binder
- = vcat [hsep [text "Demand type has",
- ppr (dmdTypeDepth dmd_ty),
- text "arguments, rhs has",
- ppr (idArity binder),
- text "arguments,",
- ppr binder],
- hsep [text "Binder's strictness signature:", ppr dmd_ty]
-
- ]
- where (StrictSig dmd_ty) = idStrictness binder
--}
mkCastErr :: CoreExpr -> Coercion -> Type -> Type -> MsgDoc
mkCastErr expr = mk_cast_err "expression" "type" (ppr expr)