473965 Commits

Author SHA1 Message Date
Jianjian Guan
fab2594968
[RISCV][NFC] Remove unused checkline (#65560) 2023-09-07 16:24:31 +08:00
David Spickett
a723694321 [lldb] Add more ways to find split DWARF files
Fixes #28667

There's a bunch of ways to end up building split DWARF where the
DWO file is not next to the program file. On top of that you may
distribute the program in various ways, move files about, switch
machines, flatten the directories, etc.

This change adds a few more strategies to find DWO files:
* Appending the DW_AT_COMP_DIR and DWO name to all the debug
  search paths.
* Appending the same to the binary's dir.
* Appending the DWO name (e.g. a/b/foo.dwo) to all the debug
  search paths.
* Appending the DWO name to the binary's location.
* Appending the DWO filename (e.g. foo.dwo) to the debug
  search paths.
* Appending the DWO filename to the binary's location.

They are applied in that order and some will be skipped
if the DW_AT_COMP_DIR is relative or absolute, same for
the DWO name (though that seems to always be relative).

This uses the setting target.debug-file-search-paths, which
is used for DWP files already.

The added tests likely do not cover every part of the
strategies listed, it's a best effort.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D157609
2023-09-07 08:19:11 +00:00
Chuanqi Xu
f0cd9b2b8a [NFC] [Serialization] Remove unused output parameter 'Imported' in ReadAST 2023-09-07 16:12:53 +08:00
Thomas
b6e19b35cd
[NVPTX] Fix crash in libc gpu after db5d845 (#65579) 2023-09-07 01:06:27 -07:00
David Spickett
3f3ee73f66
[lldb] Add lldb team to CODEOWNERS (#65454)
https://github.com/orgs/llvm/teams/pr-subscribers-lldb exists but wasn't
added to this file.
2023-09-07 09:03:22 +01:00
Sergei Barannikov
40aa39d50c
[Sparc] Change register spelling to lowercase (NFC) (#65464)
This change allows to simplify SparcAsmParser a bit by delegating some
work (parsing singleton registers) to the code generated by llvm-tblgen.
Other than that, there is no functionality change, because registers are
matched using custom code in SparcAsmParser.cpp and always printed in
lowercase by SparcInstPrinter.
2023-09-07 11:00:50 +03:00
Martin Erhart
7c6419bc3c
[NFC][mlir][bufferization] Move AllocationOpInterface implementations (#65578)
The new Buffer Deallocation pass introduced in D158421 will not need the
AllocationOpInterface anymore, thus it is better to move those default
implementations to a place where they will still be used.
2023-09-07 09:59:51 +02:00
Corentin Jabot
98062d8fef Revert "[Clang] Add captures to the instantiation scope of lambda call operators"
The change causes some libcxx regressions

This reverts commit eaf725bc9371a6699902d67d97662caaa3332799.
2023-09-07 09:50:25 +02:00
Markus Böck
edae8f6ce2
[mlir] Make classof substitution in interface use an instance (#65492)
The substitution supported by `extraClassOf` is currently limited to
only the base instance, i.e. `Operation*`, `Type` or `Attribute`, which
limits the kind of checks you can perform in the `classof`
implementation.

Since prior to the user code, the interface concept is fetched, we can
use it to construct an instance of the interface, allowing use of its
methods in the `classof` check.

Since an instance of the interface allows access to the base class
methods through the `->` operator, I've gone ahead and replaced the
substitution of `$_op/$_type/$_attr` with an interface instance. This is
also consistent with `extraSharedClassDeclaration` and other methods
created in the interface class which do the same.
2023-09-07 09:46:57 +02:00
Owen
c47c480b18
[clang-format][NFC] Fix broken dump_format_help.py and sync RST file (#65429)
Running `dump_format_help.py` in `clang/docs/tools`:
```
warning: line too long:
                                      relative to the current working directory when reading stdin.
warning: line too long:
     --files=<filename>             - A file containing a list of files to process, one per line.
warning: line too long:
     --help-list                    - Display list of available options (--help-list-hidden for more)
Traceback (most recent call last):
  File "/Users/Owen/remove-braces/clang/docs/tools/./dump_format_help.py", line 63, in <module>
    contents = substitute(contents, "FORMAT_HELP", help_text)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Owen/remove-braces/clang/docs/tools/./dump_format_help.py", line 17, in substitute
    return re.sub(pattern, "%s", text, flags=re.S) % replacement
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
TypeError: not enough arguments for format string
```
2023-09-07 00:43:19 -07:00
Egor Zhdan
195cdfd9ec
[APINotes] Support SwiftImportAs for C++ structs
This upstreams a few Clang API Notes attributes that were recently added
downstream in the Apple fork
(https://github.com/apple/llvm-project/pull/7386).
2023-09-07 08:39:35 +01:00
Kinuko Yasuda
f9026cfb76 [clang][dataflow] Fix Record initialization with InitListExpr and inheritances
Usually RecordValues for record objects (e.g. struct) are initialized with
`Environment::createValue()` which internally calls `getObjectFields()` to
collects all fields from the current and base classes, and then filter them
with `ModeledValues` via `DACtx::getModeledFields()` so that the fields that
are actually referenced are modeled.

The consistent set of fields should be initialized when a record is initialized
with an initializer list (InitListExpr), however the existing code's behavior
was different.

Before this patch:
* When a struct is initialized with InitListExpr, its fields are
  initialized based on what is returned by `getFieldsForInitListExpr()`, which
  only collects the direct fields in the current class, but not from the base
  classes. Moreover, if the base classes have their own InitListExpr, values
  that are initialized by their InitListExpr's weren't merged into the
  child objects.

After this patch:
* When a struct is initialized with InitListExpr, it collects and merges the
  fields in the base classes that were initialized by their InitListExpr's.
  The code also asserts that the consistent set of fields are initialized
  with the ModeledFields.

Reviewed By: mboehme

Differential Revision: https://reviews.llvm.org/D159284
2023-09-07 07:37:50 +00:00
Owen Pan
c22c0c4769 [clang-format][NFC] Change conjunction of isNot() with one !isOneOf() 2023-09-07 00:20:02 -07:00
wenzhi-cui
5ccda55772
Fix AtomicInterfacesTdFiles missing deps/typos in Bazel (#65562) 2023-09-07 08:26:03 +02:00
Christopher Di Bella
b4d6c0f7c7
[libc] continues header cleanup process (#65556)
* replaces `add_rvalue_reference_t` with `is_rvalue_reference_t`
* includes `"stddef.h"` for `size_t` include

---------

Co-authored-by: Guillaume Chatelet <gchatelet@google.com>
2023-09-07 08:24:31 +02:00
Fangrui Song
c998106a7f [Lex] Remove unused AddGnuCPlusPlusIncludePaths after e75f240a0432d827c28a5d77fad26a099ceb7a72 2023-09-06 22:25:47 -07:00
Thomas
db5d845c73
[NVPTX] Make i16x2 a native type and add supported vec instructions (#65432)
On sm_90 some instructions now support i16x2 which allows hardware to
execute more efficiently add, min and max instructions.

In order to support that we need to make i16x2 a native type in the
backend. This does the necessary changes to make i16x2 a native type and
adds support for the instructions natively supporting i16x2.

This caused a negative test in nvptx slp to start passing. Changed the
test to a positive one as the IR is correctly vectorized.
2023-09-06 21:59:13 -07:00
Shilei Tian
010a5a737b [OpenMP] Fix build issue with libomp when OMPT is disabled 2023-09-06 23:40:24 -04:00
walter erquinigo
0762b2e6ca [lldb-vscode] Fix variable test
https://lab.llvm.org/buildbot/#/builders/68/builds/59499 caught a failed test introduced by cf5d8def5c.
The fix is simple. We just need to update some values.
2023-09-06 22:52:01 -04:00
Brad Smith
fd4c80dec9
[OpenMP] Fix gettid warnings on DragonFly (#65549)
Define __kmp_gettid() as appropriate for DragonFly.
2023-09-06 20:21:11 -04:00
Walter Erquinigo
cf5d8def5c
[lldb-vscode] Show a fake child with the raw value of synthetic types (#65552)
Currently, if the user wants to inspect the raw version of a synthetic
variable, they have to go to the debug console and type `frame var
<variable>`, which is not a great experience. Taking inspiration from
CodeLLDB, this adds a `[raw]` child to every synthetic variable so that
this kind of inspection can be done visually.

Some examples:

<img width="500" alt="Screenshot 2023-09-06 at 7 56 25 PM"
src="https://github.com/llvm/llvm-project/assets/1613874/7fefb7c5-0da7-49c7-968b-78ac88348fea">
<img width="479" alt="Screenshot 2023-09-06 at 6 58 25 PM"
src="https://github.com/llvm/llvm-project/assets/1613874/6e650567-16e1-462f-9bf5-4a3a605cf6fc">
2023-09-06 20:13:48 -04:00
Walter Erquinigo
9d1063642c
[NFC] Set a variable in the mlir data formatter (#65554)
The formatter fails when num_children is invoked and self.impl_type is
not set.
2023-09-06 20:13:39 -04:00
Nico Weber
8f675d1a26 [gn] port f78f93bc9fd4 (libc++ tzdb) 2023-09-06 20:02:48 -04:00
Arthur O'Dwyer
3df1a64eba [libc++] Add a test for std::ssize's SFINAE
Inspired by https://reviews.llvm.org/D120684#inline-1157644 and
subsequent LWG discussion. See http://wg21.link/LWG3207 for
additional context.

Differential Revision: https://reviews.llvm.org/D121154

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-09-06 19:40:50 -04:00
Zoe Carver
bd095b5c4d [libc++] Add tests for P0809 (Comparing Unordered Containers)
Differential Revision: https://reviews.llvm.org/D61771

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-09-06 19:37:17 -04:00
Tyler Lanphear
52240399f9
[AssumptionCache] Track GlobalValues as affected values. (#65425)
Fixes a corner case of the analysis: previously GlobalValues could be
affected by assumptions, but were not tracked within AffectedValues.
This patch allows assumptions which affect a given GlobalValue to be
looked up via `assumptionsFor()`.

A small update to llvm/test/Analysis/ScalarEvolution/ranges.ll was
necessary due to knowledge about a global value now being propagated
from AssumptionCache -> ValueTracking -> ScalarEvolution.
2023-09-06 15:46:14 -07:00
Daniel Kutenin
aea0ea57b7
[llvm-nm] Fix msan error in llvm-nm/wasm/weak-symbols.yaml.test (#65538)
This happened because we had a section

```
- Index:           3
         Kind:            DATA
         Name:            weak_import_data
         Flags:           [ BINDING_WEAK, UNDEFINED ]
```

Which does not have size. We managed to reproduce it by building llvm
under msan with libcxx as a standard library and debug mode with
-D_LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK. It called comp(a, a) and
full tie detected uninitialized memory

This started to happen after https://reviews.llvm.org/D158799
2023-09-06 15:30:30 -07:00
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 ddbcc10b9e26b18f6a70e23d0611b9da75ffa52f.

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 11171d81aeafb0c2818f288900423e366a2787fc.

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 77d1032516e7, 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