[PATCH] D24410: Use call target count to derive the call instruction weight

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 18 14:54:08 PDT 2016


danielcdh added a comment.

In https://reviews.llvm.org/D24410#545823, @dnovillo wrote:

> OK, so instead of looking at the number of samples collected at the call site, it looks at the number of calls the target had.  But what if the target is called disproportionately more from one call site than the other?
>
> Like:
>
> if (this_is_true_95_percent_of_the_time())
>
>   A();
>
> else
>
>   A();
>   
>
> The example is ridiculous, I know, but wouldn't we end up inlining A() in both branches of the if()?  Is that a code growth issue in general?


No because we use lineno+discriminator to distinguish a callsite, so we can precisely locate both callsites to A and only inline the hot one.


https://reviews.llvm.org/D24410





More information about the llvm-commits mailing list