[PATCH] D30651: [InlineCost, -Oz] Don't take into account the penalty of a fast call of frequently used functions

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 10:54:29 PST 2017


efriedma added a comment.

> I ran LNT for the patch. There are big code-size regressions in benchmarks written in C++. So the idea to treat functions with the non-local linkage as having many users needs some research.

Hmm.  Maybe you're just turning the inline threshold too low to eliminate C++ abstractions.  Or maybe in C++, the average number of callers for a linkonce function is lower than we might expect.  Not sure.

> What do think about an idea to add a knob for CallPenalty? Playing with it and the threshold knob in the driver can do what I want to do with the patch.

Makes sense, at least to make it easier to experiment with it.

> Should we have a check of inter-iteration dependencies in CallAnalyzer::visitGetElementPtr?

The problem isn't really inter-iteration dependencies, exactly... it's that the computation which declares a GEP "free" (see getGEPCost in TargetTransformInfoImpl.h) isn't paying attention to the instructions which use the GEP.  A GEP can only be free if we can fold the addressing mode into a load or store instruction.  Not sure how relevant that is in practice, though.


https://reviews.llvm.org/D30651





More information about the llvm-commits mailing list