Constant functions and selectors make for interesting arguments
Simon Peyton Jones
simonpj at microsoft.com
Mon Jan 30 21:01:34 UTC 2017
Functions whose body is no bigger (by the inliner’s metrics) than the call are always inlined vigorously. So (\.....-> k) replaces a call by a single variable. GHC will do that a lot.
These ideas are best backed by use-cases where something good is not happening. Do you have some?
From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David Feuer
Sent: 27 January 2017 16:42
To: ghc-devs <ghc-devs at haskell.org>
Subject: Constant functions and selectors make for interesting arguments
GHC's inliner has a notion of "interesting argument" it uses to encourage inlining of functions called with (I think) dictionary arguments. I think another class of argument is very interesting, by being very boring. Any argument that looks like either
\ _ ... (Con _ ... x ... _ ) ... _ -> coerce x
\ _ ... _ -> k
Has a pretty good chance of doing a lot of good when inlined, perhaps plugging a space leak. Would it make sense to try to identify such functions and consider them interesting for inlining?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs