[PATCH] D128858: [llvm] Provide utility function for MD_prof

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 20:39:34 PDT 2022


paulkirth created this revision.
Herald added subscribers: hiraditya, mgorny.
Herald added a project: All.
paulkirth updated this revision to Diff 446985.
paulkirth added a comment.
paulkirth updated this revision to Diff 447025.
paulkirth updated this revision to Diff 447030.
paulkirth updated this revision to Diff 447033.
paulkirth added reviewers: tejohnson, phosek, bogner.
paulkirth published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Simplify helper functions and remove helpers for MD_prof types other than branch_weights


paulkirth added a comment.

Refactor interfaces


paulkirth added a comment.

Add assert back


paulkirth added a comment.

Small fixup from rebase


paulkirth added a comment.

There's an argument to be made that most of these utility functions should just be part of `Metadata.cpp.` Separating them seems like a good idea, but as I've implemented this and begun to integrate their use in D128860 <https://reviews.llvm.org/D128860>, I've found that there seems to be significant overlap w/ some of the utility functions in `Metadata.cpp`

I'll defer to reviewers on precisely where this should live, since there are a few good alternatives in my mind.


Currently, there is significant code duplication for dealing with
MD_prof metadata throughout the compiler. These utility functions can
improve code reuse and simplify boilerplate code when dealing with
profiling metadata, such as branch weights. The inent is to provide a
uniform set of APIs that allow common tasks, such as identifying
specific types of MD_prof metadata and extracting branch weights.

Future patches can build on this initial implementation and clean up the
different implementations across the compiler.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128858

Files:
  llvm/include/llvm/IR/ProfDataUtils.h
  llvm/lib/IR/CMakeLists.txt
  llvm/lib/IR/ProfDataUtils.cpp
  llvm/unittests/Transforms/Utils/CMakeLists.txt
  llvm/unittests/Transforms/Utils/ProfDataUtilTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128858.447033.patch
Type: text/x-patch
Size: 10522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220723/1259f44c/attachment.bin>


More information about the llvm-commits mailing list