1. Jun 19, 2021
  2. Jun 09, 2021
  3. Jun 17, 2021
    • Rafael Auler's avatar
      Rebase: [BOLT][DebugFission] Fix reading support for DWP · e485a983
      Rafael Auler authored
      Summary:
      Dived more in to DWARF APIs and llvm-symbolizer this is a more streamline way of doing it, and address base gets set properly.
      Writing out dwo files with dwp input will be separate patch.
      
      (cherry picked from FBD31361529)
      e485a983
  4. Jun 02, 2021
  5. Jun 05, 2021
    • Vladislav Khmelevsky's avatar
      [PR] Instrumentation: Disable signals on mutex lock · 2cf9008a
      Vladislav Khmelevsky authored
      Summary:
      When indirect call is instrmented it locks SimpleHashTable's mutex on get() call.
      If while locked we we receive a signal and signal handler also will call
      indirect function we will end up with deadlock.
      
      PR facebookincubator/BOLT#167
      
      Vladislav Khmelevsky,
      Advanced Software Technology Lab, Huawei
      
      (cherry picked from FBD28909921)
      2cf9008a
  6. Jun 14, 2021
  7. Jun 03, 2021
    • Amir Ayupov's avatar
      [BOLT][NFC] Suppress addList override warning · f7f0a571
      Amir Ayupov authored
      Summary:
      Suppresses the warning
      ```
      src/DebugData.h:338:20: warning: 'addList' overrides a member function but is not marked 'override' [-Wsuggest-override]
      ```
      
      (cherry picked from FBD28858201)
      f7f0a571
  8. Jun 12, 2021
  9. Jun 10, 2021
  10. Jun 03, 2021
  11. Jun 05, 2021
  12. Jun 03, 2021
  13. May 27, 2021
    • Maksim Panchenko's avatar
      [BOLT][NFC] Disable ProcessAllSections in RuntimeDyld · a2637038
      Maksim Panchenko authored
      Summary:
      FBD55943 changed the way ProcessAllSections works in RuntimeDyld. After
      the change, all sections, including symbol table, section table, etc.
      are loaded into memory whenever ProcessAllSections is enabled.
      
      In BOLT we rely on RuntimeDyld for processing sections with relocations.
      These include most allocatable sections and additionally .debug_line.
      The latter is skipped by RuntimeDyld without ProcessAllSections flag.
      If we enable ProcessAllSections, we will have to deal with allocating
      memory for more sections than we need (see above) and later to filter
      them out.
      
      The alternative is to mark all sections that we actually plan to use as
      "required for execution" (using RuntimeDyld terminology). For
      .debug_line section on ELF it means adding SHF_ALLOC flag. On MachO,
      RuntimeDyld currently treats all sections as required.
      
      (cherry picked from FBD28729398)
      a2637038
  14. May 14, 2021
  15. May 12, 2021
    • Vladislav Khmelevsky's avatar
      [PR] Introduce loop inversion pass · 79807d99
      Vladislav Khmelevsky authored
      Summary:
      This patch introduces LoopInversionPass. Its main purpose is to ensure
      that the loop layout is optimal depending on the profile information. So
      if profile information shows that the loop is used, the unconditional
      jump instruction must be executed only once and vice-versa. Please take
      a look to the pass header file and test for more details.
      
      Also change link_fdata script a bit, to be able to change FDATA prefix,
      like FileCheck does.
      
      Vladislav Khmelevsky,
      Advanced Software Technology Lab, Huawei
      
      PR facebookincubator/BOLT#153
      
      (cherry picked from FBD28391811)
      79807d99
  16. Apr 02, 2021
    • Amir Ayupov's avatar
      Rebase: [BOLT] DebugFission Support · 12e9fec6
      Amir Ayupov authored
      Summary:
      Implemented support for Debug Fission.
      For the most part it doesn't impact Monolithic execution path.
      One area that was changed is the DW_AT_low_pc/DW_AT_high_pc conversion. Before it was to DW_AT_ranges/DW_AT_low_pc, now DW_AT_low_pc is kept in same place.
      Another more visible impact is in Skeleton CU the DW_AT_low_pc is replaced with DW_AT_ranges_base if it's not originally present and bolt converted ranges conversion inside the dwo units.
      
      Output of this are multiple .dwo files with updated debug information.
      
      (cherry picked from FBD29569788)
      12e9fec6
  17. May 14, 2021
  18. May 13, 2021
    • Maksim Panchenko's avatar
      [BOLT] Preserve original jump table relocations · ba6fdb81
      Maksim Panchenko authored
      Summary:
      Remove relocations against internal function labels, e.g. jump table
      relocations, only when overwriting them.
      
      While reading an input file with relocations, we create internal
      relocations against code references (we skip PIC relocations).
      Later, when we discover jump tables, we remove corresponding relocations
      with the assumption that original relocations will either be ignored or
      replaced by new relocations. However, it is possible to miss some
      references to the jump table, in which case the original entries will
      not be ignored. While such situation is abnormal, it is still a
      better/safer approach to preserve relocations if we are not replacing
      them with new ones.
      
      (cherry picked from FBD28406628)
      ba6fdb81
    • Maksim Panchenko's avatar
      [BOLT][NFC] Change interface for searching relocations · 81c59d9a
      Maksim Panchenko authored
      (cherry picked from FBD28406629)
      81c59d9a
  19. May 11, 2021
    • Amir Ayupov's avatar
      [BOLT][NFC] Address warning about ProgramPoint implicit copy constructor · 500edf26
      Amir Ayupov authored
      Summary:
      Explicit assignment operator can be replaced with an implicit one.
      Remove it to allow an implicit copy constructor:
      ```
      bolt/src/Passes/DataflowAnalysis.h:74:8: warning: definition of
      implicit copy constructor for 'ProgramPoint' is deprecated because it
      has a user-declared copy assignment operator [-Wdeprecated-copy]
        void operator=(const ProgramPoint &PP) {
             ^
      bolt/src/Passes/DataflowAnalysis.h:62:14: note: in implicit copy
      constructor for 'llvm::bolt::ProgramPoint' first required here
            return ProgramPoint(&*Last);
      ```
      
      (cherry picked from FBD28335138)
      500edf26
  20. May 14, 2021
  21. May 11, 2021
    • Vladislav Khmelevsky's avatar
      [PR] Add missing includes · b728bfc7
      Vladislav Khmelevsky authored
      Summary:
      Adds missing headers removed by IWYU.
      NB: this caused build breakage on ubuntu-latest
      
      Vladislav Khmelevsky,
      Advanced Software Technology Lab, Huawei
      
      (cherry picked from FBD28368185)
      b728bfc7
    • Vladislav Khmelevsky's avatar
      [PR] Fix tests build with -no-pie option · de298c08
      Vladislav Khmelevsky authored
      Summary:
      Since gcc/ld could produce and expect PIE files we need to pass -no-pie option to avoid linking errors for tests.
      Vladislav Khmelevsky,
      Advanced Software Technology Lab, Huawei
      
      (cherry picked from FBD28360045)
      de298c08
  22. Apr 23, 2021
    • Alexey Moksyakov's avatar
      [PR] Fix bb reordering optimization · ce84e960
      Alexey Moksyakov authored
      Summary:
      Reorder-blocks optimization pass doesn't take into account that
      available offset for legacy Jcc instructions (for example,
      JRCXZ - operand 8 bits) has to be less than 255 bytes.
      It's rare case and to exclude such functions with unsupported
      instructions from optimization passes added extra checking
      
      Alexey Moksyakov
      Advanced Software Technology Lab, Huawei
      
      (cherry picked from FBD28264117)
      ce84e960
  23. May 08, 2021
  24. May 05, 2021
  25. May 01, 2021
    • Amir Ayupov's avatar
      Rebase: [BOLT][NFC] Remove unneeded includes with include-what-you-use · eb99a666
      Amir Ayupov authored
      Summary:
      Ran iwyu multiple times, manually picked header remove lines.
      Reached fixed point wrt removal: iwyu doesn't automatically remove
      any more headers or forward declarations.
      
      (cherry picked from FBD29569221)
      eb99a666
    • Maksim Panchenko's avatar
      [perf2bolt] Further relax segment matching · 52391820
      Maksim Panchenko authored
      Summary:
      Previously, we used p_align value of the code segment to predict the
      mapping of the segment at runtime. However, at times the reported
      value is not aligned and at other times the actual aligned value will
      be different because of the different page size used.
      All we know is that the page size used at runtime should not exceed
      p_align value. Adjust our segment address matching accordingly.
      
      (cherry picked from FBD28133066)
      52391820
  26. Apr 22, 2021
  27. Apr 18, 2021
    • Amir Ayupov's avatar
      [BOLT][NFC] Use const reference for MCInstrDesc · f84f451a
      Amir Ayupov authored
      Summary:
      Addressing comments from the review for "Expand auto types".
      Use const reference in MCPlusBuilder for MCInstrDesc where the copy
      is not necessary.
      
      (cherry picked from FBD27844344)
      f84f451a
  28. Apr 08, 2021
  29. Apr 07, 2021
    • Rafael Auler's avatar
      [BOLT] Remove cantFail in getAddressRanges calls · 35732d95
      Rafael Auler authored
      Summary:
      We may have a CU with empty ranges, so accept errors coming
      from DWARFDie::getAddressRanges(). This happens when using tools that
      selectively strip debuginfo from the binary.
      
      (cherry picked from FBD27602731)
      35732d95
  30. Mar 19, 2021
  31. Mar 30, 2021
    • Amir Ayupov's avatar
      Rebase: [cherry-pick] [BOLT] Add option to skip writing an output file · 081e39aa
      Amir Ayupov authored
      Summary:
      The user may wish to run BOLT for printing statistics only
      (i.e. to check that the profile is valid). Add an option to run BOLT
      without writing any output file, similar to a dry run. This option
      is triggered by supplying -o with "/dev/null".
      
      (cherry picked from FBD29568632)
      081e39aa
  32. Mar 24, 2021
    • Maksim Panchenko's avatar
      [BOLT] Do not assert on jump table heuristic failure · e7169be9
      Maksim Panchenko authored
      Summary:
      During the initial indirect jump analysis, we used to assert that the
      discovered jump table type matched the pattern of the corresponding
      instruction sequence. E.g., for PIC jump table memory we expected the
      PIC jump table instruction sequence. The assertions were too
      conservative, as in the case of a mismatch we can mark the indirect jump
      as having an unknown control flow. That should be sufficient to either
      skip the function processing or rely on relocation information for
      possible recovery of the control flow.
      
      (cherry picked from FBD27255816)
      e7169be9
  33. Mar 16, 2021
    • Rafael Auler's avatar
      [BOLT] Fix instrumentation bug in duplicated JTs · b3c34d56
      Rafael Auler authored
      Summary:
      Fix a bug with instrumentation when trying to instrument
      functions that share a jump table with multiple indirect
      jumps. Usually, each indirect jump that uses a JT will have its own
      copy of it. When this does not happen, we need to duplicate the jump
      table safely, so we can split the edges correctly (each copy of the
      jump table may have different split edges). For this to happen, we
      need to correctly match the sequence of instructions that perform the
      indirect jump to identify the base address of the jump table and patch
      it to point to the new cloned JT. It was reported to us a case in
      which the compiler generated suboptimal code to do an indirect jump
      which our matcher failed to identify.
      
      Fixes facebookincubator/BOLT#126
      
      (cherry picked from FBD27065579)
      b3c34d56