[LLVMdev] Path profiling interface proposal

David Greene dag at cray.com
Fri Jul 10 17:02:48 PDT 2009


On Friday 10 July 2009 18:06, Slobodan Pejic wrote:
> Hello,
>
> I am planning on contributing path profiling to LLVM by the end of
> August.  I have written a document of what the interface to the path
> profiles would look like at that time.  If someone has any amendments, I
> can incorporate them.

One more comment:

> /* Query for paths in hot to cold order. */
> PathProfileInfo::iterator path = PI.selectPaths(F, blocksRequired.begin(),
> 	blocksRequired.end(), PathProfileInfo::DESC);
> /* Iterating over the first path which is the hottest. */
> for(Path::iterator block = path->begin(); block != path->end(); ++block)
> {
>   cerr << "Traversing basic block: " << block->getName() << "\n";
> }

This seems a bit too cute to me.  There's no reason clients can't iterate
over the returned paths and find the hot one.  Standard C++ algorithms
can do this very easily.  I don't think it's worth the complexity of an
"order" parameter in the query interface and the sorting, etc. that that
implies.  If there's a large number of paths, the client can do the sorting
itself.  A PathCount() interface might be useful.

                                  -Dave



More information about the llvm-dev mailing list