Improving edge probabilities computation when choosing the best successor in machine...
authorCong Hou <congh@google.com>
Wed, 18 Nov 2015 00:52:52 +0000 (00:52 +0000)
committerCong Hou <congh@google.com>
Wed, 18 Nov 2015 00:52:52 +0000 (00:52 +0000)
commitd663426c2fcd19aac2cba06993cde8eed5579f6b
treec54eab183def666e1e4b7d2403173f5ad75f71d2
parent9dcdf0d33d0d850740bc9587f3e0166941c70ada
Improving edge probabilities computation when choosing the best successor in machine block placement.

When looking for the best successor from the outer loop for a block
belonging to an inner loop, the edge probability computation can be
improved so that edges in the inner loop are ignored. For example,
suppose we are building chains for the non-loop part of the following
code, and looking for B1's best successor. Assume the true body is very
hot, then B3 should be the best candidate. However, because of the
existence of the back edge from B1 to B0, the probability from B1 to B3
can be very small, preventing B3 to be its successor. In this patch, when
computing the probability of the edge from B1 to B3, the weight on the
back edge B1->B0 is ignored, so that B1->B3 will have 100% probability.

if (...)
  do {
    B0;
    ... // some branches
    B1;
  } while(...);
else
  B2;
B3;

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253414 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineBlockPlacement.cpp
test/CodeGen/X86/code_placement_ignore_succ_in_inner_loop.ll [new file with mode: 0644]