[PATCH] D123152: [WPD] Add statistics

Mingming Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 5 17:42:07 PDT 2022


luna added a comment.

In D123152#3430973 <https://reviews.llvm.org/D123152#3430973>, @tejohnson wrote:

> In D123152#3430851 <https://reviews.llvm.org/D123152#3430851>, @luna wrote:
>
>> LGTM.
>>
>> Only one question regarding whether the counter is intended for DevirtModule or DevirtIndex (or both)
>
> Both, see inline reply below.



In D123152#3430973 <https://reviews.llvm.org/D123152#3430973>, @tejohnson wrote:

> In D123152#3430851 <https://reviews.llvm.org/D123152#3430851>, @luna wrote:
>
>> LGTM.
>>
>> Only one question regarding whether the counter is intended for DevirtModule or DevirtIndex (or both)
>
> Both, see inline reply below.





================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1155
                              TheFn->stripPointerCasts()->getName(), OREGetter);
+      NumSingleImpl++;
       auto &CB = VCallSite.CB;
----------------
tejohnson wrote:
> luna wrote:
> > If I'm reading correctly, `NumSingleImpl` is incremented in `DevirtModule::applySingleImplDevirt`, but not for `DevirtIndex::trySingleImplDevirt`.
> > 
> > I'm wondering if this is intended for the purpose of this cl. If yes, maybe describe something like 
> > 
> > The counter is incremented in regular LTO (or ThinLTO, etc)
> Note that applySingleImplDevirt is called both for regular and thin LTO - for ThinLTO it is called during the backends, from importResolution(). This counter is keeping track of the number of actual single impl devirtualizations (i.e. callsites where that optimization is applied).
> 
> During the whole program portion (both regular and thin LTO) we keep track of the number of target functions that had devirtualizations in the NumDevirtTargets statistic.
> Note that applySingleImplDevirt is called both for regular and thin LTO - for ThinLTO it is called during the backends, from importResolution(). This counter is keeping track of the number of actual single impl devirtualizations (i.e. callsites where that optimization is applied).

> During the whole program portion (both regular and thin LTO) we keep track of the number of target functions that had devirtualizations in the NumDevirtTargets statistic.

Ah I see your point. Basically `DevirtIndex::run` is called within `runWholeProgramDevirtOnIndex` in the thin-link step, and `DevirtModule::run` is called for thinLTO backend compile (after thin-link step).

Thanks for pointing it out!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123152



More information about the llvm-commits mailing list