aboutsummaryrefslogtreecommitdiff
path: root/llvm/cmake
AgeCommit message (Collapse)AuthorFilesLines
10 days[cmake] Unconditionally use -Wno-pass-failed with Clang (#162835)Martin Storsjö1-7/+9
Since 4feae05c6abda364a9295aecfa600d7d4e7dfeb6, most of the handling of warning options was rewritten to add such options based on hardcoded knowledge about what compilers support which options, and since which versions. This avoids a number of configure time checks, speeding up the cmake configuration. This avoids erroneously adding this option with GCC, which doesn't really support it. If testing for a warning option like -Wno-<foo> with GCC, GCC won't print any diagnostic at all, leading to the options being accepted incorrectly. However later, if compiling a file that actually prints another warning, GCC will also print warnings about these -Wno-<foo> options being unrecognized. This avoids extra warning spam like this, for every source file that does produce warnings with GCC: At global scope: cc1plus: note: unrecognized command-line option ‘-Wno-pass-failed’ may have been intended to silence earlier diagnostics
12 days[CMake] Suppress -Wpass-failed warning (#160472)Nikita Popov1-0/+7
libstdc++15 makes use of an unroll pragma inside std::find_if(). This produces a warning if clang fails to unroll the loop. As this pragma is outside of our control, suppress the warning. Missed transforms are not something we care about in this context. Related to https://github.com/llvm/llvm-project/issues/157666.
2025-10-01[Clang][CMake] Add CSSPGO support to LLVM_BUILD_INSTRUMENTED (#79942)Amir Ayupov1-1/+29
Build on Clang-BOLT infrastructure to collect sample profile for CSSPGO. Add CSSPGO.cmake and BOLT-CSSPGO.cmake to automate CSSPGO/+BOLT Clang builds. Note that `CLANG_PGO_TRAINING_DATA_SOURCE_DIR` is required as built-in training set is inadequate for collecting sampled profile. Hardware compatibility: CSSPGO requires synchronized (0-skid) call and branch stacks, which is only available with Intel PEBS (Sandy Bridge+), AMD Zen3 with BRS, Zen4 with LBRv2+LBR_PMC_FREEZE, and Zen5 with LBRv2. This patch adds support for Intel `br_inst_retired.near_taken:uppp` event. Test Plan: Added BOLT-CSSPGO.cmake with same use as BOLT-PGO.cmake, e.g. for bootstrapped ThinLTO+CSSPGO+BOLT, with CSSPGO profile collected from LLVM build, and BOLT profile collected from Hello World (instrumentation): ``` cmake -B clang-csspgo-bolt -S /path/to/llvm-project/llvm \ -DLLVM_ENABLE_LLD=ON -DBOOTSTRAP_LLVM_ENABLE_LLD=ON \ -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \ -DPGO_INSTRUMENT_LTO=Thin \ -DBOOTSTRAP_CLANG_PGO_TRAINING_DATA_SOURCE_DIR=/path/to/llvm-project/llvm \ -GNinja -C /path/to/llvm-project/clang/cmake/caches/BOLT-CSSPGO.cmake ninja stage2-clang-bolt ... warning: Sample PGO is estimated to optimize better with 19.5x more samples. Please consider increasing sampling rate or profiling for longer duration to get more samples. ... [2800/2801] Optimizing Clang with BOLT BOLT-INFO: 8189 out of 106942 functions in the binary (7.7%) have non-empty execution profile 13776393 : taken branches (-42.1%) ``` Performance testing with Clang: - Setup: Clang-BOLT testing harness https://github.com/aaupov/llvm-devmtg-2022/commit/9f2b46f67a1930a51c58a0e4894637a8c64c570e - CSSPGO training: building LLVM, - InstrPGO training: building Hello World, - BOLT training: building Hello World, instrumentation, - benchmark: building small LLVM tool (not), - 2S Intel SKX Xeon 6138 with 40C/80T and 256GB RAM, using 20C/40T for build, - Results, wall time, lower is better - Baseline (bootstrapped build): 10.36s, - InstrPGO + ThinLTO: 9.34s, - CSSPGO + ThinLTO: 8.85s. - BOLT results, for reference: - Baseline: 9.09s, - InstrPGO + ThinLTO: 9.09s, - CSSPGO + ThinLTO: 8.58s. --------- Co-authored-by: Matthias Braun <matze@braunis.de>
2025-09-20[LLVM] Remove leftover unnecessary CMake for GPU runtimesJoseph Huber1-8/+0
Summary: This somehow snuck back in.
2025-09-19[libc] Fix libc build on NVPTX using wrong linker flagJoseph Huber1-1/+9
Summary: Ugly hacks abound, we can't actually test linker flags correctly generically because not everyone has `nvlink` as a binary on their machine which would then result in every single flag being unsupported. This is the only 'linker flag' check we have, so just hard code it off.
2025-09-19[LLVM] Simplify GPU runtimes flag handling (#159802)Joseph Huber1-6/+0
Summary: The AMDGPU hack can be removed, and we no longer need to skip 90% of the `HandleLLVMOptions` if we work around NVPTX earlier. Simplifies the interface by removing duplicated logic and keeps the GPU targets from being weirdly divergent on some flags.
2025-09-17[CAS] LLVM_ENABLE_ONDISK_CAS requires `flock` on UNIX (#159207)Steven Wu1-0/+8
As a follow up to #159122, after figure out reason why CAS unit tests are failing on Solaris, update the CMake configuration to build ondisk CAS implementation. We now check the existance of `flock` before enabling the configuration. In the future, we can find ways to support OnDiskCAS on other platforms that do not have `flock`. This can techinically be done with a POSIX compilant file lock but that will put a restriction on the usage of CAS.
2025-09-17[CMake] Merge if statements for GCC warning disabling. NFC. (#159172)Martin Storsjö1-28/+18
2025-09-16[CMake] Disable more noisy GCC warnings (#159044)Martin Storsjö1-0/+16
This disables the following very noisy warning: In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/streambuf:43, from /usr/include/c++/13/bits/streambuf_iterator.h:35, from /usr/include/c++/13/iterator:66, from ../include/llvm/ADT/ADL.h:13, from ../include/llvm/ADT/DenseMap.h:17, from ../lib/Transforms/Vectorize/VPlanAnalysis.h:12, from ../lib/Transforms/Vectorize/VPlan.h:27, from ../lib/Transforms/Vectorize/LoopVectorizationPlanner.h:27, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:14: In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1071:25, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 24 is out of the bounds [0, 24] of object ‘<anonymous>’ with type ‘llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::RootsT’ {aka ‘llvm::SmallVector<llvm::VPBlockBase*, 1>’} [-Warray-bounds=] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../lib/Transforms/Vectorize/VPlanDominatorTree.h:23, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:17: ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: ‘<anonymous>’ declared here 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1094:14, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 24 is out of the bounds [0, 24] of object ‘<anonymous>’ with type ‘llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::RootsT’ {aka ‘llvm::SmallVector<llvm::VPBlockBase*, 1>’} [-Warray-bounds=] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: ‘<anonymous>’ declared here 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ In a regular build, there's currently 14 such warning instances, but since they are so large and noisy, they are very disruptive, and they don't seem to be an actual issue in the LLVM code base. With the -Warray-bounds warning disabled, the build instead ends up with 9 similar warnings of the kind -Wstringop-overread: In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/streambuf:43, from /usr/include/c++/13/bits/streambuf_iterator.h:35, from /usr/include/c++/13/iterator:66, from ../include/llvm/ADT/ADL.h:13, from ../include/llvm/ADT/DenseMap.h:17, from ../lib/Transforms/Vectorize/VPlanAnalysis.h:12, from ../lib/Transforms/Vectorize/VPlan.h:27, from ../lib/Transforms/Vectorize/LoopVectorizationPlanner.h:27, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:14: In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1071:25, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ reading between 9 and 34359738360 bytes from a region of size 8 [-Wstringop-overread] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../lib/Transforms/Vectorize/VPlanDominatorTree.h:23, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:17: ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: at offset 16 into source object ‘<anonymous>’ of size 24 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1094:14, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ reading between 9 and 34359738352 bytes from a region of size 8 [-Wstringop-overread] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: at offset 16 into source object ‘<anonymous>’ of size 24 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ Disable both of these, as they are extremely spammy and seem to alert on things that aren't an issue in LLVM.
2025-09-16Revert "[CMake] Disable more noisy GCC warnings (#159044)"Martin Storsjö1-16/+0
This reverts commit 984be7c5a7e34857577093c74dd9270227c0f887.
2025-09-16[CMake] Disable more noisy GCC warnings (#159044)Martin Storsjö1-0/+16
This disables the following very noisy warning: In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/streambuf:43, from /usr/include/c++/13/bits/streambuf_iterator.h:35, from /usr/include/c++/13/iterator:66, from ../include/llvm/ADT/ADL.h:13, from ../include/llvm/ADT/DenseMap.h:17, from ../lib/Transforms/Vectorize/VPlanAnalysis.h:12, from ../lib/Transforms/Vectorize/VPlan.h:27, from ../lib/Transforms/Vectorize/LoopVectorizationPlanner.h:27, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:14: In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1071:25, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 24 is out of the bounds [0, 24] of object ‘<anonymous>’ with type ‘llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::RootsT’ {aka ‘llvm::SmallVector<llvm::VPBlockBase*, 1>’} [-Warray-bounds=] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../lib/Transforms/Vectorize/VPlanDominatorTree.h:23, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:17: ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: ‘<anonymous>’ declared here 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1094:14, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 24 is out of the bounds [0, 24] of object ‘<anonymous>’ with type ‘llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::VPBlockBase, false> >::RootsT’ {aka ‘llvm::SmallVector<llvm::VPBlockBase*, 1>’} [-Warray-bounds=] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: ‘<anonymous>’ declared here 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ In a regular build, there's currently 14 such warning instances, but since they are so large and noisy, they are very disruptive, and they don't seem to be an actual issue in the LLVM code base. With the -Warray-bounds warning disabled, the build instead ends up with 9 similar warnings of the kind -Wstringop-overread: In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/streambuf:43, from /usr/include/c++/13/bits/streambuf_iterator.h:35, from /usr/include/c++/13/iterator:66, from ../include/llvm/ADT/ADL.h:13, from ../include/llvm/ADT/DenseMap.h:17, from ../lib/Transforms/Vectorize/VPlanAnalysis.h:12, from ../lib/Transforms/Vectorize/VPlan.h:27, from ../lib/Transforms/Vectorize/LoopVectorizationPlanner.h:27, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:14: In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1071:25, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ reading between 9 and 34359738360 bytes from a region of size 8 [-Wstringop-overread] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../lib/Transforms/Vectorize/VPlanDominatorTree.h:23, from ../lib/Transforms/Vectorize/VPlanConstruction.cpp:17: ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: at offset 16 into source object ‘<anonymous>’ of size 24 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = llvm::VPBlockBase*; _Up = llvm::VPBlockBase*; bool _IsMove = true]’, inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30, inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42, inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31, inlined from ‘_OI std::move(_II, _II, _OI) [with _II = llvm::VPBlockBase**; _OI = llvm::VPBlockBase**]’ at /usr/include/c++/13/bits/stl_algobase.h:665:38, inlined from ‘llvm::SmallVectorImpl<T>& llvm::SmallVectorImpl<T>::operator=(llvm::SmallVectorImpl<T>&&) [with T = llvm::VPBlockBase*]’ at ../include/llvm/ADT/SmallVector.h:1094:14, inlined from ‘llvm::SmallVector<T, N>& llvm::SmallVector<T, N>::operator=(llvm::SmallVector<T, N>&&) [with T = llvm::VPBlockBase*; unsigned int N = 1]’ at ../include/llvm/ADT/SmallVector.h:1259:36, inlined from ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’ at ../include/llvm/Support/GenericDomTreeConstruction.h:578:14: /usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ reading between 9 and 34359738352 bytes from a region of size 8 [-Wstringop-overread] 437 | __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/llvm/Support/GenericDomTreeConstruction.h: In static member function ‘static void llvm::DomTreeBuilder::SemiNCAInfo<DomTreeT>::CalculateFromScratch(DomTreeT&, BatchUpdatePtr) [with DomTreeT = llvm::DominatorTreeBase<llvm::VPBlockBase, false>]’: ../include/llvm/Support/GenericDomTreeConstruction.h:578:25: note: at offset 16 into source object ‘<anonymous>’ of size 24 578 | DT.Roots = FindRoots(DT, PostViewBUI); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ Disable both of these, as they are extremely spammy and seem to alert on things that aren't an issue in LLVM.
2025-09-15[cmake] Add LLVM_TARGET_TRIPLE_ENV to LLVMConfig.cmake.in (#158303)parabola941-0/+2
LLVM has a mechanism to switch the default target: LLVM_TARGET_TRIPLE_ENV. For example, regression tests with lit use this CMake variable. It matters only when building LLVM, not the other projects. Therefore, if they are built standalone, the value of the CMake variable should be propagated. In fact, however, it is not. This patch fixes it.
2025-09-15Add llvm-ml64 to LLVM_TOOLCHAIN_TOOLS (#158582)Hans Wennborg1-0/+1
So that it gets included in LLVM_INSTALL_TOOLCHAIN_ONLY builds, such as when building the Windows installer. Fixes #149664
2025-09-09[CMake] Disable -Wdangling-reference warnings on GCC (#157541)Martin Storsjö1-0/+8
This gets rid of 99 warnings which mostly seem like false positives (in a build of LLVM+Clang+LLDB, with GCC 13). The warnings look e.g. like this: ../lib/ObjCopy/COFF/COFFObjcopy.cpp: In function ‘uint64_t llvm::objcopy::coff::getNextRVA(const Object&)’: ../lib/ObjCopy/COFF/COFFObjcopy.cpp:38:18: warning: possibly dangling reference to a temporary [-Wdangling-reference] 38 | const Section &Last = Obj.getSections().back(); | ^~~~ ../lib/ObjCopy/COFF/COFFObjcopy.cpp:38:47: note: the temporary was destroyed at the end of the full expression ‘(& Obj)->llvm::objcopy::coff::Object::getSections().llvm::ArrayRef<llvm::objcopy::coff::Section>::back()’ 38 | const Section &Last = Obj.getSections().back(); | ~~~~~~~~~~~~~~~~~~~~~~^~ In this example, the `Object::getSections()` method returns an `ArrayRef<Section>` from a `std::vector<Section>`. We invoke `back()` on that, and store a reference in a local variable. Even though the temporary `ArrayRef<Section>` has been destroyed, the reference points to something which still is alive in the `std::vector<Section>`. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109642 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110358 for some preexisting discussion on this warning and how it can be silenced selectively since GCC 14.
2025-09-06[CMake] add `SKIP` to `add_lit_testsuites` (#157176)Maksim Levental1-1/+16
This PR adds `SKIP` to `add_lit_testsuites`. The purpose is to let people filter the currently exhaustive inclusion of subdirectories which might not all depend on the same `DEPENDS`. The immediate use case is MLIR where we have a collection of Python tests that currently trigger rebuilds of various tools (like `mlir-opt`) which they do not depend on. That collection of tests is updated here too.
2025-09-03Reapply [IR] Remove options to make scalable TypeSize access a warning (#156336)Nikita Popov1-4/+0
Reapplying now that buildbot has picked up the new configuration that does not use -treat-scalable-fixed-error-as-warning. ----- This removes the `LLVM_ENABLE_STRICT_FIXED_SIZE_VECTORS` cmake option and the `-treat-scalable-fixed-error-as-warning` opt flag. We stopped treating these as warnings by default a long time ago (62f09d788f9fc540db12f3cfa2f98760071fca96), so I don't think it makes sense to retain these options at this point. Accessing a scalable TypeSize as fixed should always result in an error.
2025-09-02Revert "[IR] Remove options to make scalable TypeSize access a warning ↵Nikita Popov1-0/+4
(#156336)" This reverts commit 8f59a946740bf8dbe2574b33eaa431fde3ce9204. Failed on clang-aarch64-sve-vls-2stage, which still uses the option.
2025-09-02[IR] Remove options to make scalable TypeSize access a warning (#156336)Nikita Popov1-4/+0
This removes the `LLVM_ENABLE_STRICT_FIXED_SIZE_VECTORS` cmake option and the `-treat-scalable-fixed-error-as-warning` opt flag. We stopped treating these as warnings by default a long time ago (62f09d788f9fc540db12f3cfa2f98760071fca96), so I don't think it makes sense to retain these options at this point. Accessing a scalable TypeSize as fixed should always result in an error.
2025-08-30Be smarter about the GLIBCXX_USE_CXX11_ABI default (#155781)serge-sans-paille1-1/+9
It appears that unconditionally using GLIBCXX_USE_CXX11_ABI=0 is slow on modern libstdc++, while using GLIBCXX_USE_CXX11_ABI=1 breaks old buildbots, so use the compiler default unless asked to do differently.
2025-08-29[CMake][AIX] quote the string AIX `if` conditionsDavid Tenty3-3/+3
This is a follow on to #154537, which quoted the CMAKE_SYSTEM_NAME to avoid expanding it again when that CMAKE_SYSTEM_NAME expands to AIX. But by the same logic, we also need to quote the plain string AIX as well.
2025-08-29[CMake] Remove LLVM_ENABLE_IR_PGO Option (#155958)Aiden Grossman1-4/+1
It has been deprecated for eight years now (a702fa17f31abd5efce302ef3d4cf2fbaf167368), and all users that I know of are using LLVM_BUILD_INSTRUMENTED.
2025-08-22[cmake] Add config.guess for RISC-V BE (#154903)Djordje Todorovic1-1/+1
This adds config guess support for RISC-V big-endian.
2025-08-22Default to GLIBCXX_USE_CXX11_ABI=ONserge-sans-paille1-1/+1
Because many of our bots actually don't run a listdc++ compatible with _GLIBCXX_USE_CXX11_ABI=0. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html for details. This is a follow-up to be179d069664ce03c485e49fa1f6e2ca3d6286fa related to #154447.
2025-08-22Be explicit about what libstdc++ C++11 ABI to use (#154447)Mike Hommey1-0/+18
libstdc++ can be configured to default to a different C++11 ABI, and when the system that is used to build clang has a different default than the system used to build a clang plugin, that leads to uses of different ABIs, leading to breakage (missing symbols) when using clang APIs that use types like std::string. We arbitrarily choose to default to the old ABI, but the user can opt-in to the new ABI. The important part is that whichever is picked is reflected in llvm-config's output.
2025-08-20[NFC][CMake] quote ${CMAKE_SYSTEM_NAME} consistently (#154537)David Tenty3-27/+32
A CMake change included in CMake 4.0 makes `AIX` into a variable (similar to `APPLE`, etc.) https://gitlab.kitware.com/cmake/cmake/-/commit/ff03db6657c38c8cf992877ea66174c33d0bcb0b However, `${CMAKE_SYSTEM_NAME}` unfortunately also expands exactly to `AIX` and `if` auto-expands variable names in CMake. That means you get a double expansion if you write: `if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")` which becomes: `if (AIX MATCHES "AIX")` which is as if you wrote: `if (ON MATCHES "AIX")` You can prevent this by quoting the expansion of "${CMAKE_SYSTEM_NAME}", due to policy [CMP0054](https://cmake.org/cmake/help/latest/policy/CMP0054.html#policy:CMP0054) which is on by default in 4.0+. Most of the LLVM CMake already does this, but this PR fixes the remaining cases where we do not.
2025-08-15Revert "Remember LLVM_ENABLE_LIBCXX setting in installed configuration" ↵gulfemsavrun2-14/+1
(#153898) Reverts llvm/llvm-project#139712 Caused an lld relocation issue as shown below: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8706642902273983073/+/u/clang/build/stdout
2025-08-13Remember LLVM_ENABLE_LIBCXX setting in installed configuration (#139712)Michael Kruse2-1/+14
Updated version of #134990 which was reverted because of the buildbot [openmp-offload-amdgpu-runtime-2](https://lab.llvm.org/buildbot/#/builders/10) failing. Its configuration has `LLVM_ENABLE_LIBCXX=ON` set although it does not even have libc++ installed. In addition to #134990, this PR adds a check whether C++ libraries are actually available. `#include <chrono>` was chosen because this is the library that [openmp-offload-amdgpu-runtime-2 failed with](https://github.com/llvm/llvm-project/pull/134990#issuecomment-2792138162). Original summary: The buidbot [flang-aarch64-libcxx](https://lab.llvm.org/buildbot/#/builders/89) is currently failing with an ABI issue. The suspected reason is that LLVMSupport.a is built using libc++, but the unittests are using the default C++ standard library, libstdc++ in this case. This predefined `llvm_gtest` target uses the LLVMSupport from `find_package(LLVM)`, which finds the libc++-built LLVMSupport. To fix, store the `LLVM_ENABLE_LIBCXX` setting in the LLVMConfig.cmake such that everything that links to LLVM libraries use the same standard library. In this case discussed in https://github.com/llvm/llvm-zorg/pull/387 it was the flang-rt unittests, but other runtimes with GTest unittests should have the same issue (e.g. offload), and any external project that uses `find_package(LLVM)`. This patch fixed the problem for me locally.
2025-08-08[KeyInstr] Remove LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS CMake flag (#152735)Orlando Cazalet-Hyams1-4/+0
The CMake flag has been on by default for a month without any issues. This makes the feature support in LLVM unconditional (but does not enable the feature by default).
2025-08-07Remove __SHORT_FILE__ macro definition in CMake (#152344)Mehdi Amini1-15/+0
This per-file macro definition on the command line breaks caching of modules. See discussion in #150677 Instead we use a constexpr function that processes the __FILE__ macro, but prefer also the __FILE_NAME__ macro when available (clang/gcc) to spare compile-time in the frontend. If the constexpr function isn't const-evaluated, it'll be only evaluated when printing the debug message.
2025-08-05Revert "Revert "Strip the full path from __FILE__ in the LDBG macro and keep ↵Jon Roelofs1-0/+15
only the filename (#150677)"" This reverts commit a15b629527a975ec592c95d69d04ef3537915d1d. The revert made things worse. Oops.
2025-08-05Revert "Strip the full path from __FILE__ in the LDBG macro and keep only ↵Jon Roelofs1-15/+0
the filename (#150677)" This reverts commit 5d26e3c227f4b4a1761a8b0001b3165198def479. It breaks the modules build of clang, since every source file has a different version of this macro, which causes https://green.lab.llvm.org/job/clang-stage2-Rthinlto/ to run out of space. We should probably be using __FILE_NAME__ instead when the host compiler supports it, but until then let's revert-to-green, and un-block the bots. see: https://github.com/llvm/llvm-project/pull/150677 see: https://github.com/llvm/llvm-project/pull/150677#issuecomment-3156779021 rdar://157465825
2025-07-30[cmake] Don't generate per-file "__SHORT_FILE__" defines on visual studio ↵Simon Pilgrim1-10/+13
builds (#151167) As reported on #150677 - this is preventing msbuild parallelization as cmake is repeatedly being updated
2025-07-30Fix llvm_process_sources to append source file properties instead of ↵Mehdi Amini1-1/+4
overriding it (#151251) This fixes the CLANG_VENDOR macro that disappeared because it is set using the same mechanism and one was overriding the other.
2025-07-26Strip the full path from __FILE__ in the LDBG macro and keep only the ↵Mehdi Amini1-0/+9
filename (#150677)
2025-07-13Turn off uninitialized warnings for GCC up to 14. (#147968)Harald van Dijk1-1/+1
Although the false positives that caused it to be disabled originally may have been fixed in GCC 12, GCC also suffers from a problem where -Wuninitialized may cause the build to hang on some platforms (GCC #120729). This has been fixed in GCC 15, so turn on -Wuninitialized for GCC 15+ instead of GCC 12+.
2025-07-11[mlir][cmake] Fix missing entries in `tablegen_compile_commands.yml` (#147516)Markus Böck1-4/+8
Depending on the order of CMake includes the `tablegen_compile_commands.yml` was previously missing entries due to being deleted after a `tablegen` commands. This PR fixes this by 1) making sure `AddMLIR` includes `TableGen` such that new compile commands are added to a fresh YML file and 2) using an include guard to ensure the file is cleared exactly once
2025-07-01[LLVM][Cygwin] Enable dynamic linking of libLLVM (#146440)Mateusz Mikuła2-4/+4
These changes allow to link everything to shared LLVM library with MSYS2 "Cygwin" toolchain.
2025-06-20[TargetParser][cmake] Be Smarter about TableGen Deps (#144848)Sam Elliott1-34/+25
This tries to be a bit smarter for the OLD behaviour of CMP0116, to glob more relevant directories looking for possible dependencies. The changes are: - Remove some duplication of lines in the `tablegen` function. - Put CURRENT_SOURCE_DIR into `tblgen_includes` (at the front) - Glob all directories in `tblgen_includes` - Give up on `local_tds` which was wrong when using tablegen to compile a file in a different directory (as TargetParser does) - Use `EXTRA_INCLUDES` in TargetParser `tablegen` calls. This is still an under-approximation of what might be included, at least comparing the RISCVTargetParserDef.inc.d (after building `target_parser_gen`), and the list of deps in the ninja file when explicitly setting CMP0116 to OLD. Fixes #144639
2025-06-20Fix references to required libraries when building LLVM with ASAN and ↵Douglas1-5/+6
MultiThreaded[Debug] on Windows (#139657) After https://github.com/llvm/llvm-project/pull/81677, statically linking ASAN under Windows is no longer supported. Therefore, when using Clang built past https://github.com/llvm/llvm-project/commit/53a81d4d26f0409de8a0655d7af90f2bea222a12 to build LLVM / Clang with `-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded[Debug] -DLLVM_USE_SANITIZER=Address`, a different set of dependent libraries must be linked. This is mentioned in the description of https://github.com/llvm/llvm-project/pull/81677 and also in https://devblogs.microsoft.com/cppblog/msvc-address-sanitizer-one-dll-for-all-runtime-configurations/.
2025-06-17[CMake] Add BINARY_DIR argument for add_lit_testsuites (#144431)Chris B1-4/+9
We're doing some slightly odd things with LIT in the offload-test-suite. Specifically we generate multiple binary directories to configure and run tests with different configurations from the same source root. In this configuration the subdirectory targets need to instead point to the correct generated binary directory and use test filtering to get a subset of tests.
2025-06-17[LLVM] [Support] Query the terminal width using `ioctl()` (#143514)Sirraide1-0/+5
On unix systems, we were trying to determine the terminal width using the `COULMNS` environment variable. Unfortunately, `COLUMNS` is not exported by all shells and thus not available on some systems. We were previously using `ioctl()` for this; fall back to doing so if `COLUMNS` does not exist or does not store a positive integer. This essentially reverts a3eb3d3d92d037fe3c9deaad87f6fc42fe9ea766 and parts of https://reviews.llvm.org/D61326. For more information, see #139499. Fixes #139499.
2025-06-16[build] Fixed LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING handling. (#144391)Slava Zakharin1-5/+5
Change in #107278 modified the CMake CACHE variable with values that are not supported for it as documented. This patch renames the derived vars so that they do not conflict with the CACHE variable.
2025-06-14[llvm] [cmake] Use pkg-config to obtain libffi search hints (#144221)Michał Górny1-3/+6
Extend `FindFFI.cmake` to include the paths obtained from pkg-config when searching for libffi. This is going to help systems where libffi is installed in nonstandard directory such as Gentoo, saving us from having to copy the paths from pkg-config to `FFI_*` variables explicitly. The logic is inspired by `FindLibEdit.cmake`.
2025-06-14CMake: Fix LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING to be 1 or 0.NAKAMURA Takumi1-1/+4
It has been introduced in #107278 but it was passing "DISABLED" of LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING to cmakedefine01. cmakadefine01 treats non-false-like strings as 1. "DISABLED" is replaced with 1.
2025-06-13[Cygwin] CYGWIN is not WIN32 in current CMake (#143130)Tomohiro Kashiwada2-14/+8
On old CMake, Cygwin were also WIN32 but currently not. LLVM_ON_UNIX=1 and LLVM_HAVE_LINK_VERSION_SCRIPT=0 should be defined for Cygwin target.
2025-06-13[DLCov] Origin-Tracking: Add config options (#143590)Stephen Tozer1-0/+3
This patch is part of a series that adds origin-tracking to the debugify source location coverage checks, allowing us to report symbolized stack traces of the point where missing source locations appear. This patch adds the configuration options needed to enable this feature, in the form of a new CMake option that enables a flag in `llvm-config.h`; this is not an entirely new CMake flag, but a new option, `COVERAGE_AND_ORIGIN`, for the existing flag `LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING`. This patch contains documentation, but no actual implementation for the flag itself.
2025-06-06[llvm] Fix cmake string expansion in CrossCompile.cmake (#138901)David Truby1-3/+3
2025-05-28[CMake] Fix config when static zstd libraries are not found (#113584)Udit Kumar Agarwal1-1/+12
Fixes: https://github.com/llvm/llvm-project/issues/113583
2025-05-28Reland "Add macro to suppress -Wunnecessary-virtual-specifier" (#141091)Devon Loehr1-5/+0
This fixes #139614 on non-clang compilers by moving `__has_warning` completely inside the `#if defined(__clang__)` block. This prevents a parse failure from compilers which don't recognize `__has_warning`. Original description: Followup to #138741. This adds the requested macro to silence `-Wunnecessary-virtual-specifier` when declaring virtual anchor functions in `final` classes, per [LLVM policy](https://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers). It also cleans up any remaining instances of the warning, allowing us to stop disabling it when we build LLVM.
2025-05-25fix zstd_shared detection on mingw (#139945)Jameson Nash1-2/+2
The zstd_shared autodetection was broken for non-MSVC (mingw) compiled LLVM, since it assumed that `*.a` uniquely identifies a file as being a static library, but typically this is actually an import lib formed as the longer name `*.dll.a` from the binary. This leads to confusing output elsewhere, in cmake and llvm-config, when they report this is a static library at an absolute path instead of a shared library named `-lzstd`.