Commit Graph

473788 Commits

Author SHA1 Message Date
aeubanks
a07d4c0365
[lld/ELF,gold] Remove transitionary opaque pointer flags (#65529)
This was only useful during the transition when mixing
non-opaque-pointer and opaque-pointer IR,
now everything uses opaque pointers.
2023-09-06 15:07:37 -07:00
Walter Erquinigo
01c0a6a0a4
[lldb-vscode] Fix a GetChildAtIndex call (#65537)
We were invoking GetChildAtIndex(0) without checking the number of
children.
This was not crashing but was showing some warnings in python
formatters.
2023-09-06 17:49:12 -04:00
Corentin Jabot
508ad37648 [Clang][NFC] Fix sphinx documentation 2023-09-06 23:23:19 +02:00
Corentin Jabot
3eb67d28de [Clang] Handle non-ASCII after line splicing
int a\
ス;

Failed to be parsed as a valid identifier.

Fixes #65156

Reviewed By: tahonermann

Differential Revision: https://reviews.llvm.org/D159345
2023-09-06 23:20:00 +02:00
Walter Erquinigo
89a81ec205
[lldb-vscode] Display a more descriptive summary for containers and pointers (#65514)
We've been displaying types and addresses for containers, but that's not
very useful information. A better approach is to compose the summary of
containers with the summary of a few of its children.

Not only that, we can dereference simple pointers and references to get
the summary of the pointer variable, which is also better than just
showing an anddress.

And in the rare case where the user wants to inspect the raw address,
they can always use the debug console for that.

For the record, this is very similar to what the CodeLLDB extension
does, and it seems to give a better experience.

An example of the new output:
<img width="494" alt="Screenshot 2023-09-06 at 2 24 27 PM"
src="https://github.com/llvm/llvm-project/assets/1613874/588659b8-421a-4865-8d67-ce4b6182c4f9">

And this is the 
<img width="476" alt="Screenshot 2023-09-06 at 2 46 30 PM"
src="https://github.com/llvm/llvm-project/assets/1613874/5768a52e-a773-449d-9aab-1b2fb2a98035">
old output:
2023-09-06 17:13:27 -04:00
Daniel Hoekwater
776e3b0527 [clang] Add clang support for Machine Function Splitting on AArch64
On x86 targets, -fsplit-machine-functions enables splitting of machine
functions using profile information. This patch rolls out the flag for
AArch64 targets.

Depends on D158647

Differential Revision: https://reviews.llvm.org/D157157
2023-09-06 20:59:20 +00:00
Alexey Bataev
25fd5e63f8 [SLP][NFC]Update tests checks, NFC. 2023-09-06 13:57:49 -07:00
Razvan Lupusoru
61278ec348
[openacc][openmp] Add dialect representation for acc atomic operations (#65493)
The OpenACC standard specifies an `atomic` construct in section 2.12 (of
3.3 spec), used to ensure that a specific location is accessed or
updated atomically. Four different clauses are allowed: `read`, `write`,
`update`, or `capture`. If no clause appears, it is as if `update` is
used.

The OpenMP specification defines the same clauses for `omp atomic`. The
types of expression and the clauses in the OpenACC spec match the OpenMP
spec exactly. The main difference is that the OpenMP specification is a
superset - it includes clauses for `hint` and `memory order`. It also
allows conditional expression statements. But otherwise, the expression
definition matches.

Thus, for OpenACC, we refactor and reuse the OpenMP implementation as
follows:
* The atomic operations are duplicated in OpenACC dialect. This is
preferable so that each language's semantics are precisely represented
even if specs have divergence.
* However, since semantics overlap, a common interface between the
atomic operations is being added. The semantics for the interfaces are
not generic enough to be used outside of OpenACC and OpenMP, and thus
new folders were added to hold common pieces of the two dialects.
* The atomic interfaces define common accessors (such as getting `x` or
`v`) which match the OpenMP and OpenACC specs. It also adds common
verifiers intended to be called by each dialect's operation verifier.
* The OpenMP write operation was updated to use `x` and `expr` to be
consistent with its other operations (that use naming based on spec).

The frontend lowering necessary to generate the dialect can also be
reused. This will be done in a follow up change.
2023-09-06 13:54:39 -07:00
Thomas
24c5f18cf5
[NVPTX][NFC] Explicitly specify the matching type for Int32reg (#65527)
NFC changes to explicitly specify the type we are matching when creating
Int32 reg. This will allow use to have multiple types mapping those
register without causing ambigous matching.
2023-09-06 13:50:21 -07:00
Arthur Eubanks
b41e5ce1cc [llvm-c-test] Remove obsolete opaque pointer test
This code path doesn't exist anymore.
2023-09-06 13:48:24 -07:00
Daniel Hoekwater
866ae69cfa [AArch64] [BranchRelaxation] Optimize for hot code size in AArch64 branch relaxation
On AArch64, it is safe to let the linker handle relaxation of
unconditional branches; in most cases, the destination is within range,
and the linker doesn't need to do anything. If the linker does insert
fixup code, it clobbers the x16 inter-procedural register, so x16 must
be available across the branch before linking. If x16 isn't available,
but some other register is, we can relax the branch either by spilling
x16 OR using the free register for a manually-inserted indirect branch.

This patch builds on D145211. While that patch is for correctness, this
one is for performance of the common case. As noted in
https://reviews.llvm.org/D145211#4537173, we can trust the linker to
relax cross-section unconditional branches across which x16 is
available.

Programs that use machine function splitting care most about the
performance of hot code at the expense of the performance of cold code,
so we prioritize minimizing hot code size.

Here's a breakdown of the cases:

   Hot -> Cold [x16 is free across the branch]
     Do nothing; let the linker relax the branch.

   Cold -> Hot [x16 is free across the branch]
     Do nothing; let the linker relax the branch.

   Hot -> Cold [x16 used across the branch, but there is a free register]
     Spill x16; let the linker relax the branch.

     Spilling requires fewer instructions than manually inserting an
     indirect branch.

   Cold -> Hot [x16 used across the branch, but there is a free register]
     Manually insert an indirect branch.

     Spilling would require adding a restore block in the hot section.

   Hot -> Cold [No free regs]
     Spill x16; let the linker relax the branch.

   Cold -> Hot [No free regs]
     Spill x16 and put the restore block at the end of the hot function; let the linker relax the branch.
     Ex:
       [Hot section]
       func.hot:
         ... hot code...
       func.restore:
         ... restore x16 ...
         B func.hot

       [Cold section]
         func.cold:
         ... spill x16 ...
         B func.restore

     Putting the restore block at the end of the function instead of
     just before the destination increases the cost of executing the
     store, but it avoids putting cold code in the middle of hot code.
     Since the restore is very rarely taken, this is a worthwhile
     tradeoff.

Differential Revision: https://reviews.llvm.org/D156767
2023-09-06 20:44:40 +00:00
Dave Lee
a4b82f7f9b
[lldb] Allow lldbDataFormatters.py to be used by other names (NFC) (#65528)
Instead of hard-coding the name `lldbDataFormatters`, use `__name__` to
get the module's name.

This allows the formatters to be loaded from any path, with any
filename.
2023-09-06 13:39:45 -07:00
Shilei Tian
99d67fb9aa
[OpenMP] Align up the size when calling aligned_alloc (#65525)
Based on https://en.cppreference.com/w/c/memory/aligned_alloc, the
`size` is supposed
to be a multiple of `alignment`, and it is implementation defined
behavior if not.
We have a non-conformant use in `kmp_barrier.h` when allocating
distribute barrier.
The size of the barrier is 576 and the alignment is `4*CACHE_LINE`,
which is 256
on most systems. Apparently it works perfectly fine for Linux and
Intel-based Mac,
but not for Apple Silicon based Mac.

Fix #63194.
2023-09-06 16:28:07 -04:00
Jan Svoboda
0a9611fd8d Revert "[clang] NFCI: Adopt SourceManager::getFileEntryRefForID()"
This reverts commit ddbcc10b9e.

The 'clang-tidy/checkers/misc/header-include-cycle.cpp' test started failing on Windows: https://lab.llvm.org/buildbot/#/builders/216/builds/26855.
2023-09-06 13:23:23 -07:00
Alexey Bataev
8d933ea5ac [SLP][NFC]Use SmallDensetSet for lookup instead of ArrayRef, NFC. 2023-09-06 13:17:30 -07:00
Florian Mayer
42a1d16179 Revert "[AMDGPU] Cope with SelectionDAG::UpdateNodeOperands returning a different SDNode (#65340)"
This reverts commit 11171d81ae.

Broke ASAN bot.
2023-09-06 13:16:55 -07:00
Aaron Ballman
3b4c150459 Fix the Clang sphinx bot
This addresses issues found by:
https://lab.llvm.org/buildbot/#/builders/92/builds/50285
2023-09-06 16:11:23 -04:00
Corentin Jabot
eaf725bc93 [Clang] Add captures to the instantiation scope of lambda call operators
Like concepts checking, a trailing return type of a lambda
in a dependent context may refer to captures in which case
they may need to be rebuilt, so the map of local decl
should include captures.

This patch reveal a pre-existing issue.
`this` is always recomputed by TreeTransform.

`*this` (like all captures) only become `const`
after the parameter list.

However, if try to recompute the value of `this` (in a parameter)
during template instantiation while determining the type of the call operator,
we will determine  it to be const (unless the lambda is mutable).

There is no good way to know at that point that we are in a parameter
or not, the easiest/best solution is to transform the type of this.

Note that doing so break a handful of HLSL tests.
So this is a prototype at this point.

Fixes #65067
Fixes #63675

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D159126
2023-09-06 21:59:45 +02:00
Jonas Devlieghere
c47321524c
[llvm] Adopt WithMarkup in the MIPS backend (#65384)
Adopt the new markup overload, introduced in 77d1032516, in the MIPS
backend.
2023-09-06 12:51:34 -07:00
Joseph Huber
cec1de3f35
[libc] Fix vendor implemented math functions not being exported (#65510)
Summary:
A previous introduced a new object type for the GPU functions
implemented by an external vendor library. This was done so they we did
not attempt to run tests on functions which we did not implement,
however this accidentally stopped them from being included in the actual
output. Fix this by checking the new type as well.

The long term goal is to remove this vendor handling altogether, but is
being used as a short-term solution to provide a math library on the
GPU which currently lacks one.
2023-09-06 14:43:23 -05:00
Aaron Ballman
ec70337d13 Correct minimum Visual Studio version requirements
We bumped the requirements to MSVC 2019 16.7 in 2022:
https://discourse.llvm.org/t/rfc-increasing-the-gcc-and-clang-requirements-to-support-c-17-in-llvm/59983
but missed updating these docs.
2023-09-06 15:18:55 -04:00
Jan Svoboda
65331da003 Partially revert "[clang] NFCI: Adopt SourceManager::getFileEntryRefForID()"
This commit partially reverts ddbcc10b to fix `clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-run-with-database.cpp`.
2023-09-06 11:59:40 -07:00
Mircea Trofin
24a08592bc
[nfc][thinlto] Factor common state for computeImportForModule (#65427)
Added a class to hold such common state. The goal is to both reduce the argument list of other utilities used by `computeImportForModule` (which will be brought as members in a subsequent patch), and to make it easy to extend such state later.
2023-09-06 11:57:15 -07:00
Daniil Dudkin
d4fa0884c3
[mlir][arith] Improve Lowering of maxf/minf ops (#65213)
This patch is part of a larger initiative aimed at fixing floating-point
`max` and `min` operations in MLIR:
https://discourse.llvm.org/t/rfc-fix-floating-point-max-and-min-operations-in-mlir/72671.

This patch addresses task 1.1 from the plan. It involves modifying the
lowering process for `arith.minf` and `arith.maxf` operations.
Specifically, the change replaces the usage of `llvm.minnum` and
`llvm.maxnum` with `llvm.minimum` and `llvm.maximum`, respectively. This
adjustment is necessary because the `m**num` intrinsics are not suitable
for the mentioned MLIR operations due to semantic discrepancies in
handling NaNs, positive and negative floating-point zeros.
2023-09-06 21:56:08 +03:00
Mark de Wever
0735a6e3fa [NFC][libc++] Adds spaces in the CMake output.
The line continuations didn't have the proper spaces.
2023-09-06 20:54:43 +02:00
Mark de Wever
f78f93bc9f [libc++][chrono] Adds tzdb_list implementation.
This is the first step to implement time zone support in libc++. This
adds the complete tzdb_list class and a minimal tzdb class. The tzdb
class only contains the version, which is used by reload_tzdb.

Next to these classes it contains documentation and build system support
needed for time zone support. The code depends on the IANA Time Zone
Database, which should be available on the platform used or provided by
the libc++ vendors.

The code is labeled as experimental since there will be ABI breaks
during development; the tzdb class needs to have the standard headers.

Implements parts of:
- P0355 Extending <chrono> to Calendars and Time Zones

Addresses:
- LWG3319 Properly reference specification of IANA time zone database

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D154282
2023-09-06 20:48:07 +02:00
Joseph Huber
460840c09d
[OpenMP] Support 'omp_get_num_procs' on the device (#65501)
Summary:
The `omp_get_num_procs()` function should return the amount of
parallelism availible. On the GPU, this was not defined. We have elected
to define this function as the maximum amount of wavefronts / warps that
can be simultaneously resident on the device. For AMDGPU this is the
number of CUs multiplied byth CU's per wave. For NVPTX this is the
maximum threads per SM divided by the warp size and multiplied by the
number of SMs.
2023-09-06 13:45:05 -05:00
Mikhail R. Gadelha
6f387135ae
[libc] Fix failing mktime test case in 32-bit systems (#65390)
Previously, these tests expected that calling mktime with a struct tm
that caused overlow to succeed with return -1
(TimeConstants::OUT_OF_RANGE_RETURN_VALUE), however, the Succeeds call
expects the errno to be zero (no failure).

This patch fixes the expected calls to fail with EOVERFLOW. These tests
are only enabled to 32-bit systems, and are probably not being tested on
the arm32 buildbot, that's why this was not a problem before.
2023-09-06 14:29:31 -04:00
Mikhail R. Gadelha
10fb71bdff
[libc] Fix test passing negative value in timespec passed to nanosleep (#65346)
This test was setting tv_nsec to a negative value, which as per the
standard this is an EINVAL:

The value in the tv_nsec field was not in the range [0, 999999999] or
tv_sec was negative.

https://man7.org/linux/man-pages/man2/nanosleep.2.html
2023-09-06 14:28:31 -04:00
Mikhail R. Gadelha
ce3bade0cf
[libc] Fix call to clock_gettime (#65166)
The calls were missing the __llvm_libc:: namespace, which can allow the
test case to be linked to glibc's clock_gettime.
2023-09-06 14:26:20 -04:00
Daniel Paoliello
a8138c3d2f [lldb] Fix inline_sites.test
Fixes `lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test` to use the correct line number now that f2f36c9b29 is causing the inline call site info to be taken into account.
2023-09-06 11:20:39 -07:00
Jan Svoboda
e75ecaa190 [clang] NFCI: Use FileEntryRef in CoverageMappingGen
This removes some uses of the deprecated `FileEntry::getName()`.
2023-09-06 11:15:51 -07:00
kazutakahirata
06d2db25aa
[ADT] Fix a comment typo (#65497) 2023-09-06 11:10:56 -07:00
Piotr Zegar
93f9f63b2d [clang-tidy][NFC] Update documentation for fuchsia-statically-constructed-objects
Fix compile errors in example provided in
documentation.

Fixes: #65118
2023-09-06 18:06:59 +00:00
Jakub Kuderski
2e3d694018
[ADT] Add detection utility for incomplete types (#65495)
This allows us to produce better error messages for types that were only
forward-declared, but where a full definition was expected.

The first user will be https://reviews.llvm.org/D159013; this change is
sent to review separately to reduce the scope of the other patch.
2023-09-06 14:06:40 -04:00
Jan Svoboda
1d56c509be [llvm][ADT] Fix signedness mismatch in IntrusiveRefCntPtr test 2023-09-06 11:05:01 -07:00
Jan Svoboda
ddbcc10b9e [clang] NFCI: Adopt SourceManager::getFileEntryRefForID()
This commit replaces some calls to the deprecated `FileEntry::getName()` with `FileEntryRef::getName()` by swapping current usages of `SourceManager::getFileEntryForID()` with `SourceManager::getFileEntryRefForID()`. This lowers the number of usages of the deprecated `FileEntry::getName()` from 95 to 50.
2023-09-06 10:49:48 -07:00
Mark de Wever
8271713981 [libc++][CI] Improves bootstrap build output.
Use the same arguments as other builds. This gives better output to
validate what the CI did.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D158860
2023-09-06 19:48:59 +02:00
rorth
b084d10c28
[Driver] Wrap -lgcc_s in -z ignore/-z record on Solaris (#65487)
`clang` currently links `libgcc_s` unconditionally on Solaris, which is
unnecessary.

This patch wraps it in `-z ignore`/`-z record` instead.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.
2023-09-06 19:44:39 +02:00
Jan Svoboda
d1487670ee
[llvm][ADT] Implement IntrusiveRefCntPtr::useCount() (#65502)
This function has the same semantics as
`std::shared_ptr<T>::use_count()`, and enables implementing
copy-on-write semantics.
2023-09-06 10:37:10 -07:00
Mark de Wever
d015e481d7 [libc++][C++20 modules] Tests no experimental library build.
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D158936
2023-09-06 19:31:29 +02:00
Daniel Paoliello
f2f36c9b29 Emit line numbers in CodeView for trailing (after ret) blocks from inlined functions
Issue Details:
When building up line information for CodeView debug info, LLVM attempts to gather the "range" of instructions within a function as these are printed together in a single record. If there is an inlined function, then those lines are attributed to the original function to enable generating `S_INLINESITE` records. However, this thus requires there to be instructions from the inlining function after the inlined function otherwise the instruction range would not include the inlined function.

Fix Details:
Include any inlined functions when finding the extent of a function in `getFunctionLineEntries`

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D159226
2023-09-06 10:19:30 -07:00
Vladislav Dzhidzhoev
c39edd7b53 [AArch64][GlobalISel] Regenerate prelegalizercombiner-shuffle-vector.mir 2023-09-06 18:38:13 +02:00
Craig Topper
bb810d8fa0 [RISCV] Disable machine verifier in gisel-commandline-option.ll. NFC
Hopefully this fixes the expensive checks build.
2023-09-06 09:32:32 -07:00
Shilei Tian
ff5c7261ef [OpenMP] Fix a wrong assertion in __kmp_get_global_thread_id
The function assumes that `__kmp_gtid_get_specific` always returns a valid gtid.
That is not always true, because when creating the key for thread-specific data,
a destructor is assigned. The dtor will be called at thread exit. However, before
the dtor is called, the thread-specific data will be reset to NULL first
(https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_key_create.html):

> At thread exit, if a key value has a non-NULL destructor pointer, and the thread
> has a non-NULL value associated with that key, the value of the key is set to NULL.

This will lead to that `__kmp_gtid_get_specific` returns `KMP_GTID_DNE`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D159369
2023-09-06 12:21:43 -04:00
Shilei Tian
518b08c193
[OpenMP] Fix issue of indirect function call in __kmpc_fork_call_if (#65436)
The outlined function is typically invoked by using
`__kmp_invoke_microtask`,
which is written in asm. D138495 introduces a new interface function for
parallel
region for OpenMPIRBuilder, where the outlined function is called via
the function
pointer. For some reason, it works perfectly well on x86 and x86-64
system, but
doesn't work on Apple Silicon. The 3rd argument in the callee is always
`nullptr`, even
if it is not in caller. It appears `x2` always contains `0x0`. This
patch adopts
the typical method to invoke the function pointer. It works on my M2
Ultra Mac.

Fix #63194.
2023-09-06 12:17:45 -04:00
Florian Mayer
08ad327dde Do not duplicate identical stack safety test for RISCV
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D159148
2023-09-06 09:16:55 -07:00
zhijian
f903119cce Fixed a compile error on use of deleted function ¡®{anonymous}::MemberData::MemberData(const {anonymous}::MemberData&)
Summary:

There is compile error on https://lab.llvm.org/buildbot/#/builders/264/builds/1147/steps/5/logs/stdio
when commit in https://reviews.llvm.org/D144872
2023-09-06 12:04:52 -04:00
Simon Pilgrim
84447c044f [DAG] Add SelectionDAG::isADDLike helper. NFC.
Make the DAGCombine helper global so we can more easily reuse it.
2023-09-06 16:54:25 +01:00
Simon Pilgrim
c61d1984b4 [X86] matchIndexRecursively - pull out repeated getOpcode() calls. NFCI. 2023-09-06 16:54:25 +01:00