[PATCH] D33577: CodeGen: BlockPlacement: Use Branching factor to choose between near equals.
David Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 09:26:25 PDT 2017
davidxl added a comment.
Looking at the example. Comparing two layout decisions: 1) always pick the next test as layout successor ; and 2) always pick the (else) if-then block as the layout successor.
A) the number of taken branches is the same
B) assuming 50% prob for all branches, the dynamic count of taken branches with 2) is actually smaller.
So I am not convinced this is a right heuristic unless more data is provided.
Here is the suggestion. You can write up a microbenchmark with this CFG shape. Make all the branch's real probability to be 50% (using controlled by random data make branch less predictable). Using __buitlin_expect to force the layout to be either 1) or 2) described above and compare
a) runtime performance
b) taken branches with PMU.
Repository:
rL LLVM
https://reviews.llvm.org/D33577
More information about the llvm-commits
mailing list