Clang equivalent to gcc large-function-growth?

Does clang have an equivalent to gcc’s large-function-growth option to limit the growth of functions due to inlining?

This patch:

https://reviews.llvm.org/D92780

Looks like it may have added something close-ish to what you want. Although the patch limits the size of the callees that are inlined, not the final size of the caller. But that’s probably the closest thing we have right now, AFAIK.

Otherwise, in the worst case, I guess you could tweak the threshold values, although I don’t think I’d recommend that. That’ll tweak how much inlining will happen, but it’s not guaranteed to be stable. At the very least, this value does vary based off optimization level, so it’s not completely disjoint from overall (expected) size.

// Various thresholds used by inline cost analysis.
/// Use when optsize (-Os) is specified.
const int OptSizeThreshold = 50;

/// Use when minsize (-Oz) is specified.
const int OptMinSizeThreshold = 5;

/// Use when -O3 is specified.
const int OptAggressiveThreshold = 250;

IIRC you can change these with -mllvm -inline-threshold=<magic number of your choice>.

If you do take this route, I recommend turning on optimization remarks for inlining and keeping an eye on what is/isn’t inlined.

Thanks. I’ll give that a shot.