[PATCH] D52716: [Inliner] Penalise inlining of calls with loops at Oz

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 2 12:17:17 PDT 2018


efriedma added a comment.

> unless we count that they are 32bit instructions? Do we do a lot of modelling of that?

The inliner doesn't try to model that at all.  It's not really that important outside of -Oz, anyway, and it's sort of a hard problem given that the size of an instruction depends on register allocation.

> Exactly where would a gep be be free? Just loads and stores and other geps? Perhaps memcpy's if they are small enough? Or from other instructions in general?

Something like that. IIRC the inliner is a bit more generous at the moment, on the assumption that some GEPs will eventually simplify.

> is essentially like changing our threshold from <=0 to <=25, and saying "more optimisations may happen, lets fudge it a bit"

In this context, yes.  (There are other places that use CallPenalty, but they aren't really relevant here.)  But changing it is effectively equivalent to just changing the inline threshold.  If you think OptMinSizeThreshold is wrong, you can try modifying it (it doesn't necessarily have to be a positive number).

> The same could be said for function arguments, right? They may be free if they can be put into the correct register, but wont be if they are also needed after the call.

Yes.


https://reviews.llvm.org/D52716





More information about the llvm-commits mailing list