[all-commits] [llvm/llvm-project] 294f3c: Reapply "[llvm][IR] Extend BranchWeightMetadata to...
Paul Kirth via All-commits
all-commits at lists.llvm.org
Wed Jun 12 12:52:51 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 294f3ce5dde916c358d8f672b4a1c706c0387154
https://github.com/llvm/llvm-project/commit/294f3ce5dde916c358d8f672b4a1c706c0387154
Author: Paul Kirth <paulkirth at google.com>
Date: 2024-06-12 (Wed, 12 Jun 2024)
Changed paths:
M clang/test/CodeGenCXX/attr-likelihood-if-vs-builtin-expect.cpp
M llvm/docs/BranchWeightMetadata.rst
M llvm/include/llvm/IR/MDBuilder.h
M llvm/include/llvm/IR/ProfDataUtils.h
M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm/lib/CodeGen/CodeGenPrepare.cpp
M llvm/lib/IR/Instruction.cpp
M llvm/lib/IR/Instructions.cpp
M llvm/lib/IR/MDBuilder.cpp
M llvm/lib/IR/Metadata.cpp
M llvm/lib/IR/ProfDataUtils.cpp
M llvm/lib/IR/Verifier.cpp
M llvm/lib/Transforms/IPO/SampleProfile.cpp
M llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
M llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
M llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
M llvm/lib/Transforms/Scalar/JumpThreading.cpp
M llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
M llvm/lib/Transforms/Utils/Local.cpp
M llvm/lib/Transforms/Utils/LoopPeel.cpp
M llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
M llvm/test/Transforms/LowerExpectIntrinsic/basic.ll
M llvm/test/Transforms/LowerExpectIntrinsic/expect-with-probability.ll
M llvm/test/Transforms/LowerExpectIntrinsic/expect_nonboolean.ll
M llvm/test/Transforms/LowerExpectIntrinsic/phi_merge.ll
M llvm/test/Transforms/LowerExpectIntrinsic/phi_or.ll
M llvm/test/Transforms/LowerExpectIntrinsic/phi_tern.ll
M llvm/test/Transforms/LowerExpectIntrinsic/phi_unexpect.ll
M llvm/test/Transforms/PhaseOrdering/AArch64/hoist-runtime-checks.ll
Log Message:
-----------
Reapply "[llvm][IR] Extend BranchWeightMetadata to track provenance o… (#95281)
…f weights" #95136
Reverts #95060, and relands #86609, with the unintended code generation
changes addressed.
This patch implements the changes to LLVM IR discussed in
https://discourse.llvm.org/t/rfc-update-branch-weights-metadata-to-allow-tracking-branch-weight-origins/75032
In this patch, we add an optional field to MD_prof meatdata nodes for
branch weights, which can be used to distinguish weights added from
llvm.expect* intrinsics from those added via other methods, e.g. from
profiles or inserted by the compiler.
One of the major motivations, is for use with MisExpect diagnostics,
which need to know if branch_weight metadata originates from an
llvm.expect intrinsic. Without that information, we end up checking
branch weights multiple times in the case if ThinLTO + SampleProfiling,
leading to some inaccuracy in how we report MisExpect related
diagnostics to users.
Since we change the format of MD_prof metadata in a fundamental way, we
need to update code handling branch weights in a number of places.
We also update the lang ref for branch weights to reflect the change.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list