[PATCH] D158680: Interpet {branch_weights 1, 0} as likely/unlikely

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 15:57:01 PDT 2023


MatzeB created this revision.
MatzeB added reviewers: lebedev.ri, spatel, davidxl, wenlei, hoy, paulkirth.
Herald added subscribers: StephenFan, modimo, hiraditya, mcrosier.
Herald added a project: All.
MatzeB requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This changes BranchProbabilityInfo to interpret branch weights metadata having only 1 non-zero entry as "likely"/"unlikely" branches.
Meaning `!{"branch_weights", i32 1, i32 0}` being an abstract representation of a "likely" branch. The adjustments for the concrete weights of likely/unlikely are moved into BranchProbabilityInfo and are applied when computing the analysis.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158680

Files:
  llvm/docs/BranchWeightMetadata.rst
  llvm/include/llvm/Analysis/BranchProbabilityInfo.h
  llvm/include/llvm/IR/ProfDataUtils.h
  llvm/lib/Analysis/BranchProbabilityInfo.cpp
  llvm/lib/IR/ProfDataUtils.cpp
  llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
  llvm/lib/Transforms/Utils/MisExpect.cpp
  llvm/test/Transforms/CodeExtractor/PartialInlinePGOMultiRegion.ll
  llvm/test/Transforms/CodeExtractor/PartialInlinePGORegion.ll
  llvm/test/Transforms/LowerExpectIntrinsic/basic.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
  llvm/test/Transforms/SampleProfile/profile-inference.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158680.552913.patch
Type: text/x-patch
Size: 17567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230823/3d4ee67a/attachment.bin>


More information about the llvm-commits mailing list