]> granicus.if.org Git - llvm/commit
[PGO/SamplePGO][NFC] Move the function updateProfWeight from Instruction
authorWei Mi <wmi@google.com>
Mon, 22 Apr 2019 17:04:51 +0000 (17:04 +0000)
committerWei Mi <wmi@google.com>
Mon, 22 Apr 2019 17:04:51 +0000 (17:04 +0000)
commit7a0ec3b9438db1bedfb31a0967748e51ba620ee5
tree8c57f7120245c4e61cf4a12ea062fab7f4b513e2
parenta736b962ff911a4b6a295dc919d5fc8b80453d79
[PGO/SamplePGO][NFC] Move the function updateProfWeight from Instruction
to CallInst.

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.

Differential Revision: https://reviews.llvm.org/D60911

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358900 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Instruction.h
include/llvm/IR/Instructions.h
lib/IR/Instruction.cpp
lib/IR/Instructions.cpp