In D128454 a backend option was introduced to control the maximum stack size of inlined functions (-mllvm -inline-max-stacksize=<N>).
It seems advantageous to implement this functionality via a function attribute in order to make it work smoothly for LTO, while retaining the ability to override the value on the command line.
Note that the attribute pertains to the caller and not the callee, i.e. if function foo() has the attribute, it means "don't inline any function with a stacksize larger than the given value".
If this is OK, I'll follow up with a clang patch that sets the attribute based on a command line option.
Nit: can you please initialize AttrValue at declaration - just less chances of odd bug chases later.