1. Dec 24, 2021
  2. Dec 08, 2021
  3. Sep 08, 2021
    • Amir Ayupov's avatar
      [BOLT] removeAllSuccessors: handle multiple edges between basic blocks · 6bb26fcb
      Amir Ayupov authored
      Summary:
      If `addUnknownControlFlow` in `BinaryFunction::postProcessIndirectBranches`
      is invoked with a basic block that has multiple edges to the same successor,
      it leads to an assertion in `BinaryBasicBlock::removePredecessor`.
      
      For basic blocks with multiple edges to the same successor, the default
      behavior of removePredecessor is to remove all occurrences of the
      predecessor block in its predecessor list (Multiple=true).
      
      Example:
      ```A -> B (two edges)
      
      A->removeAllSuccessors()
        for each successor of block A: // B twice
        // this removes both occurrences of A in B's predecessors list
        B->removePredecessor(A);
        // this invocation triggers an assert as A is no longer in B's
        // predecessor list
        B->removePredecessor(A);
      ```
      This issue is not fixed by NormalizeCFG as `removeAllSuccessor` is called
      earlier (from `buildCFG` -> `postProcessIndirectBranches`).
      
      Solve this issue by collecting the successors into a set (`SmallPtrSet`) first,
      before invoking `SuccessorBB->removePredecessor(this)`.
      
      GitHub issue: https://github.com/facebookincubator/BOLT/issues/187
      
      (cherry picked from FBD30796979)
      6bb26fcb
  4. Nov 16, 2021
    • Alexander Yermolovich's avatar
      [BOLT] Rewrite of .debug_info section · 1c2f4bbe
      Alexander Yermolovich authored
      Summary:
      Changed the behavior of how we handle .debug_info section.
      Instead of patching it will now rewrite it.
      With this approach we are no longer constrained to having new values
       of the same size.
      It handles re-writing by treating .debug_info as raw data.
      It copies chunks of data between patches, with new data written in
       between.
      
      (cherry picked from FBD32519952)
      1c2f4bbe
  5. Dec 30, 2021
  6. Dec 29, 2021
  7. Dec 24, 2021
    • Amir Ayupov's avatar
      [BOLT][DOCS] Build doxygen documentation · cd7a6305
      Amir Ayupov authored
      Summary:
      Added doxygen configuration files and CMake directives, copy-pasta from flang.
      
      ```cmake -G Ninja ../llvm-project/llvm \
        -DLLVM_ENABLE_PROJECTS="bolt" \
        -DBOLT_INCLUDE_DOCS=YES \
        -DLLVM_ENABLE_DOXYGEN=YES
      ninja doxygen-bolt
      ```
      
      (cherry picked from FBD33303249)
      cd7a6305
    • Maksim Panchenko's avatar
      [BOLTRewrite][NFC] Fix braces usages · ee0e9ccb
      Maksim Panchenko authored
      Summary:
      Refactor bolt/*/Rewrite to follow the braces rule for if/else/loop from
      LLVM Coding Standards.
      
      (cherry picked from FBD33305364)
      ee0e9ccb
  8. Nov 28, 2021
  9. Dec 24, 2021
  10. Dec 23, 2021
    • Rafael Auler's avatar
      Re-enable Windows build and fix issues · b392ec69
      Rafael Auler authored
      Summary:
      Fix missing string header file inclusion and link_fdata find
      problem in lit tests. Change root-level tests to require
      linux. Re-enable Windows in our root CMakeLists.txt.
      
      (cherry picked from FBD33296290)
      b392ec69
  11. Dec 21, 2021
    • Rafael Auler's avatar
      [BOLTCore] [NFC] Fix braces usages according to LLVM · 3652483c
      Rafael Auler authored
      Summary:
      Fix according to Coding Standards doc, section Don't Use
      Braces on Simple Single-Statement Bodies of if/else/loop Statements.
      This set of changes applies to lib Core only.
      
      (cherry picked from FBD33240028)
      3652483c
  12. Dec 24, 2021
  13. Dec 22, 2021
  14. Dec 23, 2021
  15. Dec 21, 2021
  16. Dec 03, 2021
  17. Dec 19, 2021
    • Maksim Panchenko's avatar
      [BOLT] Fix profile and tests for nop-removal pass · ccb99dd1
      Maksim Panchenko authored
      Summary:
      Since nops are now removed in a separate pass, the profile is consumed
      on a CFG with nops. If previously a profile was generated without nops,
      the offsets in the profile could be different if branches included nops
      either as a source or a destination.
      
      This diff adjust offsets to make the profile reading backwards
      compatible.
      
      (cherry picked from FBD33231254)
      ccb99dd1
    • Vladislav Khmelevsky's avatar
      [BOLT] Move disassemble optimizations to optimization passes · 08f56926
      Vladislav Khmelevsky authored
      Summary:
      The patch moves the shortenInstructions and nop remove to separate binary
      passes. As a result when llvm-bolt optimizations stage will begin the
      instructions of the binary functions will be absolutely the same as it
      was in the binary. This is needed for the golang support by llvm-bolt.
      Some of the tests must be changed, since bb alignment nops might create
      unreachable BBs in original functions.
      
      Vladislav Khmelevsky,
      Advanced Software Technology Lab, Huawei
      
      (cherry picked from FBD32896517)
      08f56926
  18. Dec 16, 2021
  19. Dec 08, 2021
    • Elvina Yakubova's avatar
      [PR] Fix update-debug-sections for AArch64 · 4a4045f7
      Elvina Yakubova authored
      Summary:
      This patch adds AArch64 relocations handling in case updating of
      debug sections is enabled
      
      Elvina Yakubova,
      Advanced Software Technology Lab, Huawei
      
      (cherry picked from FBD33077609)
      4a4045f7
  20. Dec 16, 2021
  21. Dec 15, 2021
  22. Dec 16, 2021
    • Rafael Auler's avatar
      Add bolt target to cmake · 5fc8adb5
      Rafael Auler authored
      Summary:
      Create a new high-level target named bolt that builds all
      BOLT artifacts, as well as a install-bolt target that installs them.
      
      (cherry picked from FBD33133002)
      5fc8adb5
  23. Dec 02, 2021
    • Amir Ayupov's avatar
      [BOLT] Split functions: support fragments with multiple parents · 6aa735ce
      Amir Ayupov authored
      Summary:
      Gracefully handle binaries with split functions where two fragments are folded
      into one, resulting in a fragment with two parent functions.
      
      This behavior is expected in GCC8+ with -O2 optimization level, where both
      function splitting and ICF are enabled by default.
      
      On the BOLT side, the changes are:
      - BinaryFunction: allow multiple parent fragments:
        - `ParentFragment` --> `ParentFragments`,
        - `setParentFragment` --> `addParentFragment`.
      - BinaryContext:
        - `populateJumpTables`: mark fragments to be skipped later,
        - `registerFragment`: add a name heuristic check, return false if it failed,
        - `processInterproceduralReferences`: check if `registerFragment`
      succeeded, otherwise issue a warning,
        - `skipMarkedFragments`: move out fragment traversal and skipping from
        `populateJumpTables` into a separate function.
      
      This change fixes an issue where unrelated functions might be registered
      as fragments:
      
      ```
      BOLT-WARNING: interprocedural reference between unrelated fragments:
      bad_gs/1(*2) and amd_decode_mce.cold.27/1(*2)
      ```
      
      (Linux kernel binary)
      
      (cherry picked from FBD32786688)
      6aa735ce
  24. Dec 10, 2021
    • Maksim Panchenko's avatar
      [BOLT] Refactor BinaryBasicBlock to use ADT · 69706eaf
      Maksim Panchenko authored
      Summary:
      Refactor members of BinaryBasicBlock. Replace some std containers with
      ADT equivalents. The size of BinaryBasicBlock on x86-64 Linux is reduced
      from 232 bytes to 192 bytes.
      
      (cherry picked from FBD33081850)
      69706eaf
  25. Dec 11, 2021
    • Rafael Auler's avatar
      Disable Windows build · bb201ca3
      Rafael Auler authored
      Summary:
      Build is already broken because VS fails to locate
      llvm-boltdiff when running tests, and VS also complains that
      include/bolt/Passes/InstrumentationSummary.h is lacking an include
      string header. Disable this until we have a Windows buildbot to make
      sure this build is sane.
      
      (cherry picked from FBD33039972)
      bb201ca3
  26. Dec 09, 2021
  27. Dec 10, 2021
  28. Dec 09, 2021
  29. Dec 07, 2021
    • Rafael Auler's avatar
      Add code owners file · a2a8fb10
      Rafael Auler authored
      Summary: Make explicit the contact of component owners.
      
      (cherry picked from FBD32904304)
      a2a8fb10
    • Maksim Panchenko's avatar
      [BOLT][DWARF] Force allocation of debug_line in RuntimeDyld · b73c87bc
      Maksim Panchenko authored
      Summary:
      Currently, RuntimeDyld will not allocate a section without relocations
      even if such a section is marked allocatable and defines symbols.
      
      When we emit .debug_line for compile units with unchanged code, we
      output original (input) data, without relocations. If all units are
      emitted in this way, we will have no relocations in the emitted
      .debug_line. RuntimeDyld will not allocate the section and as a result
      we will write an empty .debug_line section.
      
      To workaround the issue, always emit a relocation of RELOC_NONE type
      when emitting raw contents to debug_line.
      
      (cherry picked from FBD32909869)
      b73c87bc
  30. Dec 02, 2021
    • Maksim Panchenko's avatar
      [BOLT] Add pass to normalize CFG · cbf530bf
      Maksim Panchenko authored
      Summary:
      Some optimizations may remove all instructions in a basic block.
      
      The pass will cleanup the CFG afterwards by removing empty basic
      blocks and merging duplicate CFG edges.
      
      The normalized CFG is printed under '-print-normalized' option.
      
      (cherry picked from FBD32774360)
      cbf530bf