hasUnfolding, hasSomeUnfolding, neverUnfold,
couldBeSmallEnoughToInline,
- certainlyWillInline,
+ certainlyWillInline, smallEnoughToInline,
callSiteInline
) where
import CoreSyn
import PprCore ( pprCoreExpr )
import OccurAnal ( occurAnalyseExpr )
-import CoreUtils ( exprIsValue, exprIsCheap, exprIsTrivial )
+import CoreUtils ( exprIsHNF, exprIsCheap, exprIsTrivial )
import Id ( Id, idType, isId,
idUnfolding, globalIdDetails
)
import Bag
import FastTypes
import Outputable
-import Util
#if __GLASGOW_HASKELL__ >= 404
import GLAEXTS ( Int# )
= CoreUnfolding (occurAnalyseExpr expr)
top_lvl
- (exprIsValue expr)
+ (exprIsHNF expr)
-- Already evaluated
(exprIsCheap expr)
= is_cheap && size - (n_vals +1) <= opt_UF_UseThreshold
certainlyWillInline other
= False
+
+smallEnoughToInline :: Unfolding -> Bool
+smallEnoughToInline (CoreUnfolding _ _ _ _ (UnfoldIfGoodArgs _ _ size _))
+ = size <= opt_UF_UseThreshold
+smallEnoughToInline other
+ = False
\end{code}
%************************************************************************
| otherwise = case occ of
IAmDead -> pprTrace "callSiteInline: dead" (ppr id) False
IAmALoopBreaker -> False
- OneOcc in_lam _ _ -> (not in_lam || is_cheap) && consider_safe True
+ --OneOcc in_lam _ _ -> (not in_lam || is_cheap) && consider_safe True
other -> is_cheap && consider_safe False
-- we consider even the once-in-one-branch
-- occurrences, because they won't all have been
where
some_benefit = or arg_infos || really_interesting_cont ||
- (not is_top && (once || (n_vals_wanted > 0 && enough_args)))
+ (not is_top && ({- once || -} (n_vals_wanted > 0 && enough_args)))
-- [was (once && not in_lam)]
-- If it occurs more than once, there must be
-- something interesting about some argument, or the