475 Commits

Author SHA1 Message Date
Jordan Rupprecht
f1458ec623
[bazel] Port #153504: add llvm-offload-wrapper (#154553) 2025-08-20 15:01:46 +00:00
Jordan Rupprecht
fb4450c459
[bazel] Add more load statements for C++ rules (#154207)
Same thing as #149584, but for more elements of cc_rules (e.g.
`CcInfo`), and applying it to some files that were added since then
(build files under mlir/examples).

Command: `buildifier --lint=fix
--warnings=native-cc-binary,native-cc-import,native-cc-library,native-cc-objc-import,native-cc-objc-library,native-cc-shared-library,native-cc-test,native-cc-toolchain,native-cc-toolchain-suite,native-cc-fdo-prefetch-hints,native-cc-fdo-profile,native-cc-memprof-profile,native-cc-propeller-optimize,native-cc-common,native-cc-debug-package-info,native-cc-info,native-cc-shared-library-info,native-cc-shared-library-hint-info`
2025-08-18 19:41:49 -05:00
Orlando Cazalet-Hyams
1778669739
[KeyInstr] Remove LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS CMake flag (#152735)
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-08 17:03:28 +01:00
Bart Chrzaszcz
522ea9c330
[llvm] Fix bazel after 3f59a22. (#152151) 2025-08-05 15:57:18 +01:00
Benjamin Kramer
d07abde4b8 [bazel] Add missing dependency for 185a23e865c31145588276e7e0db2460e01eb703 2025-08-04 12:42:41 +02:00
Jordan Rupprecht
c05611f191
[bazel] Port #150633 HLSLBinding.h (#151546) 2025-07-31 11:04:14 -05:00
Jordan Rupprecht
86f74c4d01
[bazel] Use rules_cc everywhere and reformat (#149584)
We already use cc rules from `@rules_cc//cc:defs.bzl` in a few files,
but this uses it everywhere. Done automatically by running `buildifier
--lint=fix
--warnings=native-cc-binary,native-cc-library,native-cc-test,load` over
all the files. I also ran `buildifier` once more to ensure there wasn't
any missing formatting, so that caused a few unrelated diffs.
2025-07-29 16:30:25 -05:00
Jordan Rupprecht
b61695e3eb
[bazel] Port #149221 (#150347) 2025-07-23 20:01:54 -05:00
NAKAMURA Takumi
b8d21bf63b [bazel] Turn on EXPERIMENTAL_KEY_INSTRUCTIONS
It has been introduced in #131344 and turned on at #144324
2025-07-11 17:35:46 +09:00
Christian Sigg
96e4b50ffe [llvm][bazel] Port 7f3afab 2025-07-10 10:55:36 +02:00
Vincent Lee
03b0ae8da8
[mlgo-utils] Create symlinked entrypoints in root directory (#146981)
These scripts belong in the `mlgo-utils` directory when directly used
with python3. But since they are also used to package with pip, symlink
the entrypoint scripts to mlgo-utils directory. Adjust the bazel paths
to account for this as well. This loosely follows the same structure as lit.

Verified that I was also able to build the package successfully and use
the script.
2025-07-09 16:57:20 -07:00
James Y Knight
c57fe2f6ca [bazel] Update after 058056329982db13d513bc05d3c98f6558418242 2025-07-09 13:37:21 -04:00
James Y Knight
e7ab9209b1 [bazel] Fix after db03408b24459f0ba9f320509c7f8b3ec128e4b4 2025-07-09 12:10:24 -04:00
DeanSturtevant1
cdf5707bcb
[bazel] Update after 058056329982db13d513bc05d3c98f6558418242 (#147597) 2025-07-08 17:01:07 -04:00
Christian Sigg
18991f4654 [llvm][bazel] Port commit 5088231. 2025-07-08 08:23:27 +02:00
Benjamin Kramer
c7d3b81896 [bazel] Port 0ceb0c377a3e67b70965c32e7f21fe8b33f555d2 2025-07-04 10:27:02 +02:00
NAKAMURA Takumi
24c4bba076 [bazel] Quick fix for #145584 (Core deps ProfileData/InstrProf.h) 2025-07-01 10:03:03 +09:00
Thomas Hashem
18a0675082
[bazel] Add gdb-scripts filegroup in llvm and mlir (#146358)
This would be useful if downstream projects want to use the provided
pretty printers
2025-06-30 09:06:58 -07:00
Sterling-Augustine
23f1ba3ee4
Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (#145959) (#146112)
Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#…
(#145959)
    
This reapplies cbf781f0bdf2f680abbe784faedeefd6f84c246e, with fixes for
the shared-library build and the unconventional sanitizer-runtime build.

Original Description:

This is the culmination of a series of changes described in [1].
    
Although somewhat large by line count, it is almost entirely mechanical,
creating a new library in DebugInfo/DWARF/LowLevel. This new library has
very minimal dependencies, allowing it to be used from more places than
the normal DebugInfo/DWARF library--in particular from MC.
    
1.
https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-27 11:05:49 -07:00
Benjamin Kramer
f0f46e25ec [bazel] Port 3fdf46ad60f1747e8ea1cced2e67dd36f29fc43b 2025-06-27 12:52:45 +02:00
Sterling-Augustine
5d03e7a204
Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (#145959)
…145081)"

This reverts commit cbf781f0bdf2f680abbe784faedeefd6f84c246e.

Breaks a couple of buildbots.
2025-06-26 13:09:20 -07:00
Sterling-Augustine
cbf781f0bd
[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#145081)
This is the culmination of a series of changes described in [1].
    
Although somewhat large by line count, it is almost entirely mechanical,
creating a new library in DebugInfo/DWARF/LowLevel. This new library has
very minimal dependencies, allowing it to be used from more places than
the normal DebugInfo/DWARF library--in particular from MC.
    
I am happy to put it in another location, or to structure it differently
if that makes sense. Some have suggested in BinaryFormat, but it is not
a great fit there. But if that makes more sense to the reviewers, I can
do that.
 
Another possibility would be to use pass-through headers to allow
clients who don't care to depend only on DebugInfo/DWARF. This would be
a much less invasive change, and perhaps easier for clients. But also a
system that hides details.

Either way, I'm open.

1.
https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-26 11:23:46 -07:00
Benjamin Kramer
0036beeeef [bazel] Port e175ecff936287823b5443d7b2d443fc6569f31f 2025-06-25 13:25:40 +02:00
Karlo Basioli
fdb572681d
Fix bazel build after #144594 (#144904) 2025-06-19 15:50:53 +01:00
Benjamin Kramer
de3339063a [bazel] Port b4e39e4ff923334a8a1fdcc6d92b01d3885a01f2 2025-06-17 15:44:30 +02:00
Karlo Basioli
64bd4858dc
Amend enviroment variables in bazel - change from #144391 (#144484) 2025-06-17 10:09:10 +01:00
Reid Kleckner
acc58ac8bf
[bazel] Add missing dep for 52d34865b9db3485c (#144147) 2025-06-13 12:37:20 -07:00
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
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
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
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
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
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
Benjamin Kramer
7fb2590c1d [bazel] Port 6a477f6577a229589a610c36a879a1c88a4898a5 2025-05-28 14:56:34 +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
Adrian Kuegel
b565933fd7 [Bazel] Adapt to d561d595c4ee741f873972c03afa829e6c566ffd
Also restore ":Core" dependency, it is actually needed.
2025-05-20 07:42:11 +00:00
Adrian Kuegel
67f4d841f0 [llvm][Bazel] Adjust according to changes in 4cfbe55 2025-05-20 06:30:50 +00:00
Jorge Gorbe Moya
8af397af65 [bazel] Add missing dep after 810148cb0769f61f8afebdaf27a9c1af95de27aa 2025-05-13 11:49:07 -07:00
Jorge Gorbe Moya
227328f6f6 [bazel] Add missing dep after d896e2883e6f6b6266fa745ab758adc351778a89 2025-05-12 15:11:33 -07:00
NAKAMURA Takumi
6f4dcaed6b [bazel] Update AVR TableGen (for #139407) 2025-05-12 06:43:05 +09:00
Jorge Gorbe Moya
1678f47a91 [bazel] add missing dep for 74ed33484e84a331591fde66f7375c26bbf14672 2025-05-09 15:16:14 -07:00
Jorge Gorbe Moya
ccaf69a334 [bazel] Port c60db55568e82fd7b70dfec017d23e19aed6925f 2025-05-09 14:32:17 -07:00
Mikhail Goncharov
7618ce880d [bazel] port f9f2bf8e5e5c266a51b4ec6d23317a7e3dfeb670 2025-05-09 13:47:23 +02:00
Benjamin Kramer
1d3f8f4871 [bazel] Port 92cc31b0f7737408dffd38c2384dff825abb8e3a for Lanai 2025-05-08 14:09:29 +02:00
Jordan Rupprecht
28521368d7
[bazel] Port 6babd63a4bbc094bee4ef8e75f95dccd32325c15 (#139026) 2025-05-08 00:16:40 -05:00
NAKAMURA Takumi
c6c2e21028 [bazel] Update Sparc (for #138450) 2025-05-06 11:00:48 +09:00