[all-commits] [llvm/llvm-project] ed7430: [BOLT] Fix EH trampoline backout code

maksfb via All-commits all-commits at lists.llvm.org
Wed Jun 29 14:37:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ed74304506a0c97860bad5c91b0b7ccb59ab181d
      https://github.com/llvm/llvm-project/commit/ed74304506a0c97860bad5c91b0b7ccb59ab181d
  Author: Maksim Panchenko <maks at fb.com>
  Date:   2022-06-29 (Wed, 29 Jun 2022)

  Changed paths:
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Passes/SplitFunctions.h
    M bolt/lib/Passes/SplitFunctions.cpp
    A bolt/test/runtime/X86/Inputs/pie-exceptions-failed-split.s
    A bolt/test/runtime/X86/pie-exceptions-failed-split.test

  Log Message:
  -----------
  [BOLT] Fix EH trampoline backout code

When SplitFunctions pass adds a trampoline code for exception landing
pads (limited to shared objects), it may increase the size of the hot
fragment making it larger than the whole function pre-split. When this
happens, the pass reverts the splitting action by restoring the original
block order and marking all blocks hot.

However, if createEHTrampolines() added new blocks to the CFG and
modified invoke instructions, simply restoring the original block layout
will not suffice as the new CFG has more blocks.

For proper backout of the split, modify the original layout by merging
in trampoline blocks immediately before their matching targets. As a
result, the number of blocks increases, but the number of instructions
and the function size remains the same as pre-split.

Add an assertion for the number of blocks when updating a function
layout.

Reviewed By: rafauler

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




More information about the All-commits mailing list