From: simonmar Date: Thu, 4 Aug 2005 11:23:42 +0000 (+0000) Subject: [project @ 2005-08-04 11:23:42 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~261 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=f5aeb6b56e5aac907643072c73ef1623195e0c6b;p=ghc-hetmet.git [project @ 2005-08-04 11:23:42 by simonmar] callSiteInline: consider inlining even the once-in-one-branch occurrences. See comment for details. --- diff --git a/ghc/compiler/coreSyn/CoreUnfold.lhs b/ghc/compiler/coreSyn/CoreUnfold.lhs index 774ee6e..d840f45 100644 --- a/ghc/compiler/coreSyn/CoreUnfold.lhs +++ b/ghc/compiler/coreSyn/CoreUnfold.lhs @@ -520,13 +520,15 @@ callSiteInline dflags active_inline inline_call occ id arg_infos interesting_con | otherwise = case occ of IAmDead -> pprTrace "callSiteInline: dead" (ppr id) False IAmALoopBreaker -> False - - -- Occurs once in one branch. These are deal with by - -- preInlineUnconditionally, so we ignore them here: - OneOcc _ True _ -> False - - OneOcc in_lam False _ -> (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 + -- caught by preInlineUnconditionally. In particular, + -- if the occurrence is once inside a lambda, and the + -- rhs is cheap but not a manifest lambda, then + -- pre-inline will not have inlined it for fear of + -- invalidating the occurrence info in the rhs. consider_safe once -- consider_safe decides whether it's a good idea to