[PATCH] D131306: [llvm][misexpect] Track provenance of branch weights

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 17:33:55 PST 2023


paulkirth updated this revision to Diff 502873.
paulkirth marked 4 inline comments as done.
paulkirth added a comment.

Rebase and address comments.

- update doc comments and describe `IsExpected` parameter
- add assert when scaling branch weights on calls
- remove redundant check, now done in `getValidBranchWeightMDNode()`
- update assert comment, and describe rationale for `hasExpectedProvenance` in `checkBackendInstrumentation()`

TODO:

- investigate making `IsExpected` a non-optional parameter.
- investigate more checks on the instruction type when metadata has an `!expected` field


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131306

Files:
  clang/test/CodeGenCXX/attr-likelihood-if-branch-weights.cpp
  clang/test/CodeGenCXX/attr-likelihood-if-vs-builtin-expect.cpp
  llvm/docs/BranchWeightMetadata.rst
  llvm/include/llvm/IR/MDBuilder.h
  llvm/include/llvm/IR/ProfDataUtils.h
  llvm/lib/Analysis/BranchProbabilityInfo.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/MDBuilder.cpp
  llvm/lib/IR/ProfDataUtils.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/MisExpect.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/LowerExpectIntrinsic/basic.ll
  llvm/test/Transforms/LowerExpectIntrinsic/expect-with-probability.ll
  llvm/test/Transforms/LowerExpectIntrinsic/expect_nonboolean.ll
  llvm/test/Transforms/LowerExpectIntrinsic/phi_merge.ll
  llvm/test/Transforms/LowerExpectIntrinsic/phi_or.ll
  llvm/test/Transforms/LowerExpectIntrinsic/phi_tern.ll
  llvm/test/Transforms/LowerExpectIntrinsic/phi_unexpect.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131306.502873.patch
Type: text/x-patch
Size: 25864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230307/f5800b82/attachment.bin>


More information about the llvm-commits mailing list