2400 Commits

Author SHA1 Message Date
Eric Christopher
2a0b935461
[CMake][TableGen] Fix Ninja depslog error with implicit outputs on Ninja <1.10 (#179842)
Ninja versions prior to 1.10 cannot handle depfile mode when CMake
generates build rules with implicit outputs (the `| ${cmake_ninja_workdir}`
syntax used for IDE support). Ninja's depslog interprets these as
multiple outputs and rejects them with the error:

ninja: error: build.ninja:XXXX: multiple outputs aren't (yet?) supported
  by depslog; bring this up on the mailing list if it affects you

This primarily affected builds where CMake generates NATIVE subdirectory
builds for host tools.

This patch modifies TableGen.cmake to:
1. Detect the Ninja version at configure time
2. Disable depfile mode (fall back to globbing .td files) when:
   - Ninja version is < 1.10, OR
   - The tablegen invocation produces multiple outputs (e.g. -gen-register-info)

The fallback mode maintains correct dependency tracking by explicitly
globbing all .td files in include directories, ensuring tablegen reruns
when dependencies change.

Tested with:
- Ninja 1.8.2 (now works - previously failed with depslog error)
- Ninja 1.13.2
- CMake 4.2.3
- build scenarios with NATIVE tool builds

This commit used a significant amount of tooling to construct.
2026-02-05 18:35:32 -08:00
Brendan Dahl
14bebde0fd
Revert "[TargetParser][cmake] Recurse for TableGen deps" (#179588)
Reverts llvm/llvm-project#177274

Appears to be breaking some bots.
2026-02-03 17:24:40 -08:00
Brendan Dahl
28d0208573
[TargetParser][cmake] Recurse for TableGen deps (#177274)
In the dependency tracking for TableGen-generated files, globbing was
previously limited to the root of include directories. This missed
transitive dependencies in subdirectories, such as the target-specific
intrinsic definitions located in llvm/IR/.

Modifying these untracked files could cause global state (like the
intrinsic enum) to shift without triggering a rebuild of downstream
instruction selectors. This resulted in "Cannot select: intrinsic"
errors during incremental builds. Using a recursive glob ensures all
relevant TableGen files are correctly tracked regardless of their
directory depth.

Fixes #156744
2026-02-03 16:43:03 -08:00
Michael Kruse
50638e01e4
[runtimes] Share doxygen handling with LLVM (#176948)
Hoist handling of Doxygen into the top-level cmake/ directory so it can
be shared between LLVM and RUNTIMES and a default/standalone runtimes
build can support building Doxygen documentation as well.

The openmp subproject currently supports doxygen documentation using an
`LLVM_ENABLE_PROJECTS=openmp` build, but not with
`LLVM_ENABLE_RUNTIMES=openmp` because of this missing boilerplate code
in the runtimes build. This is a step towards removing the
`LLVM_ENABLE_PROJECTS=openmp` build mode which was deprecated (#124014)
and already scheduled to be removed in LLVM 21 (#136314). Eventual
removal is planned with #176950.

Hoisting CMake code for shared use with runtimes has been done before in
e.g. #84641, 7017e6c9cfd2de3122ce9528f338a97d61e96373,
44e3365775101fec3fd355eda339282258d74415,
7017e6c9cfd2de3122ce9528f338a97d61e96373

---------

Co-authored-by: Petr Hosek <phosek@google.com>
2026-01-21 12:38:31 +01:00
Andrei Damian
a2c7522dbb
Fix invalid escapes in VCSVersion.inc (#172899)
Tries to fix #172376.
2026-01-20 07:48:50 -08:00
Alexis Engelke
2ba7f11bce
[CMake] Enable warnings for PCH (#176566)
CMake unfortunately disables this by default...
2026-01-17 17:34:29 +01:00
Nikita Popov
9bbea753a4
[cmake] Restore exception flags in llvm-config --cxxflags (#176195)
https://github.com/llvm/llvm-project/pull/173869 accidentally dropped
rtti and eh flags from `llvm-config --cxxflags`. Then
https://github.com/llvm/llvm-project/pull/174084 restored the rtti
flags. The eh flags were not included with the rationale that they are
not ABI relevant.

This PR restores the eh flags as well. While they are not strictly
necessary, I believe that code that directly interfaces with LLVM almost
certainly does not want to build with exceptions if LLVM is not built
with exceptions. Building in the peculiar `-fexceptions -fno-rtti`
configuration is rarely useful and likely not intended.

On MacOS, this is also relevant because it's not possible to use C++17
headers without `-fno-exceptions` when using older deployment targets.
In that configuration, `-fno-exceptions` is required to interact with
LLVM.
2026-01-16 09:33:25 +01:00
Alexis Engelke
68239d53c5
[CMake][NFC] Drop unnecessary GTest RTTI define (#175555)
gtest automatically determines GTEST_HAS_RTTI from pre-defined compiler
macros, there is no need to explicitly define this and especially no
need to define this for every single source file.
2026-01-12 17:08:12 +01:00
Alexis Engelke
3c45c54156
[CMake] Move RTTI flag calculation to AddLLVM.cmake (#175553)
This should help users who use AddLLVM.cmake without HandleLLVMOptions.
Note that remains MSVC is unlikely to work.

Follow up of #174084.
2026-01-12 15:51:18 +00:00
Alexis Engelke
2b903df797 [CMake] Fix variable name mistake
Fixup of d1b88ca8d4c5d849ae93111ae9e24d88dad4b762, was an overly eager
find-replace..
2026-01-02 10:56:43 +00:00
Alexis Engelke
d1b88ca8d4
[CMake] Re-add -fno-rtti to llvm-config --cxxflags (#174084)
Fix for https://github.com/llvm/llvm-project/pull/173869.

If there's no strong reason, we should get rid of per-target RTTI later.
2026-01-01 22:24:47 +01:00
Alexis Engelke
54faa755bc
[LLVM][CMake][NFC] Use generator expression to separate CXXFLAGS (#173869)
This avoids looking at the individual sources for mixed C/C++ libraries.

The previous code was written ~2014. Generator expressions were added in
CMake 3.3 (2015). We currently require CMake 3.20 and therefore can rely
on more modern features.

Apart from simplifying the code, this is preliminary work to make more
use of pre-compiled headers (#173868).
2025-12-30 09:48:18 +01:00
Reid Kleckner
8518d2c405
[cmake] Simplify LLVM_ON_WIN32 logic (#173525)
This is just a vestige of an old llvm-config.h configuration macro that
was removed long ago. LLVM_ON_UNIX remains, but its main purpose is to
enable targetting bare metal through -DCMAKE_SYSTEM_NAME=Generic (see
1422f1bf2b1).
2025-12-25 14:11:13 -08:00
Aiden Grossman
e3ef26df85
[llvm][CMake] Remove -fno-lifetime-dse (#173322)
Now that #24952 has been fixed by #170575, we no longer need to specify
-fno-lifetime-dse when building with gcc.
2025-12-22 17:01:27 -08:00
Nikita Popov
3f64ba5b5b
[OCaml] Try to fix library dependencies (#171470)
Whenever I try to change anything in the OCaml bindings, I run into
errors like this when running tests:

```
File
"/home/npopov/repos/llvm-project/build/test/Bindings/OCaml/Output/debuginfo.ml.tmp/Testsuite.ml",
line 1:
    Warning 70 [missing-mli]: Cannot find interface file.

File
"/home/npopov/repos/llvm-project/build/test/Bindings/OCaml/Output/debuginfo.ml.tmp/debuginfo.ml",
line 1:
Error: The files
"/home/npopov/repos/llvm-project/build/lib/ocaml/llvm/llvm.cmi"
and
"/home/npopov/repos/llvm-project/build/lib/ocaml/llvm/llvm_debuginfo.cmi"
           make inconsistent assumptions over interface "Llvm"
```

The only reliable way of getting rid of these I have found is to do an
`rm -rf build` and just rebuild everything.

The root cause of this issue is that we currently add
target-dependencies between ocaml modules, but we don't have file-level
dependencies. This means that everything gets built in the correct
order, but targets don't get rebuilt if a dependency is changed.

To fix this, add file-level dependencies to the custom command. These
are generated via a target property that stores the ocaml outputs of the
target.
2025-12-22 10:09:21 +01:00
Ramil Sattarov
a523ee6e7a
llvm/cmake/config.guess: add support for e2k (Elbrus-2000) (#162460)
Backport patch from gnu-config:
https://lists.gnu.org/archive/html/config-patches/2015-03/msg00000.html
2025-12-13 18:35:41 +00:00
Anton Sidorenko
f5dd2dc712
[cmake] Fix semicolon expansion when passing LLVM_TABLEGEN_FLAGS (#169518)
This patch uses common workaround for cmake semicolon expansion to
spaces
2025-12-02 15:41:31 +03:00
David Tenty
bb0a95d5b1 [CMake] handle the AIX form of the lto cache dir option (#168868)
This handles the AIX form of the thinLTO cache dir option, which get's
turned on when thinLTO is enabled.
2025-11-20 15:27:45 +00:00
Ivan Kosarev
0be4218d7b
[CMake] Declare all parts of *GenRegisterInfo.inc as outputs. (#168405)
This tells the build system to check and regenerate the
*GenRegisterInfo*.inc files, should any of them be missing for
whatever reason.

A follow-up from
<https://github.com/llvm/llvm-project/pull/167700>.
2025-11-18 12:41:53 +00:00
Lei Huang
a7579fda53
[PowerPC][AIX] Remove flag for no semantic interposition (#168109)
Remove flag to sepecifcy "no semantic interposition" since this is the
default for AIX.
2025-11-17 12:51:04 -05:00
Michael Kruse
471d804158
[CMake][unittests] Teach export_executable_symbols about ALIAS targets (#167932)
DynamicLibraryTests has a workaround for AIX that calls
export_executable_symbols after add_llvm_unittest, instead of just
passing the `EXPORT_SYMBOLS` switch. At this point, the
default_gtest(_main) libraries is added to the linked library set.
However, default_gtest(_main) are ALIAS libraries. This PR replaces the
ALIAS libraries with the ALIASED_TARGET before passing it to
extract_symbols.py.

Fixes failure of the clang-ppc64-aix buildbot after #164794.
2025-11-13 21:41:16 +01:00
Michael Kruse
0957656a40
[runtimes][GTest] LLVM-independent unittests (#164794)
The LLVM-customized GTest has a dependency on LLVM to support
`llvm::raw_ostream` and hence has to link to LLVMSupport. The runtimes
use the LLVMSupport from the bootstrapping LLVM build. The problem is
that the boostrapping compiler and the runtimes target can diverge in
their ABI, even in the runtimes default build. For instance, Clang is
built using gcc which uses libstdc++, but the runtimes is built by Clang
which can be configured to use libcxx by default. Altough it does not
use gcc, this issue has caused
[flang-aarch64-libcxx](https://lab.llvm.org/buildbot/#/builders/89)) to
break, and is still (again?) broken.

This patch makes the runtimes' GTest independent from LLVMSupport so we
do not link any runtimes component with LLVM components.

Runtime projects that use GTest unittests:
 * flang-rt
 * libc
* compiler-rt: Adds `gtest-all.cpp` with
[GTEST_NO_LLVM_SUPPORT=1](f801b6f67e/compiler-rt/CMakeLists.txt (L723))
to each unittest without using `llvm_gtest`. Not touched by this PR.
* openmp: Handled by #159416. Not touched for now by this PR to avoid
conflict.

The current state of this PR tries to reuse
https://github.com/llvm/llvm-project/blob/main/third-party/unittest/CMakeLists.txt
as much as possible, altough personally I would prefer to make it use
"modern CMake" style. third-party/unittest/CMakeLists.txt will detect
whether it is used in runtimes build and adjaust accordingly. It creates
a different target for LLVM (`llvm_gtest`, NFCI) and another one for the
runtimes (`runtimes_gtest`). It is not possible to reuse `llvm_gtest`
for both since `llvm_gtest` is imported using `find_package(LLVM)` if
configured using LLVM_INSTALL_GTEST. An alias `default_gtest` is used to
select between the two. `default_gtest` could also be used for openmp
which also supports standalone and
[LLVM_ENABLE_PROJECTS](https://github.com/llvm/llvm-project/pull/152189)
build mode.
2025-11-12 11:50:33 +01:00
Ross Burton
0ae0ac0f00
[cmake] Pass PYTHON_EXECUTABLE to native builds (#163574)
Ensure that the nested native build uses the same python interpreter as
the main build, in case the python that CMake detects first is not the
python that the user has specified explicitly.

For example, if the person building LLVM wants to use a different python
interpreter to build (eg, testing the build with `python3.14` when
`python3` is a link to `python3.8`, or the default python doesn't have
development headers available) then they could add
`-DPYTHON_EXECUTABLE=python3.14` when invoking CMake. This should be
forwarded to the native CMake build to ensure that the same python is
used.

Original fix by Anuj Mittal <anuj.mittal@intel.com>.
2025-11-04 11:26:02 -08:00
Nikita Popov
16f1179421
[flang][cmake] Set the usual linker flags for non-gtest unit tests (#165256)
Flang also uses non-gtest based unittests, which don't go through the
usual add_unittest() helper. These currently do not use the usual linker
flags for unit tests. This means that in LTO builds, they do not disable
LTO when building unit tests, which increases the build time.
2025-10-29 12:27:11 +01:00
Martin Storsjö
13784f7a4d
[cmake] Unconditionally use -Wno-pass-failed with Clang (#162835)
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
2025-10-10 18:17:31 +03:00
Nikita Popov
1ab69d7004
[CMake] Suppress -Wpass-failed warning (#160472)
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-08 10:34:10 +02:00
Amir Ayupov
780f69cd92
[Clang][CMake] Add CSSPGO support to LLVM_BUILD_INSTRUMENTED (#79942)
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
9f2b46f67a
  - 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-10-01 15:25:34 -07:00
Joseph Huber
2dd0edf2d8 [LLVM] Remove leftover unnecessary CMake for GPU runtimes
Summary:
This somehow snuck back in.
2025-09-20 09:06:48 -05:00
Joseph Huber
9542d0a0c6 [libc] Fix libc build on NVPTX using wrong linker flag
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 18:21:47 -05:00
Joseph Huber
2d503b924c
[LLVM] Simplify GPU runtimes flag handling (#159802)
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-19 13:09:52 -05:00
Steven Wu
00dc72fa1f
[CAS] LLVM_ENABLE_ONDISK_CAS requires flock on UNIX (#159207)
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 16:52:36 +00:00
Martin Storsjö
b90af2df59
[CMake] Merge if statements for GCC warning disabling. NFC. (#159172) 2025-09-17 10:11:29 +03:00
Martin Storsjö
06aaa0e02f [CMake] Disable more noisy GCC warnings (#159044)
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-16 23:13:37 +03:00
Martin Storsjö
0df46c4f5a Revert "[CMake] Disable more noisy GCC warnings (#159044)"
This reverts commit 984be7c5a7e34857577093c74dd9270227c0f887.
2025-09-16 23:13:16 +03:00
Martin Storsjö
984be7c5a7
[CMake] Disable more noisy GCC warnings (#159044)
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-16 23:12:08 +03:00
parabola94
7cdffde207
[cmake] Add LLVM_TARGET_TRIPLE_ENV to LLVMConfig.cmake.in (#158303)
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-15 23:38:02 +00:00
Hans Wennborg
228e24028d
Add llvm-ml64 to LLVM_TOOLCHAIN_TOOLS (#158582)
So that it gets included in LLVM_INSTALL_TOOLCHAIN_ONLY builds, such as
when building the Windows installer.

Fixes #149664
2025-09-15 09:39:42 -04:00
Martin Storsjö
e741b71928
[CMake] Disable -Wdangling-reference warnings on GCC (#157541)
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-09 12:26:54 +03:00
Maksim Levental
c0269c4b3c
[CMake] add SKIP to add_lit_testsuites (#157176)
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-06 03:41:48 -07:00
Nikita Popov
cd7f7cf5cc Reapply [IR] Remove options to make scalable TypeSize access a warning (#156336)
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-03 11:12:11 +02:00
Nikita Popov
95e76c14da Revert "[IR] Remove options to make scalable TypeSize access a warning (#156336)"
This reverts commit 8f59a946740bf8dbe2574b33eaa431fde3ce9204.

Failed on clang-aarch64-sve-vls-2stage, which still uses the option.
2025-09-02 09:52:37 +02:00
Nikita Popov
8f59a94674
[IR] Remove options to make scalable TypeSize access a warning (#156336)
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-02 09:10:45 +02:00
serge-sans-paille
4d21f664db
Be smarter about the GLIBCXX_USE_CXX11_ABI default (#155781)
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-30 06:45:55 +00:00
David Tenty
3e6ec475b7 [CMake][AIX] quote the string AIX if conditions
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 23:52:13 -04:00
Aiden Grossman
b1c8228bcd
[CMake] Remove LLVM_ENABLE_IR_PGO Option (#155958)
It has been deprecated for eight years now
(a702fa17f31abd5efce302ef3d4cf2fbaf167368), and all users that I know of
are using LLVM_BUILD_INSTRUMENTED.
2025-08-29 10:38:27 -07:00
Djordje Todorovic
d49353c812
[cmake] Add config.guess for RISC-V BE (#154903)
This adds config guess support for RISC-V big-endian.
2025-08-22 21:07:40 +02:00
serge-sans-paille
50f7c6a5b9
Default to GLIBCXX_USE_CXX11_ABI=ON
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-22 09:35:40 +02:00
Mike Hommey
be179d0696
Be explicit about what libstdc++ C++11 ABI to use (#154447)
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-22 05:55:42 +00:00
David Tenty
63195d3d7a
[NFC][CMake] quote ${CMAKE_SYSTEM_NAME} consistently (#154537)
A CMake change included in CMake 4.0 makes `AIX` into a variable
(similar to `APPLE`, etc.)
ff03db6657

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-20 12:45:41 -04:00
gulfemsavrun
f396657bf9
Revert "Remember LLVM_ENABLE_LIBCXX setting in installed configuration" (#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-15 16:45:40 -07:00