Update the branch weight metadata in JumpThreading pass.
authorCong Hou <congh@google.com>
Mon, 12 Oct 2015 19:44:08 +0000 (19:44 +0000)
committerCong Hou <congh@google.com>
Mon, 12 Oct 2015 19:44:08 +0000 (19:44 +0000)
commit152b80c1ee088dc65151051ab42e07a8e75c5101
tree7be78cd31f0e5e2a4d2b985359ba30e8ccc7bdf8
parent011e9479dda6a03abeab41e5e5de234bbf54ab86
Update the branch weight metadata in JumpThreading pass.

In JumpThreading pass, the branch weight metadata is not updated after CFG modification. Consider the jump threading on PredBB, BB, and SuccBB. After jump threading, the weight on BB->SuccBB should be adjusted as some of it is contributed by the edge PredBB->BB, which doesn't exist anymore. This patch tries to update the edge weight in metadata on BB->SuccBB by scaling it by 1 - Freq(PredBB->BB) / Freq(BB->SuccBB).

Differential revision: http://reviews.llvm.org/D10979

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250089 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/BlockFrequencyInfo.h
include/llvm/Analysis/BlockFrequencyInfoImpl.h
include/llvm/CodeGen/MachineBranchProbabilityInfo.h
lib/Analysis/BlockFrequencyInfo.cpp
lib/Analysis/BlockFrequencyInfoImpl.cpp
lib/Transforms/Scalar/JumpThreading.cpp
test/Transforms/JumpThreading/update-edge-weight.ll [new file with mode: 0644]