[all-commits] [llvm/llvm-project] 275e07: [BOLT] Support passing fragments to code emission

Fabian Parzefall via All-commits all-commits at lists.llvm.org
Thu Aug 18 21:56:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 275e075cbe051198fecdfd2f3ef2bc58fd9508f0
      https://github.com/llvm/llvm-project/commit/275e075cbe051198fecdfd2f3ef2bc58fd9508f0
  Author: Fabian Parzefall <parzefall at fb.com>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M bolt/include/bolt/Core/BinaryEmitter.h
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Core/FunctionLayout.h
    M bolt/lib/Core/BinaryContext.cpp
    M bolt/lib/Core/BinaryEmitter.cpp
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/lib/Rewrite/RewriteInstance.cpp

  Log Message:
  -----------
  [BOLT] Support passing fragments to code emission

This changes code emission such that it can emit specific function
fragments instead of scanning all basic blocks of a function and just
emitting those that are hot or cold.

To implement this, `FunctionLayout` explicitly distinguishes the "main"
fragment (i.e. the one that contains the entry block and is associated
with the original symbol) from "split" fragments. Additionally,
`BinaryFunction` receives support for multiple cold symbols - one for
each split fragment.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D130052


  Commit: a191ea7d59508b19a0e73d9a23adc768bcc98246
      https://github.com/llvm/llvm-project/commit/a191ea7d59508b19a0e73d9a23adc768bcc98246
  Author: Fabian Parzefall <parzefall at fb.com>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M bolt/include/bolt/Core/BinaryBasicBlock.h
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Core/FunctionLayout.h
    M bolt/lib/Core/BinaryBasicBlock.cpp
    M bolt/lib/Core/BinaryEmitter.cpp
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/lib/Core/Exceptions.cpp
    M bolt/lib/Passes/Aligner.cpp
    M bolt/lib/Passes/BinaryPasses.cpp
    M bolt/lib/Passes/IndirectCallPromotion.cpp

  Log Message:
  -----------
  [BOLT] Make exception handling fragment aware

This adds basic fragment awareness in the exception handling passes and
generates the necessary symbols for fragments.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D130520


  Commit: 0f74d191d12e1807d291c8db937f1bb89cfe7caa
      https://github.com/llvm/llvm-project/commit/0f74d191d12e1807d291c8db937f1bb89cfe7caa
  Author: Fabian Parzefall <parzefall at fb.com>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M bolt/include/bolt/Core/BinaryBasicBlock.h
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Core/FunctionLayout.h
    M bolt/lib/Core/BinaryContext.cpp
    M bolt/lib/Core/BinaryEmitter.cpp
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/lib/Core/FunctionLayout.cpp
    M bolt/lib/Passes/SplitFunctions.cpp
    M bolt/lib/Rewrite/RewriteInstance.cpp

  Log Message:
  -----------
  [BOLT] Generate sections for multiple fragments

This patch adds support to generate any number of sections that are
assigned to fragments of functions that are split more than two-way.
With this, a function's *nth* split fragment goes into section
`.text.cold.n`.

This also changes `FunctionLayout::erase` to make sure, that there are
no empty fragments at the end of the function. This sometimes happens
when blocks are erased from the function. To avoid creating symbols
pointing to these fragments, they need to be removed.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D130521


  Commit: f428db7a005704b1ccba3f7947ab7bae5b13ec77
      https://github.com/llvm/llvm-project/commit/f428db7a005704b1ccba3f7947ab7bae5b13ec77
  Author: Fabian Parzefall <parzefall at fb.com>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M bolt/include/bolt/Passes/SplitFunctions.h
    M bolt/lib/Passes/SplitFunctions.cpp
    A bolt/test/X86/split-all.s
    M bolt/test/X86/split-random.s

  Log Message:
  -----------
  [BOLT] Add split all blocks strategy

This adds a function splitting strategy that splits each outlineable
basic block into its own fragment. This is exposed through a new command
line option `--split-strategy`.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D129827


  Commit: 48ff38ce5d76217d7dfd7df13313b1a28a1aeffe
      https://github.com/llvm/llvm-project/commit/48ff38ce5d76217d7dfd7df13313b1a28a1aeffe
  Author: Fabian Parzefall <parzefall at fb.com>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M bolt/include/bolt/Passes/SplitFunctions.h
    M bolt/lib/Passes/LoopInversionPass.cpp
    M bolt/lib/Passes/SplitFunctions.cpp
    M bolt/test/X86/split-random.s

  Log Message:
  -----------
  [BOLT] Add randomN split strategy

This adds a strategy to split functions into a random number of
fragments at randomly chosen split points.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D130647


  Commit: ac830664b20cdf2844d3472d5b5ed1c359085989
      https://github.com/llvm/llvm-project/commit/ac830664b20cdf2844d3472d5b5ed1c359085989
  Author: Fabian Parzefall <parzefall at fb.com>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M bolt/include/bolt/Passes/BinaryFunctionCallGraph.h
    M bolt/lib/Passes/BinaryFunctionCallGraph.cpp
    M bolt/lib/Passes/ReorderFunctions.cpp

  Log Message:
  -----------
  [BOLT] Update buildCallGraph to check for split blocks

Use isSplit() instead of isCold() when building the call graph and
update parameter names to reflect this.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D132047


  Commit: e001a4e48968f146104cacacb12ba11d316886d2
      https://github.com/llvm/llvm-project/commit/e001a4e48968f146104cacacb12ba11d316886d2
  Author: Fabian Parzefall <parzefall at fb.com>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M bolt/include/bolt/Core/FunctionLayout.h
    M bolt/include/bolt/Passes/SplitFunctions.h
    M bolt/lib/Passes/SplitFunctions.cpp

  Log Message:
  -----------
  [BOLT] Insert EH trampolines for multiple fragments

This patch adds exception handling trampolines when a function is split
into more than two fragments. Trampolines are tracked per-fragment, such
that they can be removed if splitting is reversed.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D132048


Compare: https://github.com/llvm/llvm-project/compare/89d7db9d8128...e001a4e48968


More information about the All-commits mailing list