[PATCH] D50704: [Inline-cost] Teach cost function to account for accumulative code-size growth
David Greene via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 14 09:20:26 PDT 2018
greened added inline comments.
================
Comment at: lib/Analysis/InlineCost.cpp:1908
+ // code growth of X.
+ // Then, the actual code-size growth is S - (N * X). We assume that the
+ // code growth is constant when inlining the same function.
----------------
S - (N*X) doesn't match what the comment message says and doesn't make sense to me in this context. If N is large enough, this says the growth could become negative.
================
Comment at: lib/Analysis/InlineCost.cpp:1913
+
+ int Growth = (NumInstructions - NumInstructionsSimplified) * F.getNumUses();
+
----------------
This assumes all uses are inlined. That seems overly pessimistic. I'm not sure it's wise to predict what the inliner will do in the cost model. It seems like an incremental cost would be better. The inliner would then do the cost analysis for each inlining opportunity and decide on a case-by-case basis whether to inline or not. As written, this seems to have the cost model driving inline decisions (inline everything or nothing) rather than the inliner using cost information to make decisions.
https://reviews.llvm.org/D50704
More information about the llvm-commits
mailing list