[clang] [llvm] Reapply "[llvm][IR] Extend BranchWeightMetadata to track provenance o… (PR #95281)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 12 11:09:00 PDT 2024
================
@@ -241,9 +264,11 @@ void scaleProfData(Instruction &I, uint64_t S, uint64_t T) {
if (ProfDataName->getString() == "branch_weights" &&
ProfileData->getNumOperands() > 0) {
// Using APInt::div may be expensive, but most cases should fit 64 bits.
- APInt Val(128, mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(1))
- ->getValue()
- .getZExtValue());
+ APInt Val(128,
+ mdconst::dyn_extract<ConstantInt>(
+ ProfileData->getOperand(getBranchWeightOffset(ProfileData)))
+ ->getValue()
+ .getZExtValue());
----------------
ilovepi wrote:
@david-xl I think this is the big thing I missed in the original patch.
https://github.com/llvm/llvm-project/pull/95281
More information about the cfe-commits
mailing list