The InlineCostAnalyzer has contained this since it was created:
+ // Don't inline into something too big, which would make it bigger. Here, we
+ // count each basic block as a single unit.
+ InlineCost += Caller->size()/20;
It discourages inlining into very big functions. (100 basic blocks in the caller = 1 instruction in the callee.) Does anybody remember the rationale behind that heuristic?
I am currently looking at a very big function with enough basic blocks that the heuristic effectively disables inlining at -Os. Even for trivial functions that would shrink the size of the function!