X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FsimplCore%2FSimplUtils.lhs;h=f298acef187e4fa5d2e621fce7576c148793ce1f;hb=993ce43d3f3fb6bdb04cbc6d82babdd23355f7d7;hp=6d2250550ebf376ce0e142124d613791afc7955c;hpb=30c122df62ec75f9ed7f392f24c2925675bf1d06;p=ghc-hetmet.git diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs index 6d22505..f298ace 100644 --- a/compiler/simplCore/SimplUtils.lhs +++ b/compiler/simplCore/SimplUtils.lhs @@ -353,6 +353,11 @@ mkArgInfo :: Id -> ArgInfo mkArgInfo fun n_val_args call_cont + | n_val_args < idArity fun -- Note [Unsaturated functions] + = ArgInfo { ai_rules = False + , ai_strs = vanilla_stricts + , ai_discs = vanilla_discounts } + | otherwise = ArgInfo { ai_rules = interestingArgContext fun call_cont , ai_strs = arg_stricts , ai_discs = arg_discounts } @@ -383,7 +388,20 @@ mkArgInfo fun n_val_args call_cont else map isStrictDmd demands ++ vanilla_stricts - other -> vanilla_stricts -- Not enough args, or no strictness + | otherwise + -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) + <+> ppr n_val_args <+> ppr demands ) + vanilla_stricts -- Not enough args, or no strictness + +{- Note [Unsaturated functions] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider (test eyeball/inline4) + x = a:as + y = f x +where f has arity 2. Then we do not want to inline 'x', because +it'll just be floated out again. Even if f has lots of discounts +on its first argument -- it must be saturated for these to kick in +-} interestingArgContext :: Id -> SimplCont -> Bool -- If the argument has form (f x y), where x,y are boring, @@ -748,7 +766,7 @@ activeInline env id = case getMode env of SimplGently -> False -- No inlining at all when doing gentle stuff, - -- except for local things that occur once + -- except for local things that occur once (pre/postInlineUnconditionally) -- The reason is that too little clean-up happens if you -- don't inline use-once things. Also a bit of inlining is *good* for -- full laziness; it can expose constant sub-expressions.