Revive http://reviews.llvm.org/D12778 to handle forward-hot-prob and...
Revive http://reviews.llvm.org/D12778 to handle forward-hot-prob and backward-hot-prob consistently. Summary: Consider the following diamond CFG: A / \ B C \/ D Suppose A->B and A->C have probabilities 81% and 19%. In block-placement, A->B is called a hot edge and the final placement should be ABDC. However, the current implementation outputs ABCD. This is because when choosing the next block of B, it checks if Freq(C->D) > Freq(B->D) * 20%, which is true (if Freq(A) = 100, then Freq(B->D) = 81, Freq(C->D) = 19, and 19 > 81*20%=16.2). Actually, we should use 25% instead of 20% as the probability here, so that we have 19 < 81*25%=20.25, and the desired ABDC layout will be generated. Reviewers: djasper, davidxl Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20989 llvm-svn: 272203
Showing
- llvm/lib/CodeGen/MachineBlockPlacement.cpp 10 additions, 3 deletionsllvm/lib/CodeGen/MachineBlockPlacement.cpp
- llvm/test/CodeGen/AArch64/fast-isel-branch-cond-split.ll 2 additions, 2 deletionsllvm/test/CodeGen/AArch64/fast-isel-branch-cond-split.ll
- llvm/test/CodeGen/X86/block-placement.ll 32 additions, 0 deletionsllvm/test/CodeGen/X86/block-placement.ll
Loading
Please register or sign in to comment