[PATCH] Enhance loop rotation with existence of profile data in MachineBlockPlacement pass.

David davidxl at google.com
Sat Jun 27 22:04:39 PDT 2015


Cong, the proposed cost analysis can not handle diamond shaped or loops with more complicated control flow. To handle those cases, I think you need to generalize it  by computing the complete branch costs for all rotation candidates and select the one with the least cost.  The entry and exit connection cost computation remains the same. To compute taken branch cost, there are only 4 cases to consider: tail BB with 1 successor, tail BB multiple successors, non-tail BB with 1 successor, non-tail BB with multiple successors.

B0
do {
B1
 if (..) {

  B2

} else {

  B3 

}
B4
} while (..);
B5;

If the original layout keeps the topo order:
B0 B1 B2 B3 B4 B5

The cost analysis should discover the optimal rotation to be
B0 B3 B4 B1 B2 B5


http://reviews.llvm.org/D10717

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list