Commit Graph

455417 Commits

Author SHA1 Message Date
David Benjamin
61363445d4 [libc++] Assert that lengths fit in difference_type
This can help flag accidentally passing in negative values into the  `string_view` constructor. This aligns with a similar check in `absl::string_view`.

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

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D145981
2023-03-19 18:42:22 +01:00
Mark de Wever
e657eb6255 [libc++][test] Adds a missing include. 2023-03-19 18:03:25 +01:00
Nikolas Klauser
f3c2c0ffe6 [libc++] Inline small constructors into basic_string
This allows the compiler to inline the constructors.

Reviewed By: ldionne, #libc

Spies: mikhail.ramalho, libcxx-commits

Differential Revision: https://reviews.llvm.org/D144580
2023-03-19 17:53:22 +01:00
Iain Sandoe
62a16d5e20 [C++2x][Modules] Amend module purview constant linkage [P2788R0].
This paper has been applied to the working draft and is believed to be
a DR against C++20, so that the patch here makes the change unconditionally.

for:
```
export module A;

const int mod_cst = 10;
```
Before the change, mod_cst would have internal linkage; after the change it
has module linkage.

Differential Revision: https://reviews.llvm.org/D145886
2023-03-19 16:25:56 +00:00
Shao-Ce SUN
d233c7b814 [Flang][RISCV] Fix 9f93b71f20 2023-03-19 23:25:52 +08:00
Louis Dionne
a6a74fa5b3 [libc++][NFC] Clean up the ABI changelog
Fix a few typos and remove TODOs
2023-03-19 10:37:24 -04:00
Louis Dionne
47aa1fe376 [libc++][Apple] Update availability markup for std::to_chars(floating-point)
Differential Revision: https://reviews.llvm.org/D146367
2023-03-19 10:24:38 -04:00
Louis Dionne
c0cde79e9e [libc++] Remove C++03 extensions for std::allocator_arg & friends
As explained in the release note, libc++ used to provide various
global variables as an extension in C++03 mode. Unfortunately, that
made our definition non-conforming in all standard modes. This was
never a big problem until recently, since we are trying to support
C++20 Modules in libc++, and that requires cleaning up the definition
of these variables.

This change is the first in a series of changes to achieve our end goal.
This patch removes the ability for users to rely on the (incorrect)
definition of those global variables inside the shared library. The
plan is to then remove those definitions from the shared library
(which is an ABI break but I don't think it will have impact), and
finally to make our definition of those variables conforming in all
standard modes.

Differential Revision: https://reviews.llvm.org/D145422
2023-03-19 10:14:32 -04:00
Congcong Cai
fb066c4622 [sancov] fix coverage-report-server cannot display coverage detail
This patch make following change for coverage-report-server.py
- using uri `./{name}` from root in the old version python http.server can be handled as `//{name}`. But due to https://github.com/python/cpython/pull/93879, it will be handled as `/{name}` now.

So I want to use a prefix to avoid double slashes issue.

Differential Revision: https://reviews.llvm.org/D146010
2023-03-19 21:09:48 +08:00
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