Skip to content
  • Dehao Chen's avatar
    Revive http://reviews.llvm.org/D12778 to handle forward-hot-prob and... · 769219b1
    Dehao Chen authored
    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
    769219b1
Loading