[all-commits] [llvm/llvm-project] 28b912: [BasicBlockSections] Introduce the path cloning pr...

Rahman Lavaee via All-commits all-commits at lists.llvm.org
Wed Oct 11 22:47:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 28b912687900bc0a67cd61c374fce296b09963c4
      https://github.com/llvm/llvm-project/commit/28b912687900bc0a67cd61c374fce296b09963c4
  Author: Rahman Lavaee <rahmanl at google.com>
  Date:   2023-10-11 (Wed, 11 Oct 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
    M llvm/lib/CodeGen/BasicBlockSections.cpp
    M llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
    M llvm/test/CodeGen/X86/basic-block-sections-clusters-error.ll

  Log Message:
  -----------
  [BasicBlockSections] Introduce the path cloning profile format to BasicBlockSectionsProfileReader. (#67214)

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.

1. Specifies the cloning paths with a 'p' specifier. For example, `p 1 4
5` specifies that blocks with BB ids 4 and 5 must be cloned along the
edge 1 --> 4.
2. 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.
```
f foo
p 1 2
c 0 1 2.1 3 2 5
```

This patch keeps backward-compatibility (retains the behavior for old
profile formats). This feature is only introduced for profile version >=
1.




More information about the All-commits mailing list