Skip to content

Interesting functions for inlining

I know that the inliner considers whether the context is "interesting" when deciding whether to inline, but I couldn't find documentation on that. One thing I'm particularly interested in is how this relates to higher-order functions. If a higher-order function is applied to a totally unknown function, that's pretty boring. But it gets more interesting the more is known about the function. I would expect interestingness bonuses if the applied function

  1. Has a known demand signature that isn't dull.
  2. Has a known arity greater than the called arity.
  3. Has an unfolding (especially a small one, such as a wrapper).

Are any of these on tap? I'm interested in getting some non-trivial folds to specialize to sufficiently interesting argument functions, and trying to avoid the INLINE hammer.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information