487839 Commits

Author SHA1 Message Date
cor3ntin
ad1a65fcac
[Clang][C++26] Implement Pack Indexing (P2662R3). (#72644)
Implements https://isocpp.org/files/papers/P2662R3.pdf

The feature is exposed as an extension in older language modes.
Mangling is not yet supported and that is something we will have to do before release.
2024-01-27 10:23:38 +01:00
Aiden Grossman
1f13203029 [MLGO] Bump mlgo-utils version to 19.0.0
This patch bumps the mlgo-utils version to 19.0.0 as 18.0.0 got branched
recently.
2024-01-27 00:24:28 -08:00
Timm Bäder
ce75cbeda2 [clang][Interp][NFC] Don't unnecessarily use std::optional
classifyComplexElementType() doesn't return a std::optional anymore.
2024-01-27 09:06:04 +01:00
Timm Bäder
499507fdec [clang][Interp][NFC] Remove unused function 2024-01-27 09:06:03 +01:00
Kazu Hirata
fe35d72d8e [Driver] Use StringRef::consume_back (NFC) 2024-01-26 23:46:29 -08:00
Kazu Hirata
f2e69d2e85 [CodeGen] Use a range-based for loop (NFC) 2024-01-26 23:46:27 -08:00
Kazu Hirata
ac0b6016af [Analysis] Use llvm::succ_empty and llvm::successors (NFC) 2024-01-26 23:46:25 -08:00
Kazu Hirata
2b00d449d2 [clang-tools-extra] Use SmallString::operator std::string (NFC) 2024-01-26 23:46:24 -08:00
Younan Zhang
6e6c506f3c
[Concepts] Traverse the instantiation chain for parameter injection inside a constraint scope (#79568)
We preserve the trailing requires-expression during the lambda
expression transformation. In order to get those referenced parameters
inside a requires-expression properly resolved to the instantiated
decls, we intended to inject these 'original' `ParmVarDecls` to the
current instantiaion scope, at `Sema::SetupConstraintScope`.

The previous approach seems to overlook nested instantiation chains,
leading to the crash within a nested lambda followed by a requires
clause.

This fixes https://github.com/llvm/llvm-project/issues/73418.
2024-01-27 15:42:52 +08:00
Sam James
e8f882f83a
[sanitizer] Handle Gentoo's libstdc++ path
On Gentoo, libc++ is indeed in /usr/include/c++/*, but libstdc++ is at
e.g. /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14.

Use '/include/g++' as it should be unique enough. Note that the omission of
a trailing slash is intentional to match g++-*.

See https://github.com/llvm/llvm-project/pull/78534#issuecomment-1904145839.

Reviewed by: mgorny
Closes: https://github.com/llvm/llvm-project/pull/79264

Signed-off-by: Sam James <sam@gentoo.org>
2024-01-27 06:56:12 +00:00
NAKAMURA Takumi
faef68bca8 Revert "[Coverage] Map regions from system headers (#76950)"
See #78920.

This reverts commit ce3e767ac5ea1a1d1a166e88c152e2125ec7662b.
2024-01-27 15:11:37 +09:00
Jeremy Kun
5585ddd90b
[bazel]: de-alias pybind11 headers target (#79676)
In trying to set up python headers in an out-of-tree bazel MLIR project,
I encountered the `pybind11_bazel` project, and found that the
`@python_runtime` target used here is not defined by it.

Instead, it seems that `@python_runtime` is an alias used in some
projects like Tensorflow (see

322936ffdd/third_party/python_runtime/BUILD (L7-L7)),
where it is aliased to `@local_config_python`. In fact,
`@local_config_python` is defined by `@pybind11_bazel`, and so it seems
that this layer of indirection no longer serves a purpose, and instead
just prevents anyone who doesn't clone Tensorflow's config from using
the python bindings here.

This commit updates the dependent targets to their canonical de-aliased
equivalents, and I suspect this will not even break any downstream users
since the new target is defined in those projects already.

Without this change, running, for example

```
bazel build @llvm-project//mlir:MLIRBindingsPythonCore
```

gives the error

```
no such package '@python_runtime//': The repository '@python_runtime'
could not be resolved: Repository '@python_runtime' is not defined and
referenced by '@llvm-project//mlir:MLIRBindingsPythonCore'
```

Minimal reproduction in https://github.com/j2kun/test_mlir_bazel_pybind,
which, when pointing to a local LLVM repository that has this change
(see `bazel/import_llvm.bzl` in that repository), results in that build
succeeding.

Hat tip to Maksim Levental for going on an hours-long investigation with
me to figure this out.
2024-01-26 23:27:21 -06:00
Jonas Devlieghere
7595287303
[lldb] Remove obsolete signBinary helper (#79656)
On Darwin, the Makefile already (ad-hoc) signs everything it builds.
There's also no need to use lldb_codesign for this.
2024-01-26 20:37:44 -08:00
Mikhail Gudim
701ec45f2f
[InstCombine] Fix a comment. (#79422) 2024-01-26 23:10:19 -05:00
Kai Sasaki
69f99cd20f
[mlir][complex] Prevent underflow in complex.abs (#76316) 2024-01-27 12:50:06 +09:00
Matt Arsenault
e44d3b3e50
ValueTracking: Merge fcmpImpliesClass and fcmpToClassTest (#66522)
Rushing this one out before vacation starts. Refactoring on top of
#66505
2024-01-27 08:44:36 +05:30
Owen Pan
f826f55b2a
[clang-format] Fix a bug in AnnotatingParser::rParenEndsCast() (#79549)
Fixes #78965.
2024-01-26 18:32:03 -08:00
Ben Shi
ff05c3087b
[clang][analyzer] Improve modeling of 'popen' and 'pclose' in StdLibraryFunctionsChecker (#78895) 2024-01-27 09:46:05 +08:00
Kazu Hirata
c9790f8f73
[IR] Use SmallDenseSet (NFC) (#79556)
The use of SmallDenseSet saves 0.39% of heap allocations during the
compilation of a large preprocessed file, namely X86ISelLowering.cpp,
for the X86 target.  During the experiment, WL.size() was 2 or less
99.9% of the time.  The inline size of 4 should accommodate up to 2
entries at the 3/4 occupancy rate.
2024-01-26 17:18:42 -08:00
Aiden Grossman
c1a155bf78 [llvm-exegesis] Refactor BenchmarkMeasure instantiation in tests
This patch refactors the instantiation of BenchmarkMeasure within all
the unit tests to use BenchmarkMeasure::Create rather than through
direct struct instantialization. This allows us to change what values
are stored in BenchmarkMeasure without getting compiler warnings on
every instantiation in the unit tests, and is also just a cleanup in
general as the Create function didn't seem to exist at the time the unit
tests were originally written.
2024-01-26 17:00:57 -08:00
Schrodinger ZHU Yifan
2e1e27c7c3
[libc] adjust linux's mman.h definitions (#79652)
Use definitions from `<linux/mman.h>` to dispatch arch-specific flag
values.
For example, `MCL_CURRENT/MCL_FUTURE/MCL_ONFAULT` are different on
different architectures.
2024-01-26 19:29:28 -05:00
Cyndy Ishida
d9a9872ec4
[TextAPI] Rename SymbolKind to EncodeKind (#79622)
A distinction that doesn't _usually_ matter is that the
MachO::SymbolKind is really a mapping of entries in TBD files not
symbols. To better understand this, rename the enum so it represents an
encoding mapped to TBDs as opposed to symbols alone.

For example, it can be a bit confusing that "GlobalSymbol" is a enum
value when all of those values can represent a GlobalSymbol.
2024-01-26 16:12:50 -08:00
Min-Yih Hsu
3bece3d72d
[Exegesis] Do not assume the size and layout of the assembled snippet (#79636)
Currently llvm-exegesis assumes that there will only be 3 symbols in the
snippet object, in which the benchmarking function 'foo' is always the
last symbol.

These assumptions do not hold for object file formats of other targets
we support downstream. I think it would be more ideal to generalize this
part of the logics into a simple search on all symbols, as proposed by
this patch.
2024-01-26 15:47:26 -08:00
Ziqing Luo
9816863dd4
[-Wunsafe-buffer-usage] Add a new warning for uses of std::span two-parameter constructors (#77148)
Constructing `std::span` objects with the two parameter constructors
could introduce mismatched bounds information, which defeats the
purpose of using `std::span`.  Therefore, we warn every use of such
constructors.

rdar://115817781
2024-01-26 15:43:46 -08:00
Jonas Devlieghere
80bfac4327
[lldb] Fix progress reporting for SymbolLocatorDebugSymbols (#79624)
This fixes two issues related to the DebugSymbols symbol locator:

1. Only the default symbol locator plugin reports progress. On Darwin,
which uses the DebugSymbols framework we need to report the same
progress form the corresponding SymbolLocator plugin.

2. Forceful dSYM lookups, for example when using `add-dsym`, use a
different code path that currently does not report progress, which is
confusing. Here the progress event can be more specific and specify its
downloading a symbol file rather than just locating it as we'll always
shell out to dsymForUUID or its equivalent.

rdar://121629777
2024-01-26 15:18:43 -08:00
Jonas Devlieghere
33860b2f61
[lldb] Streamline ConstString -> std::string conversion (NFC) (#79649)
Make it easier to go from a ConstString to a std::string without having
to go through a C-String or a llvm::StringRef. I made the conversion
operator explicit as this is a relatively expensive operations (compared
to a StringRef or string_view).
2024-01-26 15:04:11 -08:00
Evgenii Kudriashov
cfd91199ca
[X86] Skip unused VRegs traverse (#78229)
Almost all loops with getNumVirtRegs skip unused registers by means
of reg_nodbg_empty or empty live interval. Except for these two cases
that are revealed by GlobalISel since it can skip RegClass assignment
for unused registers.

Closes #64452, closes #71926
2024-01-26 23:57:14 +01:00
Dave Lee
074630e8af
[lldb] Remove unnecessary suffix from libc++ type name patterns (NFC) (#79644)
The `(( )?&)?` appears to match types which are references. However lldb
can load the
correct data formatters without having to pattern match against a `&`
suffix.

The suffix may have been needed at one point, but it's no longer needed.
2024-01-26 14:28:39 -08:00
Alex MacLean
1d5820aafe
[NVPTX] improve identifier renaming for PTX (#79459)
Update `NVPTXAssignValidGlobalNames` to convert all characters which are
illegal in PTX identifiers to `_$_`. ([PTX ISA: 4.4
Identifiers](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#identifiers)).
2024-01-26 13:49:00 -08:00
Aiden Grossman
2b25e40a88 [MLGO] Switch test to invoke pytype through python
Currently this test is assuming that ~/.local/bin (or wherever the
Python binaries are installed to) is on the path. This is not a valid
assumption in most cases, and it also means we might not find the
version of pytype associated with the Python interpreter being used to
test LLVM, which could create some inconsistencies. This patch fixes
that by invoking pytype through the Python interpreter passed to lit.
2024-01-26 21:46:21 +00:00
Nikita Popov
07a1925b8b Revert "Refactor recomputeLiveIns to operate on whole CFG (#79498)"
This reverts commit 59bf60519fc30d9d36c86abd83093b068f6b1e4b.

Introduces a major compile-time regression.
2024-01-26 22:33:17 +01:00
Caslyn Tonelli
6f97e6bcf7
[fuchsia][libc] Include missing macro definitions (#79639)
PR 79573 introduced `ASSERT_ERRNO_*` macros for use in libc tests.
Introduce these macro definitions to FuchsiaTest.h for string tests to
compile on Fuchsia.
2024-01-26 13:20:57 -08:00
Benjamin Kramer
3fa14233c4
[libc++] Annotate generic_category/system_category as const (#78052)
This lets the compiler eliminate unused/duplicate calls to it.
2024-01-26 22:08:36 +01:00
Nikolas Klauser
82afd9b19a
[libc++] Use GitHub-provided runners for the windows CI (#79326)
Co-authored-by: Martin Storsjö <martin@martin.st>
2024-01-26 21:53:11 +01:00
Aiden Grossman
e4afffbe8c
[MLGO] Add pytype test (#79558)
This patch adds a pytype test to the mlgo-utils lit test suite to
prevent regressions in typing while we wait to setup precommit CI for
this specific project.

This is somewhat hacky, but is a temporary fix and will be pulled out
soonish. It also should only impact the ML buildbots as they are the
only ones that should have `pytype` installed.
2024-01-26 12:24:15 -08:00
Louis Dionne
5545406112
[libc++][NFC] Improve variable naming in __libcpp_thread_poll_with_backoff (#79638)
I noticed that the parameter names used in that function were not very
descriptive during a recent review.
2024-01-26 14:43:51 -05:00
Craig Topper
55c6d91034
[InstCombine] Preserve nuw/nsw/exact flags when transforming (C shift (A add nuw C1)) --> ((C shift C1) shift A). (#79490)
If we weren't shifting out any non-zero bits or changing the sign before the transform, we
shouldn't be after.

Alive2: https://alive2.llvm.org/ce/z/mB-rWz
2024-01-26 11:33:53 -08:00
Tom Stellard
d2c8167345
[workflows] Use a custom token for creating backport PRs (#79501)
The CI tests don't get triggered if a PR is created by the builtin
github token, so we need to use a custom token when creating a PR.
2024-01-26 11:25:53 -08:00
Oskar Wirga
59bf60519f
Refactor recomputeLiveIns to operate on whole CFG (#79498)
Currently, the way that recomputeLiveIns works is that it will recompute
the livein registers for that MachineBasicBlock but it matters what
order you call recomputeLiveIn which can result in incorrect register
allocations down the line.

This PR fixes that by simply recomputing the liveins for the entire CFG
until convergence is achieved. This makes it harder to introduce subtle
bugs which alter liveness.
2024-01-26 11:25:36 -08:00
Ziqing Luo
2a06850701
[-Wcompletion-handler] Fix a non-termination issue (#78380)
The Called-Once dataflow analysis could never terminate as a
consequence of non-monotonic update on states.  States of kind Escape
can override states leading to non-monotonic update.

This fix disallows the `Escape` state to override the `Reported`
state.

rdar://119671856
2024-01-26 11:23:15 -08:00
Nour1248
6c74d8083b
[clangd] fix clang-tidy warning (llvm-qualified-auto) (#79617) 2024-01-26 14:21:07 -05:00
gulfemsavrun
59f05239db
[libc++] Add clang-19 to failing tests on Windows (#79619)
After trunk is bumped to version 19, some libc++ tests started failing
on Windows. This patch adds clang-19 condition to XFAIL to fix the
issue.
2024-01-26 13:49:39 -05:00
Fangrui Song
26cc651f1b
[ELF] Improve comment of InputSection::file and update getFile. NFC (#79550)
Clarify a comment after #78944.

All uses of `getFile()` assert `file` is non-null. `getFile` is not used
with a
synthetic section. Replace `cast_or_null` with `cast`.
2024-01-26 10:43:02 -08:00
Alex Langford
02d3a799e7
[lldb][NFCI] Remove EventData* parameter from BroadcastEventIfUnique (#79045)
Instead of passing the data to BroadcastEventIfUnique to create an Event
object on the behalf of the caller, the caller can create the Event
up-front.
2024-01-26 10:40:33 -08:00
Adhemerval Zanella
a58c62fa82
[X86] Do not end 'note.gnu.property' section with -fcf-protection (#79360)
The glibc now adds the required minimum ISA level for libc-nonshared.a
(linked on all programs) and this is done with an inline asm along with
.note.gnu.property and .pushsection/.popsection. However, the x86
backend always ends the 'note.gnu.property' section when building with
-fcf-protection, leading to assert failure:

llvm/llvm-project-git/llvm/lib/MC/MCStreamer.cpp:1251: virtual void
llvm::MCStreamer::switchSection(llvm::MCSection*, const llvm::MCExpr*):
Assertion `!Section->hasEnded() && "Section already ended"' failed.

[1]
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/isa-level.c;h=3f1b269848a52f994275bab6f60dded3ded6b144;hb=HEAD
2024-01-26 10:33:47 -08:00
Eli Friedman
bee1557ffc [NFC][AArch64] Fix indentation. 2024-01-26 10:26:19 -08:00
Alex Langford
176d07d360
[lldb][NFCI] Constrain EventDataBytes creation (#79508)
There are 3 ways to create an EventDataBytes object: (const char *),
(llvm::StringRef), and (const void *, size_t len). All of these cases
can be handled under `llvm::StringRef`. Additionally, this allows us to
remove the otherwise unused `SetBytes`, `SwapBytes`, and
`SetBytesFromCString` methods.
2024-01-26 10:20:52 -08:00
Alex Langford
5f22d3356c
[lldb][NFCI] Change BreakpointIDList::FindBreakpointID to BreakpointIDList::Contains (#79517)
`FindBreakpointID` take a BreakpointID and a pointer to a size_t (so you
can get position information). It returns a bool to indicate whether the
id was found in the list or not.

There are 2 callers of this currently and neither one actually uses the
position information, so I removed it. After that, I renamed it to
Contains to more accurately reflect the intent. Additionally, I changed
the argument type from a reference to a value (because BreakpointID is
just a wrapper around 2 integers, copies are cheap).
2024-01-26 10:19:03 -08:00
David Green
7f518ee9ea
[DAG] Add a one-use check to concat -> scalar_to_vector fold. (#79510)
Without this we can end up with multiple copies from gpr->fpr.
2024-01-26 18:17:17 +00:00
Amy Kwan
d5fe1bd081
[AIX][TLS] Disallow the use of -maix-small-local-exec-tls and -fno-data-sections (#79252)
This patch disallows the use of the -maix-small-local-exec-tls and
-fno-data-sections options within clang, and also disallows the use of
the aix-small-local-exec-tls attribute with the -data-sections=false
option in llc.

This is because having data sections off when using the
aix-small-local-exec-tls feature is not ideal for performance. As the
small-local-exec-tls region is a limited resource, this space should not
used for variables that may be replaced.

Note, that on AIX, data sections is turned on by default, so this patch
makes it so that a diagnostic is emitted when users explicitly turn off
data sections while using the aix-small-local-exec-tls feature.
2024-01-26 12:39:25 -05:00