[PATCH] D60911: [PGO/SamplePGO][NFC] Move the function updateProfWeight from Instruction to CallInst

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 11:57:28 PDT 2019


wmi created this revision.
wmi added reviewers: davidxl, eraman.
Herald added a project: LLVM.

The issue was raised here: https://reviews.llvm.org/D60903#1472783

The function Instruction::updateProfWeight is only used for CallInst in profile update. From the current interface, it is very easy to think that the function can also be used for branch instruction. However, Branch instruction does't need the scaling the function provides for branch_weights and VP (value profile), in addition, scaling may introduce inaccuracy for branch probablity.

The patch moves the function updateProfWeight from Instruction class to CallInst to remove the confusion. The patch also changes the scaling of branch_weights from a loop to a block because we know that ProfileData for branch_weights of CallInst will only have two operands at most.


Repository:
  rL LLVM

https://reviews.llvm.org/D60911

Files:
  include/llvm/IR/Instruction.h
  include/llvm/IR/Instructions.h
  lib/IR/Instruction.cpp
  lib/IR/Instructions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60911.195891.patch
Type: text/x-patch
Size: 5925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190419/504e17e7/attachment.bin>


More information about the llvm-commits mailing list