[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymoreFirst of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOSbuilds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as`CMAKE_INSTALL_BI
[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymoreFirst of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOSbuilds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as`CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then whendownstream projects try to install there too this breaks because ourbuilds always install to fresh directories for isolation's sake.Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against theother specially crafted `LLVM_CONFIG_*` variables substituted in`llvm/cmake/modules/LLVMConfig.cmake.in`.@beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix adangling reference in `AddLLVM`, but I am suspicious of how thisvariable doesn't follow the pattern.Those other ones are carefully made to be build-time vs install-timevariables depending on which `LLVMConfig.cmake` is being generated, arecarefully made relative as appropriate, etc. etc. For my NixOS use-casethey are also fine because they are never used as downstream installvariables, only for reading not writing.To avoid the problems I face, and restore symmetry, I deleted theexported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s.`AddLLVM` now instead expects each project to define its own, and theydo so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports`LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined inthe usual way, matching the other remaining exported variables.For the `AddLLVM` changes, I tried to copy the existing pattern ofinternal vs non-internal or for LLVM vs for downstream function/macronames, but it would good to confirm I did that correctly.Reviewed By: nikicDifferential Revision: https://reviews.llvm.org/D117977
show more ...
[BOLT][NFC] Use range-based STL wrappersReplace `std::` algorithms taking begin/end iterators with `llvm::` counterpartsaccepting ranges.Reviewed By: rafaulerDifferential Revision: https://rev
[BOLT][NFC] Use range-based STL wrappersReplace `std::` algorithms taking begin/end iterators with `llvm::` counterpartsaccepting ranges.Reviewed By: rafaulerDifferential Revision: https://reviews.llvm.org/D128154
Revert "[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore"This reverts commit d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229.
[BOLT] Add `-o` option to merge-fdataDifferential Revision: https://reviews.llvm.org/D126788
[BOLT] Allow merge-fdata to take a directory as inputand recursively merge all files under said directory. This is similarto `llvm-profdata merge`.Differential Revision: https://reviews.llvm.org
[BOLT] Allow merge-fdata to take a directory as inputand recursively merge all files under said directory. This is similarto `llvm-profdata merge`.Differential Revision: https://reviews.llvm.org/D126695
[BOLT][NFC] Don't over-specify the size of SmallVectorThis is the recommended way, should make merging profiles ever soslightly faster.
[BOLT] Fix merge-fdata handling of BAT profilesWhen a profile is collected in a BOLTed binary, the generatedprofile is tagged with a header string "boltedcollection" in the firstline of the fdata
[BOLT] Fix merge-fdata handling of BAT profilesWhen a profile is collected in a BOLTed binary, the generatedprofile is tagged with a header string "boltedcollection" in the firstline of the fdata file. Fix merge-fdata to recognize this headerstring and preserve it into the output.Reviewed By: AmirDifferential Revision: https://reviews.llvm.org/D125591
[BOLT][CMAKE] Fix DYLIB buildMove BOLT libraries out of `LLVM_LINK_COMPONENTS` to `target_link_libraries`.Addresses issue #55432.Reviewed By: rafaulerDifferential Revision: https://reviews.llv
[BOLT][CMAKE] Fix DYLIB buildMove BOLT libraries out of `LLVM_LINK_COMPONENTS` to `target_link_libraries`.Addresses issue #55432.Reviewed By: rafaulerDifferential Revision: https://reviews.llvm.org/D125568
[BOLT][CMAKE] Fix llvm-bolt-fuzzer buildAdd X86/AArch64 targets to resolve missing dependencies, e.g.:`undefined reference to `LLVMInitializeX86AsmParser'`Follow-up to D124206Reviewed By: rafa
[BOLT][CMAKE] Fix llvm-bolt-fuzzer buildAdd X86/AArch64 targets to resolve missing dependencies, e.g.:`undefined reference to `LLVMInitializeX86AsmParser'`Follow-up to D124206Reviewed By: rafaulerDifferential Revision: https://reviews.llvm.org/D124886
[BOLT] Compact legacy profilesMerging multiple legacy profiles (produced by instrumentation BOLT) caneasily reach GiBs. Let merge-fdata compact the profiles during merge tosignificantly reduce sp
[BOLT] Compact legacy profilesMerging multiple legacy profiles (produced by instrumentation BOLT) caneasily reach GiBs. Let merge-fdata compact the profiles during merge tosignificantly reduce space usage.Differential Revision: https://reviews.llvm.org/D123513
[BOLT][CMAKE] Remove CMake 3.13.4 incompatible parameterRemove `TYPE BIN` parameter that is introduced in CMake 3.14 and revert back tothe equivalent compatible form `DESTINATION ${CMAKE_INSTALL_B
[BOLT][CMAKE] Remove CMake 3.13.4 incompatible parameterRemove `TYPE BIN` parameter that is introduced in CMake 3.14 and revert back tothe equivalent compatible form `DESTINATION ${CMAKE_INSTALL_BINDIR}`.Addresses https://github.com/llvm/llvm-project/issues/54099Reviewed By: rafaulerDifferential Revision: https://reviews.llvm.org/D121012
[BOLT][NFC] Report errors from RewriteInstance `discoverStorage` and `run`Further improve error handling in BOLT by reporting `RewriteInstance` errors ina library and fuzzer-friendly way instead o
[BOLT][NFC] Report errors from RewriteInstance `discoverStorage` and `run`Further improve error handling in BOLT by reporting `RewriteInstance` errors ina library and fuzzer-friendly way instead of exiting.Follow-up to D119658Reviewed By: rafaulerDifferential Revision: https://reviews.llvm.org/D120224
[BOLT] Added fuzzer target (llvm-bolt-fuzzer)This adds a target that would consume random binary as aninput ELF file.TBD: add structured input support (ELF).Build:```cmake /path/to/llvm-proje
[BOLT] Added fuzzer target (llvm-bolt-fuzzer)This adds a target that would consume random binary as aninput ELF file.TBD: add structured input support (ELF).Build:```cmake /path/to/llvm-project/llvm -GNinja \-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \-DCMAKE_BUILD_TYPE=Release \-DLLVM_ENABLE_ASSERTIONS=1 \-DCMAKE_C_COMPILER=<sanitizer-capable clang> \-DCMAKE_CXX_COMPILER=<sanitizer-capable clang++> \-DLLVM_ENABLE_PROJECTS="bolt" \-DLLVM_USE_SANITIZER=Address \-DLLVM_USE_SANITIZE_COVERAGE=Onninja llvm-bolt-fuzzer```Test Plan: ninja llvm-bolt-fuzzerReviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D120016
[BOLT][NFC] Report errors from createBinaryContext and RewriteInstance ctorRefactor createBinaryContext and RewriteInstance/MachORewriteInstanceconstructors to report an error in a library and fuz
[BOLT][NFC] Report errors from createBinaryContext and RewriteInstance ctorRefactor createBinaryContext and RewriteInstance/MachORewriteInstanceconstructors to report an error in a library and fuzzer-friendly way instead ofreturning a nullptr or exiting.Reviewed By: rafaulerDifferential Revision: https://reviews.llvm.org/D119658
Cleanup LLVMDWARFDebugInfoAs usual with that header cleanup series, some implicit dependencies now need tobe explicit:llvm/DebugInfo/DWARF/DWARFContext.h no longer includes:- "llvm/DebugInfo/DW
Cleanup LLVMDWARFDebugInfoAs usual with that header cleanup series, some implicit dependencies now need tobe explicit:llvm/DebugInfo/DWARF/DWARFContext.h no longer includes:- "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"- "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"- "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"- "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"- "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"- "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"- "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"- "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"- "llvm/DebugInfo/DWARF/DWARFSection.h"- "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"- "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"Plus llvm/Support/Errc.h not included by a bunch of llvm/DebugInfo/DWARF/DWARF*.h filesPreprocessed lines to build llvm on my setup:after: 1065629059before: 1066621848Which is a great diff!Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanupDifferential Revision: https://reviews.llvm.org/D119723
[BOLT] Refactor heatmap to be standalone toolSeparate heatmap from bolt and build it as standalone tool.Reviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D118946
[BOLT][CMAKE] Add extra BOLT_INCLUDE_TESTS condition for merge-fdata emit-relocs optionOnly enable --emit-relocs linker option for merge-fdata target if tests are enabled.Reviewed By: maksfbDif
[BOLT][CMAKE] Add extra BOLT_INCLUDE_TESTS condition for merge-fdata emit-relocs optionOnly enable --emit-relocs linker option for merge-fdata target if tests are enabled.Reviewed By: maksfbDifferential Revision: https://reviews.llvm.org/D118580
[BOLT] Prepare BOLT for unit-testingThis patch adds unit testing support for BOLT. In order to do this we will need at least do this changes on the code level:* Make createMCPlusBuilder accessible
[BOLT] Prepare BOLT for unit-testingThis patch adds unit testing support for BOLT. In order to do this we will need at least do this changes on the code level:* Make createMCPlusBuilder accessible externally* Remove positional InputFilename argument to bolt utlity sourcesAnd prepare the cmake and lit for the new tests.Vladislav Khmelevsky,Advanced Software Technology Lab, HuaweiReviewed By: maksfb, AmirDifferential Revision: https://reviews.llvm.org/D118271
[BOLT][NFC] Fix braces usage in the rest of the codebaseSummary:Refactor remaining bolt sources to follow the braces rule for if/else/loop from[LLVM Coding Standards](https://llvm.org/docs/Coding
[BOLT][NFC] Fix braces usage in the rest of the codebaseSummary:Refactor remaining bolt sources to follow the braces rule for if/else/loop from[LLVM Coding Standards](https://llvm.org/docs/CodingStandards.html).(cherry picked from FBD33345885)
Re-enable Windows build and fix issuesSummary:Fix missing string header file inclusion and link_fdata findproblem in lit tests. Change root-level tests to requirelinux. Re-enable Windows in our
Re-enable Windows build and fix issuesSummary:Fix missing string header file inclusion and link_fdata findproblem in lit tests. Change root-level tests to requirelinux. Re-enable Windows in our root CMakeLists.txt.(cherry picked from FBD33296290)
[BOLT][NFC] Fix file-description commentsSummary: Fix comments at the start of source files.(cherry picked from FBD33274597)
[BOLT][NFC] Reformat with clang-formatSummary: Selectively apply clang-format to BOLT code base.(cherry picked from FBD33119052)
Add bolt target to cmakeSummary:Create a new high-level target named bolt that builds allBOLT artifacts, as well as a install-bolt target that installs them.(cherry picked from FBD33133002)
[BOLT][TEST] Add instrumentation test using merge-fdataSummary:BOLT meta test using merge-fdata tool.This tests BOLT instrumentation for a non-trivial binary, running instrumentedbinary, and us
[BOLT][TEST] Add instrumentation test using merge-fdataSummary:BOLT meta test using merge-fdata tool.This tests BOLT instrumentation for a non-trivial binary, running instrumentedbinary, and using the instrumentation profile for BOLT optimizations.The results are verified between original, instrumented, and optimized binaries.Additional tested features: boltdiff mode and merge-fdata for two profiles.merge-fdata tool is linked with relocs on Linux to support this test.(cherry picked from FBD32141812)
12