[llvm-dev] Queries Regarding Usage of PGOInstrumentation Passes instead of Deprecated ProfileInfo

Malhar Thakkar via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 15 07:36:17 PDT 2018


Hey all,

I have a piece of code (written in LLVM 2.8) which uses profiling results
produced by ProfileInfo. It essentially computes the number of iterations
performed by a loop from the profiling information available. The code
snippet in my pass looks something like this.

  BasicBlock *header = loop->getHeader();
  ProfileInfo &pi = getAnalysis< ProfileInfo >();
  for(pred_iterator i=pred_begin(header), e=pred_end(header); i!=e; ++i)
  {
    BasicBlock *pred = *i;

    const double edgeCount = *pi.getEdgeWeight*(
ProfileInfo::Edge(pred,header) );
    */* Some code */*
  }

Now, since ProfileInfo has been deprecated and we have PGOInstrumentation
passes along with BranchProbability and BlockFrequency, I wish to update
the above snippet, in particular, obtaining the edge weights (highlighted
in the code above) using the new tools.

In order to do that, I'm first generating edge count profile by the
PGOInstrumentationGen pass and then interpreting the edge count profile
with PGOInstrumentationUse.

In the original code, where I had
au.addRequired< ProfileInfo >(), I now have


*au.addRequired< BlockFrequencyInfoWrapperPass >();au.addRequired<
BranchProbabilityInfoWrapperPass >();*
Now, I have the following queries.

   - How do I use the edge count and branch weights data obtained using
   PGOInstrumentationUse in my pass and replace the *getEdgeWeight()* from
   ProfileInfo?
   - If I call *getBlockProfileCount() *from the BlockFrequency pass, will
   that give me the data read during PGOInstrumentationUse or data based on
   static analysis? In other words, does the data obtained during
   PGOInstrumentationUse "propagate" to BlockFrequency and BranchProbability?


Thank you.


Regards,
Malhar




ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180815/591e685f/attachment.html>


More information about the llvm-dev mailing list