[PATCH] D33577: CodeGen: BlockPlacement: Use Branching factor to choose between near equals.

Kyle Butt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 15:19:34 PDT 2017


iteratee added a comment.

In https://reviews.llvm.org/D33577#766128, @davidxl wrote:

>   It is basically a choice between a layout (exiting) that has 50% chance of not taking any branches , 25% of taking one branch, and 25% of taking more than one branches   vs the new layout that has only 6.25% chance of taking zero branch and 93.75% of taking only one branch.
>   
>
> The existing layout only has 25% chance of taking more than 2 branches -- is it worth sacrificing  43.75% of chances to not take any branches for the improvement for the 25% cases?


Yes.
Another way of looking at this is that the new layout is more resilient to our guesses or profiles being wrong.

Note that the existing layout gets chosen somewhat at random. For exactly 50/50 branches, we rely on the order of the successors, so we're creating a guaranteed order where in the existing code, there isn't any. If the branches were reversed in the IR, we won't un-reverse them.


Repository:
  rL LLVM

https://reviews.llvm.org/D33577





More information about the llvm-commits mailing list