summaryrefslogtreecommitdiff
path: root/bolt
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Mark de Wever2023-03-181-1/+1
| | | | | | This reverts commit a72165e5df59032cdd54dcb18155f2630d73abd1. Some buildbots have not been updated yet.
* Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever2023-03-181-1/+1
| | | | | | This reverts commit 92523a35a827539db8557bbc3ecab7f9ea3f6ade. Test whether all CI runners are updated.
* [BOLT] Add .relr.dyn section supportVladislav Khmelevsky2023-03-176-5/+240
| | | | | | | Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei Differential Revision: https://reviews.llvm.org/D146085
* Use *{Map,Set}::contains (NFC)Kazu Hirata2023-03-154-8/+6
|
* [BOLT][NFC] Simplify preprocessProfileAmir Ayupov2023-03-152-68/+58
| | | | | | | | Move out prepareToParse lambda, generalize it to handle mem events perf process. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D146002
* Use *{Map,Set}::contains (NFC)Kazu Hirata2023-03-151-1/+1
| | | | Differential Revision: https://reviews.llvm.org/D146104
* [BOLT][NFC] Move addRelocation{X86,AArch64} into MCPlusBuilderAmir Ayupov2023-03-145-86/+102
| | | | | | | | | The two methods don't belong in BinaryFunction methods. Move the dispatch tables into target-specific MCPlusBuilder methods. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D131813
* [BOLT][NFC] Simplify MCPlusBuilder::getRegSizeAmir Ayupov2023-03-142-17/+13
| | | | | | | | | Pre-calculate the register size table in MCPlusBuilder constructor, similar to `AliasMap`/`SmallerAliasMap` in `initAliases`. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D145828
* [BOLT][NFC] Provide default impl for MIB methods that are only overridden on X86Amir Ayupov2023-03-142-34/+6
| | | | | | | | Simplifies D145687 Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D145972
* [BOLT][NFC] Use llvm::is_containedAmir Ayupov2023-03-143-6/+6
| | | | | | | | Apply the replacement throughout BOLT. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D145464
* [BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptrAmir Ayupov2023-03-143-20/+3
| | | | | | Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D144924
* [BOLT] Add writable segment for allocatable sectionsVladislav Khmelevsky2023-03-155-6/+133
| | | | | | | | | | | | | The golang support creates 2 new data segments, one of them contains relocations in PIC binaries, so the section must have writable rights. Currently BOLT creates only one new segment that contains new sections with RX rights, now also create RW segment if there are any new writable sections were allocated during BOLT binary processing. Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei Differential Revision: https://reviews.llvm.org/D143390
* [BOLT][NFC] Return instruction list from createInstrIncMemoryAmir Ayupov2023-03-133-15/+14
| | | | | | | | | | Leverage move semantics for `std::vector`. This also makes it consistent with `createInstrumentationSnippet`. Reviewed By: Elvina Differential Revision: https://reviews.llvm.org/D145465
* [BOLT][NFC] Improve performance of MCPlusBuilder::initAliasesJob Noorman2023-03-131-8/+0
| | | | | | | | | | | | | | It was using a redundant iteration over super regs to build SmallerAliasMap. Removing this results in exactly the same alias maps and a noticeable performance gain on targets with a large number of registers. Just anecdotally: on my machine, processing a small AArch64 binary went from 2.7s down to 80ms. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D145779
* [BOLT] Pass instrumentation-file arg for X86 xmm testVladislav Khmelevsky2023-03-131-1/+2
| | | | Differential Revision: https://reviews.llvm.org/D144865
* [BOLT] Improve dynamic relocations support for CIVladislav Khmelevsky2023-03-136-28/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes few problems with supporting dynamic relocations in CI. 1. After dynamic relocations and functions were read search for dynamic relocations located in functions. Currently we expected them only to be relative and only to be in constant island. Mark islands of such functions to have dynamic relocations and create CI access symbol on the relocation offset, so the BD would be created for such place. 2. During function disassemble and handling address reference for constant island check if the referred external CI has dynamic relocation. And if it has one we would continue to refer original CI rather then creating a local copy. 3. After function disassembly stage mark function that has dynamic reloc in CI as non-simple. We don't want such functions to be optimized, since such passes as split function would create 2 copies of CI which we unable to support currently. 4. During updating output values for BF search for BD located in CI and update their output locations. 5. On dynamic relocation patching stage search for binary data located on relocation offset. If it was moved use new relocation offset value rather then an old one. Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei Differential Revision: https://reviews.llvm.org/D143748
* Revert "[CMake] Bumps minimum version to 3.20.0."Mark de Wever2023-03-041-1/+1
| | | | | | | Some build bots have not been updated to the new minimal CMake version. Reverting for now and ping the buildbot owners. This reverts commit 44c6b905f8527635e49bb3ea97dea315f92d38ec.
* [CMake] Bumps minimum version to 3.20.0.Mark de Wever2023-03-041-1/+1
| | | | | | | | | | | | | | This partly undoes D137724. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Note this does not remove work-arounds for older CMake versions, that will be done in followup patches. Reviewed By: mehdi_amini, MaskRay, ChuanqiXu, to268, thieta, tschuett, phosek, #libunwind, #libc_vendors, #libc, #libc_abi, sivachandra, philnik, zibi Differential Revision: https://reviews.llvm.org/D144509
* [BOLT][Instrumentation] Preserve red zone for functions with tail calls onlyAmir Ayupov2023-03-032-6/+58
| | | | | | | | | | Allow a function with tail calls only to clobber its red zone. Fixes https://github.com/llvm/llvm-project/issues/61114. Reviewed By: #bolt, yota9 Differential Revision: https://reviews.llvm.org/D145202
* [BOLT] Remove dependency on StringMap iteration orderMaksim Panchenko2023-03-035-67/+78
| | | | | | | | | | Remove the usage of StringMap in places where the iteration order affects the output since the iteration over StringMap is non-deterministic. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D145194
* [BOLT][NFC] Simplify BinaryFunction::setTrapOnEntryAmir Ayupov2023-02-272-9/+3
| | | | | | Reviewed By: #bolt, maksfb Differential Revision: https://reviews.llvm.org/D144758
* [BOLT][NFC] Log reversing splitting decisionAmir Ayupov2023-02-271-4/+6
| | | | | | | | Expose log for testing purposes. Reviewed By: #bolt, maksfb Differential Revision: https://reviews.llvm.org/D144674
* [BOLT] Prevent unsetting unknown control flow for split jump tableAmir Ayupov2023-02-272-1/+71
| | | | | | | | | | | | | | In case of a function with unknown control flow but with a single jump table and a single jump table site, we attempt to match the jump table and a site and update block successors using jump table targets. Restrict this behavior for split jump tables which have targets in a fragment function. Fixes https://github.com/llvm/llvm-project/issues/60795. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D144602
* [BOLT][NFC] Const-ify analyzeJumpTableAmir Ayupov2023-02-273-15/+31
| | | | | | | | | Avoid modifying `BF`, instead set extra output parameter and modify BF in caller scope. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D144598
* [BOLT] Change call count output for ICFMaksim Panchenko2023-02-273-5/+18
| | | | | | | | | | | | | | | | | | | | | | | ICF optimization runs multiple passes and the order in which functions are folded could be dependent on the order they are being processed. This order is indeterministic as functions are intermediately stored in std::unordered_map<>. Note that this order is mostly stable, but is not guaranteed to be and can change e.g. after switching to a different C++ library implementation. Because the processing (and folding) order is indeterministic, the previous way of calculating merged function call count could produce different results. Change the way we calculate the ICF call count to make it independent of the function folding/processing order. Mostly NFC as the output binary should remain the same, the change affects only the console output. Reviewed By: yota9 Differential Revision: https://reviews.llvm.org/D144807
* [BOLT] Fix intermittent crash with instrumentationMaksim Panchenko2023-02-274-15/+32
| | | | | | | | | | | | | | | When createInstrumentedIndirectCall() was invoked for tail calls, we attached annotation instruction twice to the new call instruction. First in createDirectCall(), and then again while copying over the metadata operands. As a result, the annotations were not properly stripped for such calls before the call to freeAnnotations() in LowerAnnotations pass. That lead to use-after-free while restoring the offsets with setOffset() call. Reviewed By: yota9 Differential Revision: https://reviews.llvm.org/D144806
* [BOLT] fix tests on arm64Sebastian Pop2023-02-252-2/+2
| | | | | | | The two tests were failing on arm64-linux with: BOLT-ERROR: invalid target 'x86-64'. Differential Revision: https://reviews.llvm.org/D144593
* [BOLT][X86][NFC] Simplify the code of X86MCPlusBuilder::getAliasSizedShengchen Kan2023-02-231-102/+3
| | | | | | Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D144551
* [BOLT][NFC] Return struct from evaluateX86MemoryOperandAmir Ayupov2023-02-224-159/+101
| | | | | | | | | Simplify `MCPlusBuilder::evaluateX86MemoryOperand`: make it return a struct with memory operand analysis struct `X86MemOperand`. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D144310
* [BOLT] Fix data reoder for aarch64Vladislav Khmelevsky2023-02-223-1/+10
| | | | | | Use proper relocation for aarch64 Differential Revision: https://reviews.llvm.org/D144095
* [BOLT][AArch64] Replace NOP with adrp in AdrRelaxationPass to preserve ↵Denis Revunov2023-02-222-0/+24
| | | | | | | | | | | | | relative offsets. Avoid replacing one adr instruction with two adrp+add by utilizing linker-provided nops when they are present. By doing so we preserve relative offsets of next instructions in a function which reduces chances to break undetected jump tables. This commit makes release-mode lld-linked clang, lld and etc work after BOLT. Reviewed By: rafauler, yota9 Differential Revision: https://reviews.llvm.org/D143887
* [BOLT] Attempt to fix bolt/test/runtime/AArch64/adrrelaxationpass.s after ↵Kristina Bessonova2023-02-191-2/+2
| | | | | | D144079 Differential Revision: https://reviews.llvm.org/D144344
* [BOLT] Rename BF::isParentFragment -> isChildOfAmir Ayupov2023-02-093-20/+9
| | | | | | | | | `isChildOf` is a more concise name for the check. Also, there's no need to test if the function is a fragment before doing `isChildOf` check. Reviewed By: #bolt, rafauler, maksfb Differential Revision: https://reviews.llvm.org/D142667
* [BOLT][Wrapper] Don't compare output upon error exit codeAmir Ayupov2023-02-091-16/+20
| | | | | | | | | | | | | | | Fix llvm-bolt-wrapper to skip output file checks if llvm-bolt exits with error code. Test Plan: - checkout to revision with invalid NFC mismatch in `is-strip.s` test (e.g. 056af487831fb573e6895901d1e48f93922f9635~) - run `nfc-check-setup.py` - run `bin/llvm-lit -a tools/bolt/test/X86/is-strip.s` Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D143614
* [Test] Fix YAML mapping keys duplication. NFC.Anton Sidorenko2023-02-091-0/+1
| | | | | | | | YAML specification does not allow keys duplication an a mapping. However, YAML parser in LLVM does not have any check on that and uses only the last key entry. In this change duplicated keys are merged to satisfy the spec. Differential Revision: https://reviews.llvm.org/D141848
* [BOLT] Process fragment siblings in lite mode, keep lite mode onAmir Ayupov2023-02-089-51/+379
| | | | | | | | | | | In lite mode, include split function fragments to the list of functions to process even if a fragment has no samples. This is required to properly detect and update split jump tables (jump tables that contain pointers to code in the main and cold fragments). Reviewed By: #bolt, maksfb Differential Revision: https://reviews.llvm.org/D140457
* [BOLT] Search section based on relocation symbolyavtuk2023-02-083-2/+50
| | | | | | | | | | | We need to search referenced section based on relocations symbol section to properly match end section symbols. For example on some binaries we can observe that init_array_end/fini_array_end might be "placed" in to the gap and since no section could be found for address the relocation would be skipped resulting in wrong ADRP imm after emitting new text resulting in binary sigsegv. Credits for the test to Vladislav Khmelevskii aka yota9.
* [BOLT][TEST] Fix is-strip test for NFC testingAmir Ayupov2023-02-071-1/+1
|
* [NFC][TargetParser] Remove llvm/ADT/Triple.hArchibald Elliott2023-02-072-2/+2
| | | | | | I also ran `git clang-format` to get the headers in the right order for the new location, which has changed the order of other headers in two files.
* [BOLT] Reintroduce allow-strippedAmir Ayupov2023-02-063-8/+15
| | | | | | | | | | | | | | Reject stripped binaries as a policy. The core issue with stripped binaries is that we can't detect the presence of split functions which require extra handling. Therefore BOLT can't ensure functional correctness of produced binary if the input stripped binary contains split functions. Supporting such cases is an interesting problem but it goes against BOLT's intended goal of achieving peak program performance. Reviewed By: maksfb Differential Revision: https://reviews.llvm.org/D142686
* [BOLT][NFC] Replace anonymous namespace functions with staticAmir Ayupov2023-02-0610-110/+73
| | | | | | | | | | Follow LLVM Coding Standards guideline on using anonymous namespaces (https://llvm.org/docs/CodingStandards.html#anonymous-namespaces) and use `static` modifier for function definitions. Reviewed By: #bolt, maksfb Differential Revision: https://reviews.llvm.org/D143124
* [AArch64] fix bug #55005 handle DW_CFA_GNU_NegateRAStateSebastian Pop2023-02-043-6/+83
| | | | | | GCC on AArch64 uses DW_CFA_GNU_NegateRAState for return address signing. Differential Revision: https://reviews.llvm.org/D142572
* [BOLT][NFC] Rename {MachO,}RewriteInstance::create methodsAmir Ayupov2023-02-027-23/+15
| | | | | | | | | | Follow the code style of fallible constructors in [LLVM Programmer's Manual] (https://llvm.org/docs/ProgrammersManual.html#fallible-constructors) and rename `RewriteInstance::createRewriteInstance` to `RewriteInstance::create` Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D143119
* [BOLT][NFC] Simplify SW::checkStackPointerRestoreAmir Ayupov2023-02-021-11/+5
| | | | | | Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D143117
* [BOLT][NFC] Use llvm::make_second_rangeAmir Ayupov2023-02-025-26/+19
| | | | | | Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D143019
* [BOLT][CMake] Add dependency on llvm_vcsrevision_hAmir Ayupov2023-02-011-0/+3
| | | | | | | | | | | | The dependence is needed since Utils includes VCSRevision.h, and other LLVM components that include this header also have the llvm_vcsrevision_h dependency. Fixes #60460. Reviewed By: #bolt, ayermolo Differential Revision: https://reviews.llvm.org/D143101
* [BOLT][DWARF] Add logging for split dwarfAlexander Yermolovich2023-01-272-0/+14
| | | | | | | | Added logging when bolt is processing binary with split dwarf. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D142576
* [BOLT][NFC] Remove C-style out of bounds array refRafael Auler2023-01-251-5/+3
| | | | Old code breaks build with libstdc++ with assertions. Fix it.
* [BOLT] Use LTO fuzzy name matching in function-orderAmir Ayupov2023-01-254-4/+39
| | | | | | | | | Allow partial name matching wrt LTO suffixes in `function-order` user-supplied function list, the same as permitted by profile matching. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D142269
* [BOLT] Emit a warning about invalid entries in function-order listAmir Ayupov2023-01-251-5/+13
| | | | | | | | | Move individual warnings under verbosity >= 1, print out a warning with aggregate number. Reviewed By: #bolt, rafauler Differential Revision: https://reviews.llvm.org/D142397