[PATCH] D24118: [JumpThreading] Only write back branch-weight MDs for blocks that originally had PGO info

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 19:08:47 PDT 2016

davidxl added a comment.

There is no PR for the first problem.

For the loop trip count problem, see https://llvm.org/bugs/show_bug.cgi?id=27791. I have cc'ed you in that bug.

The right solution for problem #1 is

1. in BPI, when reading meta data to create BP, if there is zero weight, BPI should assign an extreme branch probability value instead of using zero
2. in BFI, remove the code that add 1 to the zero weight
3. In FE PGO, do not add one to weight.

The handling in 2) is not ideal for a very special case -- loop with exit edge not executed (because for instance call to no return function). In such as, BFI will still produce huge frequency for the loop body ..  A real solution may require PGOUse to annotate the loop body with the real count of the loop header.


More information about the llvm-commits mailing list