2896 Commits

Author SHA1 Message Date
Reid Kleckner
ec330cf670
[bazel] Update llvm-config.h and disable DebugLoc tracking (#144125)
In c588224ca797886064a7a79f6c0114a6963c325e, @chapuni set
LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING to 1, but from what I can tell,
this is not the default setting for CMake builds. I think the intention
was mostly just to update llvm-config.h to fix the Bazel build.

I'm adding LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING as well to fix the build
for the same purpose.
2025-06-13 10:31:35 -07:00
Reid Kleckner
6e988bd33f
[mlir] Forward **kwargs through gentbl_shard_rule (#144001)
This allows clients to pass additional cc_library arguments through this
macro to the build rules it calls.
2025-06-13 09:56:57 -07:00
Reid Kleckner
e1bb35d067
[bazel] Fix modules build for llvm-libc (speculative) (#143995) 2025-06-12 16:52:32 -07:00
lntue
d1ca8d891f
[libc][math] Refactor expf implementation to header-only in src/__support/math folder. (#143790)
This is a step in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-06-12 13:18:30 -04:00
Jorge Gorbe Moya
6c72084a57 [bazel] port 1ecd108cb7ceda2b11281b5d173e2827feb60c55 2025-06-11 16:57:14 -07:00
lntue
d87eea35fa
[libc] Move libc_errno.h to libc/src/__support and make LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187)
This is the first step in preparation for:
https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-06-11 16:25:27 -04:00
Jorge Gorbe Moya
c70658e32d [bazel] port 5dafe9dca867b90f20dcd71c620ad823aee4262b 2025-06-11 13:09:11 -07:00
Jorge Gorbe Moya
d5f68cb145 [bazel] Port fe7bf4b90b1a835418bddd2b2aa63b4977a9f6d2 2025-06-11 12:10:09 -07:00
Yifei Xu
8d7da9a2a4
Update BUILD.bazel
Add missing dependency after https://github.com/llvm/llvm-project/pull/142916.
2025-06-11 13:33:23 -05:00
NAKAMURA Takumi
ee3f50939d [bazel] Turn on LLVM_ENABLE_PLUGINS on posix
Since #141650, `LLVM_ABI inline` has had different linkage regarding
to LLVM_ENABLE_PLUGINS.

This was introduced in 8830e3802a92 (llvmorg-21-init-14426-g8830e3802a92)
but reverted in #143419 due to breakage of msvc build.
2025-06-10 21:41:33 +09:00
Yifei Xu
787efa78a4
[bazel] Revert "[bazel] llvm-config.h: Turn on LLVM_ENABLE_PLUGINS" as it fails TensorFlow Windows build (#143419)
Here is the error message

[3,466 / 5,762] 1 / 149 tests; [Sched] Compiling
llvm/lib/Support/BinaryStreamError.cpp ... (456 actions, 2 running)
ERROR: C:/t/g5cdusdm/external/llvm-project/llvm/BUILD.bazel:253:11:
Compiling llvm/lib/Support/ExtensibleRTTI.cpp [for tool] failed: (Exit
1): clang-cl.exe failed: error executing CppCompile command (from target
@@llvm-project//llvm:Support)
  cd /d C:/t/g5cdusdm/execroot/org_tensorflow
SET INCLUDE=C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include;C:\Program
Files\Microsoft Visual
Studio\2022\Community\VC\Auxiliary\VS\include;C:\Program Files
(x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files
(x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files
(x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files
(x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files
(x86)\Windows
Kits\10\\include\10.0.22621.0\\cppwinrt;C:\tools\LLVM\lib\clang\18\include
SET PATH=C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX64\x64;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\VC\VCPackages;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team
Explorer;C:\Program Files\Microsoft Visual
Studio\2022\Community\MSBuild\Current\bin\Roslyn;C:\Program Files
(x86)\Windows Kits\10\bin\10.0.22621.0\\x64;C:\Program Files
(x86)\Windows Kits\10\bin\\x64;C:\Program Files\Microsoft Visual
Studio\2022\Community\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program
Files\Microsoft Visual Studio\2022\Community\Common7\IDE\;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\Tools\;;C:\Windows\system32;C:\Program
Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
    SET PWD=/proc/self/cwd
    SET TEMP=C:\TMP
    SET TMP=C:\TMP
    SET VSLANG=1033
C:\tools\LLVM\bin\clang-cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX
/D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE
/D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 /wd4250
/wd4996 /Iexternal/llvm-project
/Ibazel-out/x64_windows-opt-exec-ST-766941a09caf/bin/external/llvm-project
/Iexternal/llvm-project/llvm/include
/Ibazel-out/x64_windows-opt-exec-ST-766941a09caf/bin/external/llvm-project/llvm/include
/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS
/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_NONSTDC_NO_WARNINGS
/D_SCL_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS /DUNICODE
/D_UNICODE /DLTDL_SHLIB_EXT=".dll" /DLLVM_PLUGIN_EXT=".dll"
/DLLVM_NATIVE_ARCH="X86"
/DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser
/DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter
/DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler
/DLLVM_NATIVE_TARGET=LLVMInitializeX86Target
/DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo
/DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC
/DLLVM_NATIVE_TARGETMCA=LLVMInitializeX86TargetMCA
/DLLVM_HOST_TRIPLE="x86_64-pc-win32"
/DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-pc-win32" /DLLVM_VERSION_MAJOR=21
/DLLVM_VERSION_MINOR=0 /DLLVM_VERSION_PATCH=0
/DLLVM_VERSION_STRING="21.0.0git" /D__STDC_LIMIT_MACROS
/D__STDC_CONSTANT_MACROS /D__STDC_FORMAT_MACROS
/DLLVM_HAS_AArch64_TARGET=1 /DLLVM_HAS_AMDGPU_TARGET=1
/DLLVM_HAS_ARM_TARGET=1 /DLLVM_HAS_NVPTX_TARGET=1
/DLLVM_HAS_PowerPC_TARGET=1 /DLLVM_HAS_RISCV_TARGET=1
/DLLVM_HAS_SystemZ_TARGET=1 /DLLVM_HAS_X86_TARGET=1 /DBLAKE3_USE_NEON=0
/DBLAKE3_NO_AVX2 /DBLAKE3_NO_AVX512 /DBLAKE3_NO_SSE2 /DBLAKE3_NO_SSE41
/showIncludes /MD /O2 /Oy- /DNDEBUG /wd4117 -D__DATE__="redacted"
-D__TIMESTAMP__="redacted" -D__TIME__="redacted"
-Wno-builtin-macro-redefined /Gy /Gw /W0 /Zc:__cplusplus
/D_USE_MATH_DEFINES /d2ReducedOptimizeHugeFunctions
-D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN32_LEAN_AND_MEAN -DNOGDI
/Zc:preprocessor /clang:-Weverything /clang:-Weverything
/d2ReducedOptimizeHugeFunctions /std:c++17
/Fobazel-out/x64_windows-opt-exec-ST-766941a09caf/bin/external/llvm-project/llvm/_objs/Support/ExtensibleRTTI.obj
/c external/llvm-project/llvm/lib/Support/ExtensibleRTTI.cpp
# Configuration:
f85b29406574d83c673497718f542456050c5649ae41eb37a803b7085e15c4ef
# Execution platform:
//tensorflow/tools/toolchains/win2022:windows_ltsc2022_clang
external/llvm-project/llvm/lib/Support/ExtensibleRTTI.cpp(12,22): error:
definition of dllimport static field not allowed
   12 | char llvm::RTTIRoot::ID = 0;
      |                      ^
external/llvm-project/llvm/include\llvm/Support/ExtensibleRTTI.h(71,7):
note: attribute is here
   71 | class LLVM_ABI RTTIRoot {
      |       ^
external/llvm-project/llvm/include\llvm/Support/Compiler.h(205,29):
note: expanded from macro 'LLVM_ABI'
  205 | #define LLVM_ABI __declspec(dllimport)
      |                             ^
1 error generated.
2025-06-09 12:41:47 -07:00
Chenguang Wang
b7ef3e7a85
[bazel] Fix llvm-min-tblgen bazel build (#143213)
Broken by 7b2aa02a. Tested with:

    bazelisk build \
        @llvm-project//llvm:llvm-min-tblgen \
        @llvm-project//llvm:FrontendOpenACC \
        @llvm-project//llvm:FrontendOpenMP \
        @llvm-project//llvm:TableGen
2025-06-06 15:33:23 -07:00
Michael Jones
59f88a8e92
[libc] clean up string_utils memory functions (#143031)
The string_utils.h file previously included both memcpy and bzero. There
were no uses of bzero, and only one use of memcpy which was replaced
with __builtin_memcpy.

Also fix strsep which was broken by this change, fix a useless assert of
"sizeof(char) == sizeof(cpp::byte)", and update the bazel.
2025-06-06 11:16:54 -07:00
Jordan Rupprecht
5537733a04
[bazel] Port #140572 (#143110)
Commit b9d3a644c2716e651b388f9fff660b12fdba577c
2025-06-06 06:06:46 -05:00
Jordan Rupprecht
fb5baef89b
[bazel] Port #135636 (#143109)
Commit 44a047c9295512ef3f940ac06a3e50a740671199
2025-06-06 05:52:30 -05:00
Chenguang Wang
9eb90c2139
[bazel] Fix LLVM plugin tests under Analysis. (#142999)
Those tests were broken on bazel as a side effect of 8830e380.

This commit is tested with this command on Linux:

    bazelisk test \
        @llvm-project//llvm/unittests:analysis_tests \
@llvm-project//llvm/unittests:plugin_inline_advisor_analysis_test \
        @llvm-project//llvm/unittests:plugin_inline_order_analysis_test
2025-06-05 09:58:17 -07:00
Jordan Rupprecht
578c75e9f7
Revert "[libc][bazel] Support generating public libc headers in Bazel builds. (#141256)" (#143001)
This reverts commit 27143f2929629d0919f8768b2460972e4f4c2d41. It causes
some downstream failures when bootstrapping builds.
2025-06-05 11:24:47 -05:00
NAKAMURA Takumi
8830e3802a [bazel] llvm-config.h: Turn on LLVM_ENABLE_PLUGINS
Since #141650, `LLVM_ABI inline` has had different linkage regarding
to LLVM_ENABLE_PLUGINS. This doesn't intend Bazel build would
introduce plugins.
2025-06-05 22:38:55 +09:00
Rahul Joshi
e53ccb78e4
[LLVM][MC] Introduce OrFail variants of MCD ops (#138614)
Introduce `OrFail` variants for all MCD Decoder Ops that have
`NumToSKip` encoded with them. This is intended to capture the common
case of jumps to the end of the decoder table which has a `OP_Fail` at
the end. Using the `OrFail` variants of these ops avoid encoding the
`NumToSkip` jump offset for these cases, resulting in a reduction in the
size of the decoder tables (from 5 - 17%). Additionally, for the AArch64
target, the table size reduces enough to switch to using 2-byte
`NumToSkip` encoding instead of existing 3-bytes, resulting in a net 30%
reduction in the size of the decoder table.

The total reduction in the size of the decoder tables for different
targets is as follows (computed using the following command: `for i in
*.inc; do echo -n ``basename $i: ``; grep "MCD::OPC_Fail," $i | awk
'{sum += $2} END { print sum}'; done`)

```
Target         Old Size   New Size   % Reduction
================================================
AArch64           153268     106987       30.20
AMDGPU            412056     340856       17.28
ARC                 5061       4605        9.01
ARM                73831      60847       17.59
AVR                 1306       1158       11.33
BPF                 1927       1795        6.85
CSKY                8692       6922       20.36
Hexagon            41965      34759       17.17
Lanai                982        924        5.91
LoongArch          21629      20035        7.37
M68k               13461      11689       13.16
MSP430              3716       3384        8.93
Mips               31415      25771       17.97
PPC                28931      24771       14.38
RISCV              34800      28352       18.53
Sparc               7432       6236       16.09
SystemZ            32248      29716        7.85
VE                 42873      36923       13.88
XCore               2316       2196        5.18
Xtensa              3443       2793       18.88
```
2025-06-05 06:17:50 -07:00
Jordan Rupprecht
2917040642
[bazel] Port #141332 (#142890)
Commit e4c8ff94e7a30589ab6dc6dbb6151e1424ce3432
2025-06-04 22:20:49 -05:00
Jordan Rupprecht
7578922d71
[bazel] Fix one missed target also broken by ff844df719d7226a46b8cb0 (#142854)
a4320ba67bf753395b57b5133b83017ef6531d62 fixed most targets but missed
one.
2025-06-04 16:09:58 -05:00
Chenguang Wang
a4320ba67b
[bazel] fix libc bazel build broken by ff844df7. (#142848)
Fixes `bazelisk test @llvm-project//libc/test/src/string/...`
2025-06-04 13:42:45 -07:00
Chenguang Wang
6dd3891b72
[bazel] fix bazel build broken by d96447b4. (#142841) 2025-06-04 13:09:52 -07:00
Jordan Rupprecht
90e906a5a8
Revert "[bazel] Port c3746ff3229c57110f7895ff5b93e520cead0d1b" (#142791)
This reverts commit d31ace4abc5dd02fc643a89ef1d3cd981590f2b6.

That commit was a fix for c3746ff3229c57110f7895ff5b93e520cead0d1b,
which was later reverted in 15dff71cac9fb85f3332fb5e5809d3d8665ed176.
2025-06-04 10:23:33 -05:00
Benjamin Kramer
d31ace4abc [bazel] Port c3746ff3229c57110f7895ff5b93e520cead0d1b 2025-06-04 16:08:04 +02:00
Jordan Rupprecht
0c0e7a35d0
[bazel] Port 0a3e9aa336d1926691e1353e7251ff0704c32a69 (#142680)
llvm/lib/IR/RuntimeLibcalls.cpp needs to include
llvm/lib/IR/ZOSLibcallNames.def
2025-06-03 17:34:34 -05:00
jtstogel
27143f2929
[libc][bazel] Support generating public libc headers in Bazel builds. (#141256)
This requires adding a new dependency on PyYAML so that Bazel is able to
run the `hdrgen` tool hermetically. This PR uses PyYAML version 5.1 due
to keep in line with the docs:
b878e0d118/libc/docs/dev/header_generation.rst (L22)

See https://github.com/llvm/llvm-project/issues/134780.
2025-06-03 10:15:14 -07:00
Jordan Rupprecht
6565e07a17
[bazel] Port ArmNeon after #140251 (#142569)
Commit be9334a68eaa2605e127ffa0d3b2dc13ff1d7af4
2025-06-03 05:23:04 -05:00
Benjamin Kramer
f99e76b004 [bazel] Port 0210750d5a5b4cfc8d2b6a9e94ace24d31d65ddc 2025-06-02 21:38:26 +02:00
Jordan Rupprecht
76423133ef
[bazel] Add missing deps for #141864 (#142437)
Added in 150d466994050c52db76b64ff2ce44cddddbcad4.

```
external/llvm-project/llvm/include/llvm/Frontend/Driver/CodeGenOptions.h:16:10: error: module llvm-project//llvm:FrontendDriver does not depend on a module exporting 'llvm/Support/Compiler.h'
#include "llvm/Support/Compiler.h"
```
2025-06-02 12:39:28 -05:00
Jordan Rupprecht
3290d625d2
[bazel] Add TestingDemangle target for #137947 (#142419)
Added in f7e172da4caeab9d92f6e97501b1a2c561e616c1
2025-06-02 10:56:37 -05:00
Jacques Pienaar
e49738b3ac
[mlir][lsp] Enable registering dialects based on URI. (#141331)
Previously the dialects registered were fixed per LSP binary. This works
as long as all the dialects of interest from the different projects
across which one uses the LSP, are disjoint. This expands this to
support cases where there are dialects that overlap in dialect name but
usage of these are separate wrt projects. The alternative is multiple
binaries and switching LSP used in editor per project (there is some
extra complexity in hosted instances).

This handles a simple (I believe common case) where one can determine
based on path and have single binary - the cost of dynamically doing so
based on path would be either keeping different registries to return or
repopulating dialect & extension maps.
2025-06-01 23:55:32 -07:00
Walter Lee
fc1484b30e
[bazel] Fix build for 5fe9aea6d128a8569e27f8c66272e481f10c61ae (#142065) 2025-05-29 19:54:11 -04:00
Benjamin Kramer
0967fce646 [bazel] Port c474f8f2404dfe5a902cdf93d678a0bfe8cc8f44 2025-05-29 17:52:46 +02:00
google-yfyang
259fe01ace
[bazel] Add the missing dependency for the introduced use of support/Utils.h (#141828)
#138066 adds the use of this unspecified dependency. 
This breaks bazel build. 

https://buildkite.com/llvm-project/upstream-bazel/builds/137154#01971745-cb44-4fd1-af59-ccef34c3f61e
2025-05-28 15:18:55 -04:00
Benjamin Kramer
7fb2590c1d [bazel] Port 6a477f6577a229589a610c36a879a1c88a4898a5 2025-05-28 14:56:34 +02:00
Christian Sigg
03fc480b9a
[mlir][bazel] Adjust BUILD file to work with transform_build_files tool. 2025-05-27 10:39:06 +02:00
Adrian Kuegel
b231e5ff50 [Bazel] Followup fix for c76e28 2025-05-26 08:51:58 +00:00
Adrian Kuegel
3833513886 [Bazel] Adjust according to c76e2800e3d78fa6e8618431a6893f66f2fd3496 2025-05-26 08:38:17 +00:00
Adrian Kuegel
3d6f69873d [Bazel] Another followup fix for 97dee78 2025-05-26 06:16:17 +00:00
Pat Doyle
9c59946670
[bazel][test] Continue fixing bazel build from 97dee78 (#141336)
this continues the work in 0967a6f by generating a header from
clang-tools-extra/unittests/clang-doc/config.h.cmake

not clear all the tests pass yet, but fixes this build error at least:

ERROR:
/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/6a1efeb401da192d3572f00e2f11245b/external/llvm-project/clang-tools-extra/unittests/BUILD.bazel:57:8:
Compiling
clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp
failed: (Exit 1): clang failed: error executing CppCompile command (from
target @@llvm-project//clang-tools-extra/unittests:clang_doc_test)
/usr/lib/llvm-18/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall
-Wthread-safety -Wself-assign -Wunused-but-set-parameter
-Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer ...
(remaining 328 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain
the sandbox build root for debugging

external/llvm-project/clang-tools-extra/unittests/clang-doc/HTMLMustacheGeneratorTest.cpp:12:10:
fatal error: 'config.h' file not found
   12 | #include "config.h"
      |          ^~~~~~~~~~
1 error generated.
2025-05-26 07:56:48 +02:00
Benjamin Kramer
5efd1ae094 [bazel] Fix up fe30cde29e20 2025-05-23 20:44:12 +02:00
Bart Chrzaszcz
fe30cde29e
[mlir] Fix bazel build after 0fa3ba7. (#141241) 2025-05-23 20:39:52 +02:00
Bart Chrzaszcz
7239841263
[mlir] Fix bazel build after 61d5fdf v2. (#141235)
These files were deleted, and `AllToLLVMIRTranslations` compiles
successfully without them.
2025-05-23 15:46:29 +01:00
Bart Chrzaszcz
6db8490f03
[mlir] Fix bazel build after 61d5fdf50c78. (#141224) 2025-05-23 12:03:12 +01:00
Adrian Kuegel
896ea58b8f [Bazel] Add back the clang-doc:lib dependency. Still needed. 2025-05-23 09:58:46 +00:00
Adrian Kuegel
127cc84441 [Bazel] Followup: avoid dependency cycle 2025-05-23 09:56:28 +00:00
Adrian Kuegel
0967a6f71c [Bazel] Adjust to 97dee78eb364efab6ddb57bc6580c55971994f41
There is still one failing test, not sure yet how that can be fixed.
2025-05-23 09:53:32 +00:00
Benjamin Kramer
2bb5cc54be [bazel] Port 50127ac054a08321b64f4ac24bda5cad20e20ac1 2025-05-22 16:52:35 +02:00
Adrian Kuegel
e8ecd2cf94 Revert "[llvm][Bazel] Adjust according to changes in 4cfbe55"
This reverts commit 67f4d841f06640f3bcbe91cc9b9ad0ea047e4518.
2025-05-22 05:58:26 +00:00