[PATCH] D82561: [analyzer][CrossTU] Lower CTUImportThreshold default value

Endre Fülöp via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 26 01:36:35 PDT 2020


gamesh411 added a comment.

In D82561#2116091 <https://reviews.llvm.org/D82561#2116091>, @balazske wrote:

> In D82561#2115578 <https://reviews.llvm.org/D82561#2115578>, @xazax.hun wrote:
>
> > The analyzer inlines small functions within a TU regardless of the thresholds. I think it would be sensible to do the same across TUs in the case we don't do this already.
>
>
> That means perform a get CTU definition if the TU to be imported (where the function comes from) is small? Otherwise it does not matter how small the function is, it can result in importing of large amount of code. Determining parameters (like "smallness") of the TU is probably not simple.


Measuring the smallness of a function is currently not trivial if the function is in another TU. But theoretically, the creation process of the CTU index has access to the number of declarations in a function, which could be used as a metric for complexity.

Another concern is memory usage. Currently I am working on a solution to approximate the memory usage of declarations by measuring the total memory usage, and the number of declarations inside a TU. Then I can come up with average values for memory used per declaration for projects I test. I could measure multiple projects per language and come up with some statistics that way, but I'm sure that I am not alone with the feeling that there should be a better metric for memory usage other than this roundabout method. All would be well if there were a way to get `sizeof(astunit)`, but I am not aware of any.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82561/new/

https://reviews.llvm.org/D82561





More information about the cfe-commits mailing list