- UnfoldNever -> False
-
- InlineRule { ir_info = inl_info, ir_sat = sat }
- | InlAlways <- inl_info -> True -- No top-level binding, so inline!
- -- Ignore is_active because we want to
- -- inline even if SimplGently is on.
- | not active_inline -> False
- | n_val_args < uf_arity -> yes_unsat -- Not enough value args
- | InlSmall <- inl_info -> True -- Note [INLINE for small functions]
- | otherwise -> some_benefit -- Saturated or over-saturated
- where
- -- See Note [Inlining an InlineRule]
- yes_unsat = case sat of
- InlSat -> False
- InlUnSat -> interesting_args
-
- UnfoldIfGoodArgs { ug_args = arg_discounts, ug_res = res_discount, ug_size = size }
- | not active_inline -> False
- | not is_cheap -> False
- | n_val_args < uf_arity -> interesting_args && small_enough
- -- Note [Unsaturated applications]
- | uncondInline uf_arity size -> True
- | otherwise -> some_benefit && small_enough
+ UnfNever -> (False, empty)
+
+ UnfWhen unsat_ok boring_ok
+ -> (enough_args && (boring_ok || some_benefit), empty )
+ where -- See Note [INLINE for small functions]
+ enough_args = saturated || (unsat_ok && n_val_args > 0)