2201 Commits

Author SHA1 Message Date
Jorge Gorbe Moya
22ed10d11e [bazel][mlir] Add missing dep after ee0284ec1027 2024-04-18 11:20:06 -07:00
Keith Smiley
1b87418b99
[bazel] Improve liblldb building (#89095)
On Linux using --version-script doesn't force loading of the underlying
archives that contain the symbols. By setting alwayslink=True on the API
cc_library we virtually get this behavior. This also allows downstream
users to use the exports files used by cmake. We could build more
configurability into this but there are also a lot of possible
variations users might want.
2024-04-17 17:03:39 -04:00
Jorge Gorbe Moya
676d3bafc0 [bazel][libc] Add missing dep after b854a2323337be2633b1135f590678a17e9d1ade 2024-04-17 10:20:25 -07:00
Jorge Gorbe Moya
564f9abfcc [bazel][mlir] Add missing dep after 4f88c2311130791cf69da34b743b1b3ba7584a7b 2024-04-17 10:11:03 -07:00
Robin Caloudis
b854a23233
[libc][c23][fenv] Implement fetestexceptflag (#87828)
Provide C23 `fetestexceptflag` function according to 7.6.4.6 in the
latest [revision of the C
standard](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf)
from 2023-04-02.

Closes https://github.com/llvm/llvm-project/issues/87565.
2024-04-17 08:38:47 -07:00
Keith Smiley
1bc092181b
[bazel] Add support for lldb-server (#88989) 2024-04-16 19:17:27 -04:00
Fangrui Song
0665669876 [Sema] Mark alias/ifunc targets used and consider mangled names
https://reviews.llvm.org/D54188 marked "alias" targets as used in C to
fix -Wunused false positives. This patch extends the approach to handle
mangled names to support global scope names in C++ and the
`overloadable` attribute in C.

(Note: we should skip `UsingShadowDecl`, which would trigger an
assertion failure in `ItaniumMangleContextImpl::mangleCXXName`.
See regression test added by commit 1c2afbae9af22b58190c10e3517242d01d89d612.)

In addition, we mark ifunc targets as used to fix #63957 (temporarily
used by xz; ifunc was removed by
689ae24273)

While our approach has false negatives for namespace scope names, the
majority of alias/ifunc C++ uses (global scope with no overloads) are
handled.

Note: The following function with internal linkage but C language
linkage type is mangled in Clang but not in GCC. This inconsistency
makes alias/ifunc difficult to use in C++ with portability (#88593).
```
extern "C" {
static void f0() {}
// GCC: void g0() __attribute__((alias("_ZL2f0v")));
// Clang: void g0() __attribute__((alias("f0")));
}
```

Pull Request: https://github.com/llvm/llvm-project/pull/87130
2024-04-16 11:49:25 -07:00
Mehdi Amini
51b42b7621
Revert "[Sema] Mark alias/ifunc targets used and consider mangled names" (#88919)
Reverts llvm/llvm-project#87130

Bot is broken with clang crash:
https://lab.llvm.org/buildbot/#/builders/272/builds/14063/steps/6/logs/stdio
2024-04-16 17:45:02 +02:00
Benjamin Kramer
ac791888bb [bazel] Add missing dependency for 1c076b43c294c7d29d99dd50f6853b33a5b99789 2024-04-16 15:58:38 +02:00
Fangrui Song
2ac562ab78
[Sema] Mark alias/ifunc targets used and consider mangled names
https://reviews.llvm.org/D54188 marked "alias" targets as used in C to
fix -Wunused false positives. This patch extends the approach to handle
mangled names to support global scope names in C++ and the
`overloadable` attribute in C.

In addition, we mark ifunc targets as used to fix #63957.

While our approach has false negatives for namespace scope names, the
majority of alias/ifunc C++ uses (global scope with no overloads) are
handled.

Note: The following function with internal linkage but C language
linkage type is mangled in Clang but not in GCC. This inconsistency
makes alias/ifunc difficult to use in C++ with portability (#88593).
```
extern "C" {
static void f0() {}
// GCC: void g0() __attribute__((alias("_ZL2f0v")));
// Clang: void g0() __attribute__((alias("f0")));
}
```

Pull Request: https://github.com/llvm/llvm-project/pull/87130
2024-04-15 17:58:39 -07:00
Yijia Gu
52a88d3f5a [mlir] fix llvm:support dependency error 2024-04-15 12:47:47 -07:00
Yijia Gu
4533956848 [mlir] add polynomial dialect in bazel BUILD 2024-04-15 11:46:40 -07:00
Job Henandez Lara
75bbf4dd7c
[libc] Add proxy headers for fenv types. (#88467)
Fixes #88187
2024-04-15 11:45:16 -07:00
Matthias Springer
f8d314f0ee
[mlir][Interfaces][NFC] Add TableGen test op for value bounds tests (#88717)
This commit is a code cleanup. It defines the test ops the are used for
the `ValueBoundsOpInterface` tests in TableGen, along with proper
verifiers.

---------

Co-authored-by: Benjamin Maxwell <benjamin.maxwell@arm.com>
2024-04-15 18:14:18 +02:00
Christian Sigg
2cc0c21049 [clang][bazel] Fix BUILD after f811d7b50957b801788d7b171ddeb25b1fda415a. 2024-04-15 07:39:02 +02:00
Michael Jones
5fb821560a
[libc] add remaining epoll functions, pipe (#84587)
The epoll_wait functions need the rest of the epoll functions (create,
ctl) to be available to actually test them, as well as pipe to create a
usable file descriptor. This patch adds epoll_create, epoll_create1,
epoll_ctl, and pipe. These have tests, and the tests for epoll_wait,
epoll_pwait, and epoll_pwait2 (currently disabled) are updated to use
these newly available functions.
2024-04-11 16:26:49 -07:00
Nick Desaulniers
f626a35086
[libc] Codify header inclusion policy (#87017)
When supporting "overlay" vs "fullbuild" modes, "what ABI are you
using?" becomes a fundamental question to have concrete answers for.
Overlay mode MUST match the ABI of the system being overlayed onto;
fullbuild more flexible (the only system ABI relevant is the OS kernel).

When implementing llvm-libc we generally prefer the include-what-you use
style of avoiding transitive dependencies (since that makes refactoring
headers more painful, and slows down build times). So what header do you
include for any given type or function declaration? For any given
userspace program, the answer is straightforward. But for llvm-libc
which is trying to support multiple ABIs (at least one per
configuration), the answer is perhaps less clear.

This proposal seeks to add one layer of indirection relative to what's
being done today.

It then converts users of sigset_t and struct epoll_event and the epoll
implemenations over to this convention as an example.
2024-04-11 10:11:58 -07:00
Jakub Kuderski
44718311de
[mlir][amdgpu] Remove shared memory optimization pass (#88225)
This implementation has a number of issues and ultimately does not work
on gfx9.
* It does not reduce bank conflicts with wide memory accesses.
* It does not correctly account for when LDS bank conflicts occur on
amdgpu.
* The implementation is too fragile to be used on real-world code. For
example, the code bails out on any `memref.subview` in the root op, even
when the subview is not a user of any of the `memref.alloc` ops.

I do not see how these can be easily fixed, therefore I think it's
better to delete this code.
2024-04-11 11:07:17 -04:00
Jordan Rupprecht
9760872b53 [bazel][libc] Add missing fenv dep for rint test template
For 49561181bdc8698aa28ee2a46d2faa4cf6767bbe.
2024-04-10 00:22:10 +00:00
Jordan Rupprecht
fe5dba3c08 [bazel][libc] Add missing fenv dep for aarch64
For 49561181bdc8698aa28ee2a46d2faa4cf6767bbe.
2024-04-09 20:20:41 +00:00
Job Henandez Lara
49561181bd
[libc] Add proxy header for fenv.h macro constants. #87863 (#87896)
Hello, this addresses #87863.
2024-04-09 12:55:10 -04:00
Jordan Rupprecht
93f0880869 [bazel][clang] Remove gen-clang-*-left-list attributes from tablegen
For both 9391ff8c86007562d40c240ea082b7c0cbf35947 and a30662fc2acdd73ca1a9217716299a4676999fb4.
2024-04-09 15:22:05 +00:00
Jordan Rupprecht
bee3377018 [bazel] Add nobuildkite tags for incompatible targets 2024-04-08 22:21:45 +00:00
lntue
1e6ce5e284
[libc] Clean up unused math_utils.(h|cpp). (#88036) 2024-04-08 16:55:50 -04:00
Christian Sigg
b80e51ce4d [mlir][bazel] Fix BUILD after a2c4b7c8e2740a83f141dcf06cf50359588190b9. 2024-04-08 07:57:54 +02:00
NAKAMURA Takumi
ba5dad35fb [Bazel] Enable LLVM_VERSION_PRINTER_SHOW_BUILD_CONFIG (for #87585) 2024-04-07 11:02:08 +09:00
Guillaume Chatelet
fc7087b7b7
[libc][NFC] Rename uint_test into big_int_test for consistency (#87875) 2024-04-06 19:10:25 +02:00
Benjamin Kramer
f5d7e755b8 [bazel] Fix the build after 27b2d7d4bb790ec1e7430bf18b1bc2f6e0800d0d 2024-04-06 11:45:16 +02:00
Guillaume Chatelet
09efe848cf
[libc][NFC] Rename UInt.h to big_int.h and UInt128.h to uint128.h for consistency (#87808) 2024-04-06 10:39:55 +02:00
lntue
5748ad84e5
[libc] Add proxy header math_macros.h. (#87598)
Context: https://github.com/llvm/llvm-project/pull/87017

- Add proxy header `libc/hdr/math_macros.h` that will:
  - include `<math.h>` in overlay mode,
- include `"include/llvm-libc-macros/math-macros.h"` in full build mode.
- Its corresponding CMake target `libc.hdr.math_macros` will only depend
on `libc.include.math` and `libc.include.llvm-libc-macros.math_macros`
in full build mode.
- Replace all `#include "include/llvm-libc-macros/math-macros.h"` with
`#include "hdr/math_macros.h"`.
- Add dependency to `libc.hdr.math_macros` CMake target when using
`add_fp_unittest`.
- Update the remaining dependency.
- Update bazel overlay: add `libc:hdr_math_macros` target, and replacing
all dependency on `libc:llvm_libc_macros_math_macros` with
`libc:hdr_math_macros`.
2024-04-05 18:21:16 -04:00
aniplcc
8ee6ab7f69
[libc][c23][fenv] implement fesetexcept (#87603)
Closes #87564
2024-04-05 13:52:57 -07:00
Keith Smiley
51a4ab287f
[bazel] Improve libc build on macOS (#86174)
With these changes you can now `bazel build @llvm-project//...` on
macOS, and the targets in libc that don't yet support macOS (or
non-linux) are ignored
2024-04-05 08:37:47 -07:00
Jordan Rupprecht
25afb7768f
[bazel] Add the remaining llvm-driver tools (#87302) 2024-04-05 10:20:47 -05:00
Keith Smiley
134176058f
[bazel] Add support for building orc_rt (#87730) 2024-04-04 18:06:55 -07:00
Keith Smiley
4b077ed58e
[bazel] Add support for building lldb (#87589)
This adds build configuration for building LLDB on macOS and Linux. It
uses a default subset of features that should work out of the box with
macOS + Ubuntu. It is notably missing python support right now, although
some of the scaffolding is there, because of the complexity of linking a
python dylib, especially if you plan to distribute the resulting
liblldb.so.

Most of this build file is pretty simple, one of the unfortunate
patterns I had to use was to split the header and sources cc_library
targets to break circular dependencies.
2024-04-04 15:10:52 -07:00
Chenguang Wang
2cbbbf71a4
[bazel] Add missing dependency for mlir:SCFUtils (#87711)
5aeb604c7c
https://buildkite.com/llvm-project/upstream-bazel/builds/93859
2024-04-04 14:29:29 -07:00
Michael Jones
5264c22ef1
[libc] Temporary math macros fix (#87681)
Downstream's having some issues due to math-macros.h issues. These will
be fixed properly soon.

See https://github.com/llvm/llvm-project/issues/87683 for tracking this
tech debt.
2024-04-04 14:28:56 -07:00
lntue
62740d87bc
[libc][bazel][math] Add float128 math functions and their smoke tests to bazel layout. (#87645) 2024-04-04 12:15:32 -04:00
Guillaume Chatelet
71c3f5d617
[reland][libc] Refactor BigInt (#87613)
This is a reland of #86137 with a fix for platforms / compiler that do
not support trivially constructible int128 types.
2024-04-04 11:41:27 +02:00
Guillaume Chatelet
12735916bd
Revert "[libc] Refactor BigInt" (#87612)
Reverts llvm/llvm-project#86137

Some aarch64 compilers seem to consider that `uint128_t` is not
`is_trivially_constructible` which prevents `bit_cast`-ing.
2024-04-04 11:10:30 +02:00
Guillaume Chatelet
a2306b65d2
[libc] Refactor BigInt (#86137)
This patch moves most of the multiprecision logic to the `multiword`
namespace and simplifies some logic in `BigInt`. It also fully
implements the mask and count functions and increases test coverage.

`math_extras.h` is also reworked to make it more concise.
2024-04-04 10:27:08 +02:00
Haojian Wu
d0dcf06ab8 [bazel] Port for e05c1b46d0d3739cc48ad912dbe6e9affce05927. 2024-04-03 12:33:30 +02:00
Haojian Wu
0b13e2c823 [bazel] Another format fix for libc_build_rules.bzl, NFC 2024-04-02 13:45:11 +02:00
Haojian Wu
198c3eecee [bazel] Fix the format of libc_build_rules.bzl 2024-04-02 13:21:02 +02:00
Abhinav Gunjal
dd5797505e
lit_test : check if there is already a deps key in kwargs (#87290)
This change checks if there is already a `deps` key in `kwargs` and
concatenate it to avoid multiple values for `deps` key argument.

background:
https://github.com/llvm/llvm-project/pull/87022 recently added explicit
`deps` to the lit_test. This is causing StableHLO bazel build failures
at
https://github.com/openxla/stablehlo/actions/runs/8511888283/job/23312383380?pr=2147

Tested: local build run is successful
2024-04-01 19:36:09 -05:00
Caslyn Tonelli
d83271b093
[libc] Include algorithm.h to parser.h (#87125)
This includes algorithm.h directly to provide the definition for
`cpp:max` in parser.h. This will define `max(...)` in the libc namespace
for build systems that pull in parser.h explicitly.
2024-04-01 09:51:38 -07:00
Schrodinger ZHU Yifan
a8b0ecd260
[libc] enable stack protectors and frame pointers on default (#86288) 2024-03-29 20:17:11 -04:00
Jordan Rupprecht
c09b6fac12
[bazel] Add support for LLVM_TOOL_LLVM_DRIVER_BUILD (#86879)
This adds the bazel equivalent of the `llvm` binary produced by
`LLVM_TOOL_LLVM_DRIVER_BUILD` in cmake. For the initial commit, this
only includes `llvm-ar`, `llvm-nm`, and `llvm-size`. The rest are
trivial to add in a followup commit, following the same pattern as here.

By default it will include everything that supports the llvm-driver
model, but it can be reduced to only build a subset, e.g. this will
build only nm and size:

```
$ bazel build \
    --@llvm-project//llvm:driver-tools=llvm-nm,llvm-size \
    @llvm-project//llvm:llvm
```
2024-03-29 11:20:09 -05:00
Jordan Rupprecht
85a5f64c70 [bazel] Add missing deps after a4de589d117a4fd52554da3c61ae6eb26c90a0c8 2024-03-29 16:14:09 +00:00
Christian Sigg
e1873d9972
[mlir][bazel] Remove unsed BUILD dependencies. (#87038)
This is the second attempt of 32fcfcdc4cc1d68116438f761897953894d65fb1,
which had to be reverted.

This should be good to go now, after a number of cleanups to not expose
headers from multiple targets:

- 6e58efac16958ccb99060f4329b48737be7d8d36
- f1dff836593d4601e3ad78117df1d980d284bb9c
- 89ef3130cf16f1965475396ad3a50760558cc08a
- eb70b485a91361eee83d3744d1bd3e4c3a23692f
- 83e5a1239242d64110e3dfa96ed3889170ab96b2
- fce046ca5b7edb4c0d37a6eb580154ccb7dda966
2024-03-29 08:20:19 +01:00