[Git][ghc/ghc][wip/T26548] Be a little less keen to inline
Simon Peyton Jones pushed to branch wip/T26548 at Glasgow Haskell Compiler / GHC Commits: 654d6ed9 by Simon Peyton Jones at 2025-12-24T13:33:08+00:00 Be a little less keen to inline This commit changes interestingArg to treat lambda as NonTrivArg rather than ValueArg. That makes parser combinators a bit less keen to inline. E.g. <|> p1 p2 = \x -> case p1 x of Yes -> ... No -> ... If we have a call (<|> arg1 arg2) where arg1 is a parser, and hence often visibly a lambda, it's no so great to inline <|>, because we are still stuck on x. This affects for example T17516 Just an experiment. - - - - - 1 changed file: - compiler/GHC/Core/Opt/Simplify/Utils.hs Changes: ===================================== compiler/GHC/Core/Opt/Simplify/Utils.hs ===================================== @@ -1016,7 +1016,7 @@ interestingArg env e = go env 0 e go env n (Lam v e) | isTyVar v = go env n e | n>0 = NonTrivArg -- (\x.b) e is NonTriv - | otherwise = ValueArg + | otherwise = NonTrivArg go _ _ (Case {}) = NonTrivArg go env n (Let b e) = case go env' n e of ValueArg -> ValueArg @@ -1028,7 +1028,7 @@ interestingArg env e = go env 0 e | isConLikeId v = ValueArg -- Experimenting with 'conlike' rather that -- data constructors here -- DFuns are con-like; see Note [Conlike is interesting] - | idArity v > n = ValueArg -- Catches (eg) primops with arity but no unfolding + | idArity v > n = NonTrivArg -- Catches (eg) primops with arity but no unfolding | n > 0 = NonTrivArg -- Saturated or unknown call | otherwise -- n==0, no value arguments; look for an interesting unfolding = case idUnfolding v of View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/654d6ed95007c6f820451e183d0dd947... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/654d6ed95007c6f820451e183d0dd947... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)