Update the branch weight metadata in JumpThreading pass.
authorCong Hou <congh@google.com>
Tue, 13 Oct 2015 18:43:10 +0000 (18:43 +0000)
committerCong Hou <congh@google.com>
Tue, 13 Oct 2015 18:43:10 +0000 (18:43 +0000)
commitf066140cf7af087a198ed5825245fc1c3c06e923
tree226306513a43b45f15d583f18ca91a2da7f81291
parent198cdecb00077ca4a21154c498341d21acb5ee82
Update the branch weight metadata in JumpThreading pass.

Currently 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@250204 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