Commit Graph

455108 Commits

Author SHA1 Message Date
Nikolas Klauser
e6cc0faa73 [runtimes] Don't use -Wall on clang-cl builds
`-Wall` on clang-cl is equivalent to `-Weverything` on clang. We already add the correct warning flag depending whether we are in an MSVC-like environment, so just remove it from the list of flags that get passed unconditionally.

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D146378
2023-03-19 12:51:37 +01:00
Michael Buch
4601bcdb7e [libcxxabi][Demangle] Don't drop ctor/dtor name for abi-tagged structures
Before this patch we would demangle abi-tagged structures as follows:
```
$ c++filt -n _ZN1SB5OuterC2Ev
S[abi:Outer]:()

$ c++filt -n _ZN1SB5OuterD2Ev
S[abi:Outer]::~()
```

This is because `Node::getBaseName` was unimplemented for the
`AbiTagAttr` node, which meant that when we tried printing `CtorDtorName`
where its `Basename` `Node` was an `AbiTagAttr`, we'd drop the
name.

Addresses https://github.com/llvm/llvm-project/issues/61213

Differential Revision: https://reviews.llvm.org/D145492
2023-03-19 11:03:54 +00:00
Michael Buch
50b58e89a1 [llvm][Demangle][NFC] Sync latest libcxxabi/demangle
Differential Revision: https://reviews.llvm.org/D145693
2023-03-19 11:03:54 +00:00
Nikolas Klauser
c9d36bd807 [libc++] Granularize <exception> includes
Reviewed By: ldionne, #libc

Spies: mikhail.ramalho, smeenai, libcxx-commits

Differential Revision: https://reviews.llvm.org/D146097
2023-03-19 10:28:32 +01:00
Nikolas Klauser
5b1145bc46 [libc++][NFC] Refactor the __enable_ifs in <string>
This changes all `__enable_if`s inside `<string>` to a common pattern. Specifically, it's always inside the `template <>` and uses the `, int> = 0` style.

Reviewed By: ldionne, #libc

Spies: mikhail.ramalho, EricWF, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144568
2023-03-19 10:26:34 +01:00
Sirui Mu
c9d475c937 [libc++abi] Improve performance of __dynamic_cast
The original `__dynamic_cast` implementation does not use the ABI-provided `src2dst_offset` parameter which helps improve performance on the hot paths. This patch improves the performance on the hot paths in `__dynamic_cast` by leveraging hints provided by the `src2dst_offset` parameter. This patch also includes a performance benchmark suite for the `__dynamic_cast` implementation.

Reviewed By: philnik, ldionne, #libc, #libc_abi, avogelsgesang

Spies: mikhail.ramalho, avogelsgesang, xingxue, libcxx-commits

Differential Revision: https://reviews.llvm.org/D138005
2023-03-19 10:04:34 +01:00
Frederic Cambus
8510cf9fc1 [compiler-rt] Add missing #else clause to fix the build on NetBSD.
An #elif SANITIZER_SOLARIS clause was removed in D120048, but it also
removed the #else clause for the error fallback, causing the build to
fail on NetBSD.

Differential Revision: https://reviews.llvm.org/D146316
2023-03-19 09:46:45 +01:00
Nathan Ridge
9d042ed1a4 [clangd] Fix test failure in SemanticHighlighting.GetsCorrectTokens 2023-03-19 04:43:24 -04:00
Nathan Ridge
7138e75d1b [clangd] Avoid recursion on UnresolvedUsingValueDecl during semantic highlighting
Fixes https://github.com/clangd/clangd/issues/1313

Differential Revision: https://reviews.llvm.org/D134827
2023-03-19 04:30:33 -04:00
Jun Sha (Joshua)
2538e55042 [Sanitizer] [Scudo] Add riscv64 support for scudo
Enable Scudo on RISCV64 on both clang side and compiler-rt side.

Reviewers: cryptoad, eugenis, vitalybuka, luismarques, hiraditya

Reviewed By: vitalybuka, luismarques
Differential Revision: https://reviews.llvm.org/D137397
2023-03-18 23:37:46 -07:00
Alexis Murzeau
d4cb6c2082 [clang-tidy] readability-identifier-naming: fix hungarian enum prefix in C
When checking a C file, enum tags are of type `int` instead of the enum
type as in C++.
So the checker was using `i` as the prefix for enum tags instead of main
letters of the enum type name (for example `rt` for `enum REV_TYPE`).

This commit fixes this divergence and makes the behavior the same between
C and C++ files.

For example, `enum REV_TYPE { rtRevValid };` won't be reported as badly
named when in a C file. Previously, it would have proposed a rename to
`iRevValid`.

This commit also add a file to test the hungarian notation checker with C
files.
The test file was made from identifier-naming-hungarian-notation.cpp
with C++-only features removed.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D144912
2023-03-19 06:22:16 +00:00
lizhijin
22c3ba4bb5 [SVE] Add patterns for shift intrinsics with FalseLanesZero mode
This patch adds patterns to reduce redundant mov and sel instructions
for shift intrinsics with FalseLanesZero mode, when
FeatureExperimentalZeroingPseudosis supported.

For example, before:

mov     z1.b, #0
sel     z0.b, p0, z0.b, z1.b
asr     z0.b, p0/m, z0.b, #7
After:

movprfx z0.b, p0/z, z0.b
asr     z0.b, p0/m, z0.b, #7

Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D145551
2023-03-19 13:49:01 +08:00
Lang Hames
57aeb30546 [JITLink][ELF] Don't skip debug info sections by default.
By default ELFLinkGraphBuilder will now create LinkGraph sections with NoAlloc
lifetime for debug info sections in the original object. Debug sections are not
kept alive by default, and will be dead-stripped unless some plugin marks them
as live in the pre-prune phase.
2023-03-18 22:34:07 -07:00
Lang Hames
ede78c1704 [JITLink][ELF][x86-64] Add support for R_X86_64_32 relocation. 2023-03-18 20:00:03 -07:00
Nico Weber
93a04a0591 [gn] Fix libunwind build on mac after 203b6f31bb
See #61501 and https://reviews.llvm.org/D143637#4204277 for details.
2023-03-18 22:20:07 +01:00
LLVM GN Syncbot
12f4ac25b7 [gn build] Port f7efcaca77 2023-03-18 20:31:42 +00:00
LLVM GN Syncbot
ff2298ef1a [gn build] Port 787fbad57e 2023-03-18 20:31:41 +00:00
LLVM GN Syncbot
cd4e82f168 [gn build] Port 65f7ebe72e 2023-03-18 20:31:40 +00:00
Florian Hahn
371bb2c9d3
[VPlan] Move createReplicateRegion out of VPRecipeBuilder.h. (NFC)
The function doesn't use anything from VPRecipeBuilder, so move the
definition to where it is actually used and turn it into a simple static
function.

It also makes the VPRecipeBuilder argument for createAndOptimizeReplicateRegions
unnecessary.
2023-03-18 20:30:49 +00:00
Wael Yehia
787fbad57e [NFC][AIX][PGO] Create AIX specific compiler-rt profile file. 2023-03-18 20:22:22 +00:00
Louis Dionne
d6c12cbee3 [libc++][Apple] Make sure to set the LIBCXX_LIBRARY_VERSION when building for Apple
Differential Revision: https://reviews.llvm.org/D146361
2023-03-18 16:22:00 -04:00
Louis Dionne
16fe61ac7b [libc++][Apple] Make sure we install libc++experimental.a
Differential Revision: https://reviews.llvm.org/D146360
2023-03-18 16:20:39 -04:00
Nico Weber
29d3e4e6e9 [gn] merge e46d8a7315 more 2023-03-18 21:19:27 +01:00
Nico Weber
6d9ea9108a [gn] merge e46d8a7315 2023-03-18 21:18:17 +01:00
Mark de Wever
d0398d3593 Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""
This reverts commit a72165e5df.

Some buildbots have not been updated yet.
2023-03-18 20:32:43 +01:00
Augusto Noronha
f03cd76338 [lldb] Introduce SymbolFile::ParseAllLanguages
SymbolFile::ParseAllLanguages allows collecting the languages of the
extra compile units a SymbolFileDWARFDebugMap may have, which can't
be accessed otherwise. For every other symbol file type, it should
behave exactly the same as ParseLanguage.

rdar://97610458

Differential Revision: https://reviews.llvm.org/D146265
2023-03-18 10:33:14 -07:00
Florian Hahn
6a6b65a84c
[LV] Restructure code creating replicate region (NFC).
Re-order recipe and block creation to be in order, as suggested
post-commit for 2db71c9851.
2023-03-18 17:17:07 +00:00
Lang Hames
0b7e16afc9 Re-apply "[JITLink][ORC] Rename MemDeallocPolicy to MemLifetime..." with fixes.
This reapplies 2cc64df0bd, which was reverted in
5379c46d49 due to bot failures.

The new patch contains fixes to ELFLinkGraphBuilder.h to better handle
non-SHT_ALLOC sections (these were being accidentally skipped in the previous
patch), and to skip SHT_NULL sections.
2023-03-18 10:13:55 -07:00
Nathan James
3ed40ac90c [clang-tidy] Fixed an issue in readability-identifier-naming not using options specified.
Fixed an issue where specifying empty strings for prefix or suffix would be ignored preventing using those to override a different style.

Fixes https://github.com/llvm/llvm-project/issues/56358.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D129070
2023-03-18 15:54:25 +00:00
Mark de Wever
a72165e5df Reland "[CMake] Bumps minimum version to 3.20.0."
This reverts commit 92523a35a8.

Test whether all CI runners are updated.
2023-03-18 13:33:42 +01:00
Piotr Zegar
113f0190dd [clang-tidy] Fix minor bug in bugprone-too-small-loop-variable
Correct issue when incorrectly matched bitfield loop
variable would still be considered valid and equal to
base type, because check didnt compare size of bitfield.

Fixes issue introduced in: D142587

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D145958
2023-03-18 10:44:13 +00:00
Nico Weber
7ba9c060d4 [gn] port d60d3455eb 2023-03-18 10:13:31 +01:00
Craig Topper
e9c5d8007e [RISCV] Use 'unsigned' for XLen in RISCVTargetDefEmitter.cpp. NFC
The values are small so the difference doesn't matter, but the
consuming function is defined to take 'unsigned'.
2023-03-18 01:00:48 -07:00
Austin Kerbow
864a2b25be [AMDGPU] Reserve extra SGPR blocks wth XNACK "any" TID Setting
ASMPrinter was relying on feature bits to setup extra SGRPs in the knerel
descriptor for the xnack_mask. This was broken for the dynamic XNACK "any" TID
setting which could cause user SGPRs to be clobbered if the number of SGPRs
reserved was near a granulated block boundary.

When XNACK was enabled this worked correctly in the ASMParser which meant some
kernels were only failing without "-save-temps".

Fixes: SWDEV-382764

Reviewed By: kzhuravl

Differential Revision: https://reviews.llvm.org/D145401
2023-03-17 20:26:23 -07:00
Lang Hames
b5c862e15c [JITLink] Store Sections in a DenseMap with the section name as key.
This speeds up section lookup by name.

This change was motivated by poor performance of a testcase while trying to fix
the NoAlloc lifetime patch that was originally landed as 2cc64df0bd. The
NoAlloc lifetime patch causes ELF non-SHF_ALLOC sections to be given a JITLink
Section (previously they were skipped), and the
llvm/test/ExecutionEngine/JITLink/X86/ELF_shndex.s testcase creates > 64k
non-SHF_ALLOC sections, each of which now needs to be checked to ensure that its
name does not clash. Moving to a DenseMap allows us to implement this check
efficiently.
2023-03-17 20:21:54 -07:00
Heejin Ahn
e1f830bde8 [WebAssembly] Support debug info for TLS + global in PIC mode
This adds debug info support for
- `thread_local` global variables, both in non-PIC and PIC modes
- (non-thread_local) Global variables in PIC mode

The former needs to read the value from an offset relative to
`__tls_base` and the latter an offset from `__memory_base`. The code for
doing this overlaps with some of the existing code to add
`__stack_pointer` global, so this adds a new member function to add a
a global in `TI_GLOBAL_RELOC` mode and use it in all three places.

Split DWARF support is currently patchy at best, because the index for
`__tls_base` is not fixed after dynamic linking. The preexisting split
DWARF support for `__stack_pointer` relies on that in practice it is
always index 0. This does similar hardcoding for `__tls_base` and
`__memory_base`, but `__tls_base`'s index in dynamic linking is not
fixed now (See
19afbfe331/lld/wasm/Driver.cpp (L786-L823)
for details), TLS + dynamic linking will not work at the moment.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1416702.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D145626
2023-03-17 20:16:48 -07:00
Heejin Ahn
6d33affac0 [WebAssembly] Add comments on local.tee transformation
We have a good comment on `TEE` transformation in `RegStackify`:
547e345666/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp (L613-L632)

And I think it can be helpful to have some more comments on how the
`TEE`s created in `RegStackify` are converted into `LOCAL_TEE`s.

Variable `OldReg` is changed to `DefReg` to be consistent with
`RegStackify`'s comment.

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D146084
2023-03-17 20:16:16 -07:00
Heejin Ahn
4f2401f4f9 [WebAssembly] Use MachineInstr::setDebugValueUndef
When making `DBG_VALUE`/`DBG_VALUE_LIST` instructions undefined, there
is a method that takes care of it so we don't need to do it manually.
This changes the test because previously we are converting
`DBG_VALUE_LIST`s into `DBG_VALUE $noreg` but now we leave
`DBG_VALUE_LIST` but set it to undef by turning all its register
operands `$noreg`. The effect is the same.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D145998
2023-03-17 20:15:01 -07:00
Paul Kirth
14f292d00e [llvm-readobj] Output valid JSON for GroupSections
The current implementation output the LLVM formatted heading for group
sections, which was not valid JSON. This patch provides two small
customization points that allow the heading to vary between the two
implementations, and another that allows the section members to be
output as valid JSON objects.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137095
2023-03-18 03:14:17 +00:00
Heejin Ahn
4e844a1498 [WebAssembly] Replace Bugzilla links with Github issues
Reviewed By: dschuff, asb

Differential Revision: https://reviews.llvm.org/D145966
2023-03-17 20:13:00 -07:00
Paul Kirth
681d5eecf7 [llvm-readobj] Fix "Section" output when emitting relocations in JSON
Prior to this patch, the JSON output would emit an invalid key from the
shared LLVM implementation. This caused llvm-readobj to output invalid
JSON. This patch introduces a small helper function to print the
relocation information differently between the LLVM and JSON formats.

Before this patch:

```
    "Relocations": [Section (2) .rel.text {

      {
        "Relocation": {
          "Offset": 0,
          "Type": {
            "Value": "R_X86_64_NONE",
            "RawValue": 0
          },
          "Symbol": {
            "Value": "rel_0",
            "RawValue": 1
          }
        }
      },
      ...

```

After this patch:

```
   "Relocations": [
      {
        "SectionIdx": 2,
        "Relocs": [
          {
            "Relocation": {
              "Offset": 0,
              "Type": {
                "Name": "R_X86_64_NONE",
                "Value": 0
              },
              "Symbol": {
                "Name": "rel_0",
                "Value": 1
              }
            }
          },
          ...
```

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137094
2023-03-18 01:35:50 +00:00
Julian Lettner
711ff37b55 [TSan] Make sure we only collect non-TSan frames for memory operations r=dvyukov,rsundahl,thetruestblue,wrotki,kubamracek!
A previous change [1] moved retrieval of the caller PC
(`__builtin_return_address(0)` via `CALLERPC`) from an
interface-boundary function into a shared helper function
`ExternalAccess`.  If this function does not get inlined, we fail to
collect the appropriate caller PC for the "TSan interface boundary".

[1] https://reviews.llvm.org/D32360

rdar://78489600

Differential Revision: https://reviews.llvm.org/D146264
2023-03-17 17:40:14 -07:00
Peter Collingbourne
659da71a40 gn build: Pass -fno-emulated-tls when targeting Android.
Matches the CMake build:
93c1a5f3dd/compiler-rt/CMakeLists.txt (L343)
(we always use API level 29).

Differential Revision: https://reviews.llvm.org/D146341
2023-03-17 17:28:40 -07:00
Pavel Kopyl
7adacaa098 [NVPTX] Report fatal error on empty argument type.
Differential Revision: https://reviews.llvm.org/D146331
2023-03-18 01:27:43 +01:00
Paul Kirth
93c1a5f3dd [llvm-readobj] Rename JSON Flag fields to be more consistent
Today the JSON uses `Value` and `RawValue` when printing `Flags`, when really
the `Value` field is always the name of an Enum variant, and `RawValue` is its
underlying numeric value. Similarly, we rename the `RawFlags` key to `Value`,
to match the new scheme. This also allows JSON parsing to use consistent logic
for `Flag` types.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137091
2023-03-18 00:04:47 +00:00
Paul Kirth
23fd6e360c [llvm-readobj] Fix JSON output for Relocations
The existing JSON incorrectly outputs line breaks and other invalid JSON.

Example Before this patch:

```
...
"Relocations":[Section (9) .rela.dyn {
  0xA3B0 R_X86_64_RELATIVE - 0x43D0
  0xA3B8 R_X86_64_RELATIVE - 0x4A30
...
```

Example After this patch:

```
...
"Relocations":[Section (9) .rela.dyn {
{"Relocation":{"Offset":41904,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8},
"Symbol":{"Value":"","RawValue":0},"Addend":17360}},
{"Relocation":{"Offset":41912,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8},
"Symbol":{"Value":"","RawValue":0},"Addend":18992}},
{"Relocation":{"Offset":41920,"Type":{"Value":"R_X86_64_RELATIVE","RawValue":8},
"Symbol":{"Value":"","RawValue":0},"Addend":17440}},
...
```

Note there are still issues with the Section, but each Relocation is
now a valid JSON object that can be parsed. Future patches will address
the issues regarding JSON output for the Section.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137089
2023-03-17 23:57:58 +00:00
Paul Kirth
8e1746faa3 [llvm-readobj] Standardize JSON output for Other field
Today, the LLVM output uses special handling when the Other field is 0.
This output makes sense for a command line utility that a human will
read, but JSON is a machine readable format, so being consistent is more
important. Prior to this change, any consumer of the JSON output would
need to handle the Other field specially, since the structure of the
JSON would no longer be consistent.

Changes to JSON output when Other flag == 0:
```
"Other": 0,   ->   "Other": {
                      "RawFlags": 0,
                       "Flags": []
                    },
```

There are no changes to when Other flag != 0:
```
"Other": {        ->   "Other": {
  "RawFlags": 1,          "RawFlags": 1,
  "Flags": [              "Flags": [
      ...                     ...
  ]                       ]
},                     },
```

This patch adds a overload for the JSONELFDumper's printSymbol() method,
that uses consistent output formatting, regardless of the value of the
Other field.

Depends on D137092

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137088
2023-03-17 23:38:31 +00:00
Nikolas Klauser
308bcb3f7b [libc++] Use the _LIBCPP_VERBOSE_ABORT macro instead of calling the function directly
These calls were added in D141222.

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits, smeenai, mikhail.ramalho

Differential Revision: https://reviews.llvm.org/D146227
2023-03-18 00:34:28 +01:00
Paul Kirth
552b1b3c44 [llvm-readobj] Use a helper to extract the Other Flags from symbols
Since all ELFDumper implementations will require the same logic when
dealing with Other Flags, we move the logic into a helper so that it can
be easily reused across implementations.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D137092
2023-03-17 23:30:12 +00:00
Philip Reames
6f00170159 [LSR] Rework term-fold tests
There were two major problems with the tests.

First, with the pointer size being 32 bit and the original IVs also being 32 bit, almost all of the positive tests were actually unsound.  An upcoming change will add the appropriate safety check, but the test diffs are really hard to understand without switching the tests to 64 bit pointers first.

Second, checking debug messages for failures is a major bad practice.  This should not have been accepted in review at all.  The reason is that it makes the *order* of legality checks visibile and modifying any of them becomes annoying and tedious.
2023-03-17 16:03:08 -07:00