[PATCH] D62079: [MBP] Rotate should bring more fallthrough

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 15:58:02 PDT 2019


davidxl added a comment.

I like the direction this patch is going, but I think it can do better.

The block layout algorithm here tries to maximize total FallThrough frequency.  In the context of loop rotation, this can be formulated as such -- comparing the total fall through frequency before and after. If the post rotation fall through freq is lower, do not do it.  In fact, the same idea can be used to find the optimal rotation (optimal bb rotated to the bottom).

In the no_rotate.ll, assuming the Freq(header->middle) = F0, Freq(middle->latch1) = F1 <https://reviews.llvm.org/F1>, Freq(latch1->latch2) = F2 <https://reviews.llvm.org/F2>, Freq(latch2->header) = F3 <https://reviews.llvm.org/F3>,  Freq(header->end) = F4 <https://reviews.llvm.org/F4>, we have F2 <https://reviews.llvm.org/F2> == F3 <https://reviews.llvm.org/F3>,  F0 > F1 <https://reviews.llvm.org/F1> > F2 <https://reviews.llvm.org/F2>

Before rotation, the total fallthrough freq = F0 + F1 <https://reviews.llvm.org/F1> + F2 <https://reviews.llvm.org/F2>
After rotation, the total fall through = F1 <https://reviews.llvm.org/F1> + F2 <https://reviews.llvm.org/F2> + F3 <https://reviews.llvm.org/F3>

Before - After = F 0 - F2 <https://reviews.llvm.org/F2>   > 0, clearly not good to rotate.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62079/new/

https://reviews.llvm.org/D62079





More information about the llvm-commits mailing list