Following up on prior RFC (https://lists.llvm.org/pipermail/llvm-dev/2020-September/145357.html) we can now improve above our highly-optimized basic-block-sections binary (e.g., 2% for clang) by applying path cloning. Cloning can improve performance by reducing taken branches.
This patch prepares the profile format for applying cloning actions.
The basic block cloning profile format extends the basic block sections profile in two ways.
- Specifies the cloning paths with a !!! prefix. For example, !!!1 4 5 specifies that blocks with BB ids 4 and 5 must be cloned along the edge 1 --> 4.
- For each cloned block, it will appear in the cluster info as <bb_id>.<clone_id> where clone_id is the id associated with this clone.
For example, the following profile specifies one cloned block (2) and determines its cluster position as well.
!foo !!!1 2 !!0 1 2.1 3 2 5
This patch keeps backward-compatibility (retains the behavior for old profile format).