platform/upstream/llvm.git
16 months ago[GlobalISel][X86] Add i128 add/sub test coverage for narrowing on x86_64 triples
Simon Pilgrim [Thu, 15 Jun 2023 21:40:42 +0000 (22:40 +0100)]
[GlobalISel][X86] Add i128 add/sub test coverage for narrowing on x86_64 triples

16 months ago[GlobalIsel][X86] Avoid IMPLICIT_DEF in irregular types for CTTZ/CTLZ legalization...
Simon Pilgrim [Thu, 15 Jun 2023 19:06:58 +0000 (20:06 +0100)]
[GlobalIsel][X86] Avoid IMPLICIT_DEF in irregular types for CTTZ/CTLZ legalization tests

IMPLICIT_DEF can lead to some pretty weird G_UNMERGE_VALUES of long lists of s1 values, try to use a real source value instead

16 months ago[CUDA] Updated CUDA versions mentioned in CompileCudaWithLLVM.rst
Artem Belevich [Thu, 15 Jun 2023 21:26:21 +0000 (14:26 -0700)]
[CUDA] Updated CUDA versions mentioned in CompileCudaWithLLVM.rst

16 months ago[lldb][Android] Use a lambda for calls to ::open in RetryAfterSignal
Kazuki Sakamoto [Mon, 12 Jun 2023 15:30:45 +0000 (08:30 -0700)]
[lldb][Android] Use a lambda for calls to ::open in RetryAfterSignal

lldb-server for Android does not build with NDK r21 and above due to
RetryAfterSignal and Bionic ::open mismatch.
https://github.com/llvm/llvm-project/issues/54727

Apply the LLVM patch to LLDB.
https://github.com/llvm/llvm-project/commit/0a0e411204a2baa520fd73a8d69b664f98b428ba

> In Bionic, open can be overloaded for _FORTIFY_SOURCE support, causing
> compile errors of RetryAfterSignal due to overload resolution. Wrapping
> the call in a lambda avoids this.

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

16 months ago[SimplifyCFG] Add textual pass params for FoldTwoEntryPHINode and SimplifyCondBranch
Arthur Eubanks [Thu, 15 Jun 2023 21:06:15 +0000 (14:06 -0700)]
[SimplifyCFG] Add textual pass params for FoldTwoEntryPHINode and SimplifyCondBranch

16 months ago[RISCV][InsertVSETVLI] Treat vmv.v.i as-if it were vmv.s.x when VL=1, and inactive...
Philip Reames [Thu, 15 Jun 2023 21:00:57 +0000 (14:00 -0700)]
[RISCV][InsertVSETVLI] Treat vmv.v.i as-if it were vmv.s.x when VL=1, and inactive lanes are undefined

A vmv.v.i/x splats the immediate to all active lanes. For the active lanes, this is the same as vmv.s.x which inserts one scalar into the low lane. If we can ignore all the inactive lanes (because they are known undefined), then the two are semantically equivalent. We already reason about compatible VL/VTYPE combinations for vmv.s.x, apply the same logic to vmv.v.i.

Unlike a vmv.s.x, we do need to be careful not to increase LMUL. A splat instruction is probably linear in LMUL, so restrict this to LMUL1.

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

16 months ago[mlir][sparse] using stable_sort to make sure the compiled code are consistent betwee...
Peiming Liu [Thu, 15 Jun 2023 21:04:46 +0000 (21:04 +0000)]
[mlir][sparse] using stable_sort to make sure the compiled code are consistent between different builds configuration

Reviewed By: aartbik

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

16 months ago[mlir][sparse] proper in-place SDDMM with spy function
Aart Bik [Wed, 14 Jun 2023 22:18:00 +0000 (15:18 -0700)]
[mlir][sparse] proper in-place SDDMM with spy function

This specific operation matches the cuSPARSE SDDMM semantics exactly.

Reviewed By: Peiming

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

16 months ago[SimplifyCFG] Check optforfuzzing attribute during in the pass implementation
Arthur Eubanks [Thu, 15 Jun 2023 20:55:42 +0000 (13:55 -0700)]
[SimplifyCFG] Check optforfuzzing attribute during in the pass implementation

Instead of setting the SimplifyCFGOptions options at the beginning of the pass.

Otherwise it always gets overriden by the pass and the value in SimplifyCFGOptions is ignored.

16 months ago[MC] Remove an unneeded special case from MCObjectStreamer::flushPendingLabels
Fangrui Song [Thu, 15 Jun 2023 20:52:20 +0000 (13:52 -0700)]
[MC] Remove an unneeded special case from MCObjectStreamer::flushPendingLabels

We always pass a non-null F to flushPendingLabels. Wait a bit before changing
the parameter to use a reference.

16 months ago[libc][obvious] Actually return the value from `malloc` for NVPTX
Joseph Huber [Thu, 15 Jun 2023 20:12:10 +0000 (15:12 -0500)]
[libc][obvious] Actually return the value from `malloc` for NVPTX

Switching to this interface we neglected to actually write the output
from the malloc call to the RPC buffer. Fix this so the tests pass
again.

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

16 months ago[Bazel][mlir][tosa] Fix for 86c4972f5f6759b0ba85c568d934f9b8db8875a2
Pranav Kant [Thu, 15 Jun 2023 19:50:08 +0000 (19:50 +0000)]
[Bazel][mlir][tosa] Fix for 86c4972f5f6759b0ba85c568d934f9b8db8875a2

16 months ago[ARM] Fix for invalid register in ReplaceConstByVPNOTs
David Green [Thu, 15 Jun 2023 19:46:20 +0000 (20:46 +0100)]
[ARM] Fix for invalid register in ReplaceConstByVPNOTs

This ensures a removed register does not get reused as we replace constant vpt
values.

16 months ago[M68k] Use parseOptionalToken. NFC
Fangrui Song [Thu, 15 Jun 2023 19:35:06 +0000 (12:35 -0700)]
[M68k] Use parseOptionalToken. NFC

16 months ago[CSKY] Use parseOptionalToken. NFC
Fangrui Song [Thu, 15 Jun 2023 19:31:14 +0000 (12:31 -0700)]
[CSKY] Use parseOptionalToken. NFC

Many code paths are untested.
Some "expected ..." messages are adjusted, otherwise NFC.

16 months ago[gn build] Port 3a7876f6e2b0
LLVM GN Syncbot [Thu, 15 Jun 2023 19:11:21 +0000 (19:11 +0000)]
[gn build] Port 3a7876f6e2b0

16 months ago[BOLT] Sort BranchData in DataAggregator
Amir Ayupov [Thu, 15 Jun 2023 19:08:07 +0000 (12:08 -0700)]
[BOLT] Sort BranchData in DataAggregator

Align perf reader to fdata behavior by sorting BranchData after reading samples,
in the same way as DataReader:
https://github.com/llvm/llvm-project/blob/20c66a0c66340f44f04b6526e45bcc5d872d480a/bolt/lib/Profile/DataReader.cpp#L1239

Namely, that order affects CallSiteInfo annotations which determine the
construction order of CallGraph, which in turn affects function reordering.

Reviewed By: #bolt, rafauler

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

16 months agoRecommit "[SelectionDAG][RISCV] Add very basic PromoteIntegerResult/Op support for...
Craig Topper [Thu, 15 Jun 2023 19:03:25 +0000 (12:03 -0700)]
Recommit "[SelectionDAG][RISCV] Add very basic PromoteIntegerResult/Op support for VP_SIGN/ZERO_EXTEND."

I have fixed an existing DAGCombiner bug that caused the previous assertion failure.
See 7163539466d7e8930416e55dd9fd29891f8239f2.

Original message

We don't have VP_ANY_EXTEND or VP_SIGN_EXTEND_INREG yet so I've
deviated a little from the non-VP lowering.

My goal was to fix the crashes that occurs on these test cases without this patch.

Reviewed By: fakepaper56

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

16 months ago[LoongArch] Use parseOptionalToken. NFC
Fangrui Song [Thu, 15 Jun 2023 19:01:16 +0000 (12:01 -0700)]
[LoongArch] Use parseOptionalToken. NFC

16 months agoFix MLIR build with SHARED_LIBS=ON, add missing cmake dependency
Mehdi Amini [Thu, 15 Jun 2023 18:57:35 +0000 (20:57 +0200)]
Fix MLIR build with SHARED_LIBS=ON, add missing cmake dependency

16 months ago[Xtensa] Use parseOptionalToken. NFC
Fangrui Song [Thu, 15 Jun 2023 18:51:52 +0000 (11:51 -0700)]
[Xtensa] Use parseOptionalToken. NFC

16 months ago[DAGCombiner] When combining (sext_inreg (zext X), VT) -> (sext X) don't pass along...
Craig Topper [Thu, 15 Jun 2023 18:42:21 +0000 (11:42 -0700)]
[DAGCombiner] When combining (sext_inreg (zext X), VT) -> (sext X) don't pass along the sext_inreg VT.

ISD::SIGN_EXTEND is only supposed to have one operand, but we
were creating it with 2 operands.

Since we basically never check for extra operands this went
unnoticed.

16 months agoFix test breakage in 879e88693338657aec092db749ddfcb582c65491.
Zequan Wu [Thu, 15 Jun 2023 18:45:19 +0000 (14:45 -0400)]
Fix test breakage in 879e88693338657aec092db749ddfcb582c65491.

16 months ago[libc++][NFC] Reformat params.py
Louis Dionne [Tue, 13 Jun 2023 17:44:51 +0000 (10:44 -0700)]
[libc++][NFC] Reformat params.py

After the Black reformatting changes, the code became pretty hard to
read and inconsistently formatted. This fixes that.

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

16 months ago[MSP430] Use parseOptionalToken. NFC
Fangrui Song [Thu, 15 Jun 2023 18:45:22 +0000 (11:45 -0700)]
[MSP430] Use parseOptionalToken. NFC

16 months ago[mlir][tosa] Improve lowering support for tosa.concat
Spenser Bauman [Thu, 15 Jun 2023 18:22:53 +0000 (11:22 -0700)]
[mlir][tosa] Improve lowering support for tosa.concat

The existing lowering for tosa.concat fails in some instances when the
output shape contains more information the input shapes. The result is
an illegal tensor.empty operation.

This change bases the output shape on the original tosa.concat
operation, while querying the input tensor shapes to build the slicing
operations.

Reviewed By: rsuderman

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

16 months ago[RISCV] Use parseOptionalToken. NFC
Fangrui Song [Thu, 15 Jun 2023 18:35:00 +0000 (11:35 -0700)]
[RISCV] Use parseOptionalToken. NFC

16 months ago[libc] Disable the strtod and strtold tests on NVPTX
Joseph Huber [Thu, 15 Jun 2023 18:00:45 +0000 (13:00 -0500)]
[libc] Disable the strtod and strtold tests on NVPTX

These tests have a single line that fails with a value off-by-one, see
https://lab.llvm.org/buildbot/#/builders/46/builds/50055/steps/12/logs/stdio .
Disable these for now so we can figure out what the error is later.

Reviewed By: lntue

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

16 months ago[libc++][PSTL] Implement std::is_partitioned
Nikolas Klauser [Tue, 13 Jun 2023 17:50:38 +0000 (10:50 -0700)]
[libc++][PSTL] Implement std::is_partitioned

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

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

16 months ago[AMDGPU] Fix VOPD dependency checks during combine
Stanislav Mekhanoshin [Wed, 14 Jun 2023 18:37:44 +0000 (11:37 -0700)]
[AMDGPU] Fix VOPD dependency checks during combine

Check superreg/subreg defs of an instruction when checking for
dependencies. This may cause some regressions, but better be
safe than sorry. Changed tests are affected because of the
implicit-defs of the superregs.

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

16 months ago[mlir][linalg] Fix linalg.conv vectorization for mixed int-fp types
Rob Suderman [Thu, 15 Jun 2023 17:53:28 +0000 (10:53 -0700)]
[mlir][linalg] Fix linalg.conv vectorization for mixed int-fp types

We always assume mixed same type values. Instead of ExtF or ExtSI, we
need SIToFp when the values must be promoted.

Reviewed By: dcaballe

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

16 months ago[libc++] Add tests to make sure that stable algorithms work without memory available
Nikolas Klauser [Thu, 15 Jun 2023 15:40:42 +0000 (08:40 -0700)]
[libc++] Add tests to make sure that stable algorithms work without memory available

Reviewed By: #libc, ldionne

Spies: power-llvm-team, ldionne, libcxx-commits, arichardson, mstorsjo

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

16 months ago[lldb] Introduce DynamicRegisterInfo::CreateFromDict
Alex Langford [Fri, 9 Jun 2023 23:27:49 +0000 (16:27 -0700)]
[lldb] Introduce DynamicRegisterInfo::CreateFromDict

I want to add some error handling to DynamicRegisterInfo because there
are many operations that can fail and many of these operations do not
give meaningful information back to the caller.

To begin that process, I want to add a static method that is responsible
for creating a DynamicRegisterInfo from a StructuredData::Dictionary
(and ArchSpec). This is meant to replace the equivalent constructor
because constructors are ill-equipped to perform error handling.

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

16 months ago[MLIR][Tosa] Pass encoding through `tosa-to-linalg`
rikhuijzer [Thu, 15 Jun 2023 16:42:17 +0000 (18:42 +0200)]
[MLIR][Tosa] Pass encoding through `tosa-to-linalg`

As pointed out by @Sinclair-Dee in
https://github.com/llvm/llvm-project/issues/62304, the `tosa-to-linalg`
conversion ignored the `encoding` attribute.

Also, this patch avoids an assertion error crash on unranked tensors.
Instead, the conversion now throws a "failed to legalize" error.

Fixes #62304 and fixes #63165.

Reviewed By: mehdi_amini

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

16 months ago[mlir][sparse][gpu] enable sm80+ sparsity integration test only when explicitly set
Kun Wu [Thu, 15 Jun 2023 17:05:37 +0000 (17:05 +0000)]
[mlir][sparse][gpu] enable sm80+ sparsity integration test only when explicitly set

Reviewed By: aartbik

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

16 months ago[6/6][Clang][RISCV] Replace indexed segment store with tuple type interfaces
eopXD [Mon, 5 Jun 2023 09:49:24 +0000 (02:49 -0700)]
[6/6][Clang][RISCV] Replace indexed segment store with tuple type interfaces

Depends on D152138.

This is the 6th commit of the patch-set.

This patch makes the indexed segment store intrinsics to use tuple
types.

Reviewed By: rogfer01

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

16 months ago[5/6][Clang][RISCV] Replace indexed segment load with tuple type interfaces
eopXD [Mon, 5 Jun 2023 09:22:30 +0000 (02:22 -0700)]
[5/6][Clang][RISCV] Replace indexed segment load with tuple type interfaces

Depends on D152137.

This is the 5th commit of the patch-set.

This patch makes the indexed segment load intrinsics to use tuple
types.

Reviewed By: rogfer01

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

16 months ago[4/6][Clang][RISCV] Replace strided segment store with tuple type interfaces
eopXD [Mon, 5 Jun 2023 08:50:11 +0000 (01:50 -0700)]
[4/6][Clang][RISCV] Replace strided segment store with tuple type interfaces

Depends on D152136.

This is the 4th commit of the patch-set.

This patch makes the strided segment store intrinsics to use tuple
types.

Reviewed By: rogfer01

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

16 months ago[3/6][Clang][RISCV] Replace strided segment load with tuple type interfaces
eopXD [Mon, 5 Jun 2023 08:39:21 +0000 (01:39 -0700)]
[3/6][Clang][RISCV] Replace strided segment load with tuple type interfaces

Depends on D152135.

This is the 3rd commit of the patch-set.

This patch makes the strided segment load intrinsics to use tuple
types.

Reviewed By: rogfer01

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

16 months ago[2/6][Clang][RISCV] Replace unit-stride segment store with tuple type interfaces
eopXD [Mon, 5 Jun 2023 07:57:51 +0000 (00:57 -0700)]
[2/6][Clang][RISCV] Replace unit-stride segment store with tuple type interfaces

Depends on D152134.

This is the 2nd commit of the patch-set.

This patch makes the unit-stride segment store intrinsics to use tuple
types.

Reviewed By: rogfer01

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

16 months ago[1/6][Clang][RISCV] Replace unit-stride (fault-first) segment load with tuple type...
eopXD [Mon, 5 Jun 2023 07:46:20 +0000 (00:46 -0700)]
[1/6][Clang][RISCV] Replace unit-stride (fault-first) segment load with tuple type interfaces

Depends on D152079.

This patch-set aims to replace the existing segment load/store
intrinsics with tuple-type segment load/store intrinsics. That is, we
are removing in the segment load/store intrinsics.

This is the 1st commit of the patch-set.

This patch makes the unit-stride segment load intrinsics and
unit-stride fault-first segment load intrinsics to use tuple
types.

Reviewed By: rogfer01

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

16 months agoRevert "Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local impor...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 17:36:36 +0000 (19:36 +0200)]
Revert "Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)""

This reverts commit fcc3981626821addc6c77b98006d02030b8ceb7f,
since Bitcode-upgrading code doesn't seem to be deterministic.

16 months ago[ELF] << >>: make RHS less than 64
Fangrui Song [Thu, 15 Jun 2023 17:34:33 +0000 (10:34 -0700)]
[ELF] << >>: make RHS less than 64

The left/right shift linker script operators may trigger UB.
E.g. in linkerscript/end-overflow-check.test, the initial REGION1__PADDED_SR_SHIFT is
uint64_t(-3), cause the following expression to trigger an out-of-range shift in
a ubsan build of lld.

    REGION1__PADDED_SR_SIZE = MAX(1 << REGION1__PADDED_SR_SHIFT, 32);

Protect such UBs by making RHS less than 64.

16 months ago[mlir][sparse] merger extension to support sparsifying arith::CmpI/CmpF operation
Peiming Liu [Mon, 12 Jun 2023 21:47:26 +0000 (21:47 +0000)]
[mlir][sparse] merger extension to support sparsifying arith::CmpI/CmpF operation

Reviewed By: aartbik

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

16 months ago[InstCombine] Verify CmpInst is equality in `foldICmpPow2Test`; PR63327
Noah Goldstein [Thu, 15 Jun 2023 16:37:33 +0000 (11:37 -0500)]
[InstCombine] Verify CmpInst is equality in `foldICmpPow2Test`; PR63327

When D152728 hoisted the code to a helper function, it moved the call
to the helper outside of `foldICmpEquality`, so an equality check is
needed in the helper.

Reviewed By: nikic, fhahn

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

16 months agoRevert "[SelectionDAG][RISCV] Add very basic PromoteIntegerResult/Op support for...
Alan Zhao [Thu, 15 Jun 2023 17:20:03 +0000 (10:20 -0700)]
Revert "[SelectionDAG][RISCV] Add very basic PromoteIntegerResult/Op support for VP_SIGN/ZERO_EXTEND."

This reverts commit 6bf79fb09416b02b3f8589a4998610d70c185dae.

Reason: causes Clang to crash during Chrome debug builds: https://crbug.com/1455144

16 months agoAMDGPU: Add baseline test for propagating amdgpu-waves-per-eu
Matt Arsenault [Sat, 3 Jun 2023 20:44:19 +0000 (16:44 -0400)]
AMDGPU: Add baseline test for propagating amdgpu-waves-per-eu

16 months agoFix NATVIS for some Clang types
Aaron Ballman [Thu, 15 Jun 2023 16:59:36 +0000 (12:59 -0400)]
Fix NATVIS for some Clang types

This updates the definition for ExplicitSpecifier and
DeclarationNameExtra.

16 months agoCleanup the MLIR LSP doc to remove references to the passes
Mehdi Amini [Thu, 15 Jun 2023 16:42:58 +0000 (18:42 +0200)]
Cleanup the MLIR LSP doc to remove references to the passes

The MLIR LSP server initially had plans to support running passes from the
client, but this was never implemented. The doc unnecessarily advise to
register passes and makes reference to LSP server having some interaction
with passes.

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

16 months agoAdd dsymutil dwarf5 tests for darwin
Shubham Sandeep Rastogi [Thu, 1 Jun 2023 20:46:54 +0000 (13:46 -0700)]
Add dsymutil dwarf5 tests for darwin

The first test, dwarf5-macho.test checks to make sure that dsymutil
generates the correct headers and sections for a macho binary with
DWARF v5 in it.

The second test, dwarf5-dwarf4-combination-macho.test checks that
dsymutil generates the correct headers and sections for a macho binary
with which was linked with one object file with DWARF v4 and the other
with DWARF v5 in it.

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

16 months ago[DebugInfo] Fix detection of hash collision in Apple Accel tables
Felipe de Azevedo Piovezan [Fri, 9 Jun 2023 21:40:32 +0000 (17:40 -0400)]
[DebugInfo] Fix detection of hash collision in Apple Accel tables

The current implementation was ignoring the possibility of collisions.

Differential Revision: D152586

16 months ago[lld-macho] Switch to new tool ID
Keith Smiley [Wed, 14 Jun 2023 15:51:30 +0000 (08:51 -0700)]
[lld-macho] Switch to new tool ID

As of Xcode 15 there is now a tool ID for LLD, likely driven by Apple's
tests with using LLD for their CAS work in clang. This updates LLD to
use the correct ID, and updates the object library so that llvm-objdump
prints it correctly.

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

16 months agoRevert "[DebugInfo] Fix detection of hash collision in Apple Accel tables"
Felipe de Azevedo Piovezan [Thu, 15 Jun 2023 16:36:58 +0000 (12:36 -0400)]
Revert "[DebugInfo] Fix detection of hash collision in Apple Accel tables"

Committed a slightly older patch without the proper link to the review.

This reverts commit 42874f66475548541cd871d5790116b2bc68b89a.

16 months ago[DebugInfo] Fix detection of hash collision in Apple Accel tables
Felipe de Azevedo Piovezan [Fri, 9 Jun 2023 21:40:32 +0000 (17:40 -0400)]
[DebugInfo] Fix detection of hash collision in Apple Accel tables

The current implementation was ignoring the possibility of collisions.

16 months ago[gn] port 05634f7346a5 (bolt -> JITLink)
Nico Weber [Thu, 15 Jun 2023 16:16:11 +0000 (09:16 -0700)]
[gn] port 05634f7346a5 (bolt -> JITLink)

16 months ago[gn] port 98f70e94e0592
Nico Weber [Thu, 15 Jun 2023 16:22:12 +0000 (09:22 -0700)]
[gn] port 98f70e94e0592

16 months ago[gn] port 80e4ccab794c
Nico Weber [Thu, 15 Jun 2023 16:15:46 +0000 (09:15 -0700)]
[gn] port 80e4ccab794c

16 months agoReland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 16:12:00 +0000 (18:12 +0200)]
Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"

Run split-dwarf-local-impor3.ll only on x86_64-linux.

16 months ago[libc++][modules] Adds the C++23 std module.
Mark de Wever [Tue, 28 Feb 2023 19:29:26 +0000 (20:29 +0100)]
[libc++][modules] Adds the C++23 std module.

The patch is based on D144994.

D151030 added the module definitions for the module std.
This patch wires in the module and enables the basic testing.

Some notable features are missing:
- There is no test that libc++ can be fully imported as a module.
- This lacks the parts for the std.compat module.
- The module is not shipped with libc++.

Implements parts of
- P2465R3 Standard Library Modules std and std.compat

Reviewed By: ldionne, aaronmondal, #libc

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

16 months ago[libc++][modules] Update the .cppm files.
Mark de Wever [Thu, 15 Jun 2023 16:12:06 +0000 (18:12 +0200)]
[libc++][modules] Update the .cppm files.

There are some minor fixes in the definiton and it is synced with
upstream changes.

This has been reviewed as part of D151814.

16 months agoRevert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 16:04:32 +0000 (18:04 +0200)]
Revert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"

This reverts commit d80fdc6fc1a6e717af1bcd7a7313e65de433ba85.
split-dwarf-local-impor3.ll fails because of an issue with
Dwo sections emission on Windows platform.

16 months ago[libc] Export GPU extensions to `libc` for external use
Joseph Huber [Tue, 6 Jun 2023 16:10:44 +0000 (11:10 -0500)]
[libc] Export GPU extensions to `libc` for external use

The GPU port of the LLVM C library needs to export a few extensions to
the interface such that users can interface with it. This patch adds the
necessary logic to define a GPU extension. Currently, this only exports
a `rpc_reset_client` function. This allows us to use the server in
D147054 to set up the RPC interface outside of `libc`.

Depends on https://reviews.llvm.org/D147054

Reviewed By: sivachandra

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

16 months ago[libc] Begin implementing a library for the RPC server
Joseph Huber [Mon, 5 Jun 2023 20:32:38 +0000 (15:32 -0500)]
[libc] Begin implementing a library for the RPC server

This patch begins providing a generic static library that wraps around
the raw `rpc.h` interface. As discussed in the corresponding RFC,
https://discourse.llvm.org/t/rfc-libc-exporting-the-rpc-interface-for-the-gpu-libc/71030,
we want to begin exporting RPC services to external users. In order to
do this we decided to not expose the `rpc.h` header by wrapping around
its functionality. This is done with a C-interface as we make heavy use
of callbacks and allows us to provide a predictable interface.

Reviewed By: JonChesterfield, sivachandra

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

16 months ago[Hexagon] Do not track reserved regs in RDF optimizations
Krzysztof Parzyszek [Tue, 6 Jun 2023 14:08:08 +0000 (07:08 -0700)]
[Hexagon] Do not track reserved regs in RDF optimizations

16 months ago[libc++] Merge _LIBCPP_FUNC_VIS, _LIBCPP_TYPE_VIS and _LIBCPP_EXCEPTION_ABI into...
Nikolas Klauser [Wed, 14 Jun 2023 17:17:50 +0000 (10:17 -0700)]
[libc++] Merge _LIBCPP_FUNC_VIS, _LIBCPP_TYPE_VIS and _LIBCPP_EXCEPTION_ABI into _LIBCPP_EXPORTED_FROM_ABI

These macros are always defined identically, so we can simplify the code a bit by merging them.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, krytarowski, smeenai

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

16 months agoHIP: Add a few more cmath header tests
Matt Arsenault [Tue, 13 Jun 2023 23:05:54 +0000 (19:05 -0400)]
HIP: Add a few more cmath header tests

16 months agoOpenMP: Add a new test for constantexpr evaluation of math headers
Matt Arsenault [Tue, 13 Jun 2023 22:18:32 +0000 (18:18 -0400)]
OpenMP: Add a new test for constantexpr evaluation of math headers

16 months ago[libc++abi] Avoid including source files into unittest_demangle
Louis Dionne [Tue, 13 Jun 2023 21:56:08 +0000 (14:56 -0700)]
[libc++abi] Avoid including source files into unittest_demangle

That is not necessary to test what we're testing, and in fact including
abort_message.cpp into that file caused some link errors if we didn't
link some of the dependencies of libc++abi directly into the test.

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

16 months ago[AArch64] Address post-commit comments from D150482.
Florian Hahn [Thu, 15 Jun 2023 15:38:09 +0000 (16:38 +0100)]
[AArch64] Address post-commit comments from D150482.

Address @v01dXYZ's comments, thanks!

16 months agoReland "[Clang][MS] Remove assertion on BaseOffset can't be smaller than Size."
Zequan Wu [Thu, 15 Jun 2023 15:33:02 +0000 (11:33 -0400)]
Reland "[Clang][MS] Remove assertion on BaseOffset can't be smaller than Size."

This reland 5d54213ee557a86fae82af0f75498adf02f24e82 with fixes.

16 months ago[CMake] Fixes using CMake 3.27.0.
Mark de Wever [Sat, 10 Jun 2023 11:45:13 +0000 (13:45 +0200)]
[CMake] Fixes using CMake 3.27.0.

Testing libc++ with CMake 3.27.0-rc1 fails. It seems some of the modules
used in CMake are not included.

The error before this change was
```
CMake Error at <mono-repo>/llvm/cmake/modules/HandleLLVMOptions.cmake:821 (CHECK_C_SOURCE_COMPILES):
  Unknown CMake command "CHECK_C_SOURCE_COMPILES".
Call Stack (most recent call first):
  CMakeLists.txt:156 (include)
```

Reviewed By: thesamesam

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

16 months ago[libc++] Don't automatically define LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS with libcxxrt
Louis Dionne [Wed, 14 Jun 2023 22:23:02 +0000 (15:23 -0700)]
[libc++] Don't automatically define LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS with libcxxrt

libcxxrt is only used on FreeBSD and the FreeBSD CMake cache already
sets LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS to ON, as it should. This
avoids defining LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS redundantly in
a place where it doesn't belong.

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

16 months ago[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 10:22:16 +0000 (12:22 +0200)]
[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Fixed PR51501 (tests from D112337).

1. Reuse of DISubprogram's 'retainedNodes' to track other function-local
   entities together with local variables and labels (this patch cares about
   function-local import while D144006 and D144008 use the same approach for
   local types and static variables). So, effectively this patch moves ownership
   of tracking local import from DICompileUnit's 'imports' field to DISubprogram's
   'retainedNodes' and adjusts DWARF emitter for the new layout. The old layout
   is considered unsupported (DwarfDebug would assert on such debug metadata).

   DICompileUnit's 'imports' field is supposed to track global imported
   declarations as it does before.

   This addresses various FIXMEs and simplifies the next part of the patch.

2. Postpone emission of function-local imported entities from
   `DwarfDebug::endFunctionImpl()` to `DwarfDebug::endModule()`.
   While in `DwarfDebug::endFunctionImpl()` we do not have all the
   information about a parent subprogram or a referring subprogram
   (whether a subprogram inlined or not), so we can't guarantee we emit
   an imported entity correctly and place it in a proper subprogram tree.
   So now, we just gather needed details about the import itself and its
   parent entity (either a Subprogram or a LexicalBlock) during
   processing in `DwarfDebug::endFunctionImpl()`, but all the real work is
   done in `DwarfDebug::endModule()` when we have all the required
   information to make proper emission.

Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>
Differential Revision: https://reviews.llvm.org/D144004

16 months ago[libc++][NFC] clang-format new_handler.cpp
Louis Dionne [Wed, 14 Jun 2023 20:44:46 +0000 (13:44 -0700)]
[libc++][NFC] clang-format new_handler.cpp

16 months ago[libc++] Move the definition of std::new_handler out of new.cpp
Louis Dionne [Wed, 14 Jun 2023 20:37:57 +0000 (13:37 -0700)]
[libc++] Move the definition of std::new_handler out of new.cpp

This reduces the difference between libc++'s new.cpp and libc++abi's
stdlib_new_delete.cpp files, which are essentially copies of each other.

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

16 months agoRevert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 14:53:36 +0000 (16:53 +0200)]
Revert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"

This reverts commit ed578f02cf44a52adde16647150e7421f3ef70f3.

Tests llvm/test/DebugInfo/Generic/split-dwarf-local-import*.ll fail
when x86_64 target is not registered.

16 months ago[libc] Enable conversion functions on the GPU
Joseph Huber [Thu, 15 Jun 2023 13:18:11 +0000 (08:18 -0500)]
[libc] Enable conversion functions on the GPU

These functions were previously removed due to problems running the
tests with `errno` in them. This was resolved previously by making the
internal implementation of these functions use a global `errno` so that
tests can still use `errno` functionality as long as they are run with a
single thread. This allows us to re-enable these tests as a previous
patch has also resolved the issue where the `stdlib` tests could not be
hermetic due to the dependence on system rounding functions.

Reviewed By: lntue

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

16 months ago[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 10:22:16 +0000 (12:22 +0200)]
[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Fixed PR51501 (tests from D112337).

1. Reuse of DISubprogram's 'retainedNodes' to track other function-local
   entities together with local variables and labels (this patch cares about
   function-local import while D144006 and D144008 use the same approach for
   local types and static variables). So, effectively this patch moves ownership
   of tracking local import from DICompileUnit's 'imports' field to DISubprogram's
   'retainedNodes' and adjusts DWARF emitter for the new layout. The old layout
   is considered unsupported (DwarfDebug would assert on such debug metadata).

   DICompileUnit's 'imports' field is supposed to track global imported
   declarations as it does before.

   This addresses various FIXMEs and simplifies the next part of the patch.

2. Postpone emission of function-local imported entities from
   `DwarfDebug::endFunctionImpl()` to `DwarfDebug::endModule()`.
   While in `DwarfDebug::endFunctionImpl()` we do not have all the
   information about a parent subprogram or a referring subprogram
   (whether a subprogram inlined or not), so we can't guarantee we emit
   an imported entity correctly and place it in a proper subprogram tree.
   So now, we just gather needed details about the import itself and its
   parent entity (either a Subprogram or a LexicalBlock) during
   processing in `DwarfDebug::endFunctionImpl()`, but all the real work is
   done in `DwarfDebug::endModule()` when we have all the required
   information to make proper emission.

Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>
Differential Revision: https://reviews.llvm.org/D144004

16 months ago[GlobalIsel][X86] Add handling for G_MERGE_VALUES/G_UNMERGE_VALUES
Simon Pilgrim [Thu, 15 Jun 2023 14:03:53 +0000 (15:03 +0100)]
[GlobalIsel][X86] Add handling for G_MERGE_VALUES/G_UNMERGE_VALUES

Replace the legacy legalizer versions - just use raw type sizes for now, we can add type specific handling if/when we need it

Fixes #63105

16 months ago[clang][Diagnostics] Don't expand label fixit to the next line
Timm Bäder [Fri, 9 Jun 2023 12:01:07 +0000 (14:01 +0200)]
[clang][Diagnostics] Don't expand label fixit to the next line

Now that we print >1 line of code snippet, we printed another line of
code for now reason, because the source range we created for the fixit
expanded to the next line, if the next token was there. Don't do that.

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

16 months agoLangRef: Delete trailing whitespace
Matt Arsenault [Wed, 14 Jun 2023 14:22:14 +0000 (10:22 -0400)]
LangRef: Delete trailing whitespace

16 months agoAMDGPU: Assume llvm.amdgcn.exp2 and log are canonicalizing
Matt Arsenault [Thu, 15 Jun 2023 13:48:58 +0000 (09:48 -0400)]
AMDGPU: Assume llvm.amdgcn.exp2 and log are canonicalizing

This was partially handled for log in SelectionDAG and both were
missed for GlobalISel.

16 months ago[bazel][bolt] Port 05634f7346a59f6dab89cde53f39b40d9a70b9c9
Benjamin Kramer [Thu, 15 Jun 2023 13:42:08 +0000 (15:42 +0200)]
[bazel][bolt] Port 05634f7346a59f6dab89cde53f39b40d9a70b9c9

16 months agoAMDGPU: Delete some stray / dead check prefixes
Matt Arsenault [Wed, 14 Jun 2023 23:34:54 +0000 (19:34 -0400)]
AMDGPU: Delete some stray / dead check prefixes

16 months agoValueTracking: Fix nan result handling for fmul
Matt Arsenault [Wed, 14 Jun 2023 19:41:22 +0000 (15:41 -0400)]
ValueTracking: Fix nan result handling for fmul

This was mishandling maybe 0 * inf.

Fixes issue #63316

16 months agoValueTracking: Add some baseline tests for issue #63316
Matt Arsenault [Wed, 14 Jun 2023 19:14:04 +0000 (15:14 -0400)]
ValueTracking: Add some baseline tests for issue #63316

16 months ago[clang-tidy] Correct the include-cleaner-check diagnostic message for missing-includes.
Haojian Wu [Thu, 15 Jun 2023 11:48:50 +0000 (13:48 +0200)]
[clang-tidy] Correct the include-cleaner-check diagnostic message for missing-includes.

We should print the symbol name rather than the header name in the
message.

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

16 months ago[NFC] Autogenerate CodeGen/SPARC/LeonInsertNOPLoadPassUT.ll
Amaury Séchet [Thu, 15 Jun 2023 12:32:22 +0000 (12:32 +0000)]
[NFC] Autogenerate CodeGen/SPARC/LeonInsertNOPLoadPassUT.ll

16 months ago[AMDGPU] Trim trailing undefs from the end of image and buffer store
Mateja Marjanovic [Thu, 8 Jun 2023 12:29:47 +0000 (14:29 +0200)]
[AMDGPU] Trim trailing undefs from the end of image and buffer store

Remove undef values from the end of the vector operand in image and
buffer store instructions.
Also instead of call to computeKnownFPClass, use only findScalarElement.

Continuation of: 88421ea973916e Trim zero components from buffer and image stores

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

16 months ago[GlobalIsel][X86] Remove unused private field 'TM' in X86LegalizerInfo (NFC)
Jie Fu [Thu, 15 Jun 2023 13:15:45 +0000 (21:15 +0800)]
[GlobalIsel][X86] Remove unused private field 'TM' in X86LegalizerInfo (NFC)

/data/llvm-project/llvm/lib/Target/X86/X86LegalizerInfo.h:30:27: error: private field 'TM' is not used [-Werror,-Wunused-private-field]
  const X86TargetMachine &TM;
                          ^
1 error generated.

16 months ago[GlobalIsel][X86] Add handling for G_LOAD/G_SEXTLOAD/G_ZEXTLOAD/G_STORE
Simon Pilgrim [Thu, 15 Jun 2023 12:56:53 +0000 (13:56 +0100)]
[GlobalIsel][X86] Add handling for G_LOAD/G_SEXTLOAD/G_ZEXTLOAD/G_STORE

Replace the legacy legalizer versions and add initial scalar extload handling

16 months ago[AArch64CompressJumpTables] Prevent over-compression caused by invalid alignment.
Paul Walker [Tue, 6 Jun 2023 17:21:16 +0000 (18:21 +0100)]
[AArch64CompressJumpTables] Prevent over-compression caused by invalid alignment.

AArch64CompressJumpTables assumes it can calculate exact block
offsets. This assumption is bogus because getInstSizeInBytes()
only returns an upper bound rather than an exact size. The
assumption is also invalid when a block alignment is bigger than
the function's alignment.

To mitigate both scenarios this patch changes the algorithm to
compute the maximum upper bound for all block offsets. This is
pessimistic but safe because all offsets are treated as unsigned.

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

16 months agoRevert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 12:35:43 +0000 (14:35 +0200)]
Revert "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"

This reverts commit d04452d54829cd7af5b43d670325ffa755ab0030 since
test llvm-project/llvm/test/Bitcode/DIImportedEntity_backward.ll is broken.

16 months ago[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities...
Vladislav Dzhidzhoev [Thu, 15 Jun 2023 10:22:16 +0000 (12:22 +0200)]
[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Fixed PR51501 (tests from D112337).

1. Reuse of DISubprogram's 'retainedNodes' to track other function-local
   entities together with local variables and labels (this patch cares about
   function-local import while D144006 and D144008 use the same approach for
   local types and static variables). So, effectively this patch moves ownership
   of tracking local import from DICompileUnit's 'imports' field to DISubprogram's
   'retainedNodes' and adjusts DWARF emitter for the new layout. The old layout
   is considered unsupported (DwarfDebug would assert on such debug metadata).

   DICompileUnit's 'imports' field is supposed to track global imported
   declarations as it does before.

   This addresses various FIXMEs and simplifies the next part of the patch.

2. Postpone emission of function-local imported entities from
   `DwarfDebug::endFunctionImpl()` to `DwarfDebug::endModule()`.
   While in `DwarfDebug::endFunctionImpl()` we do not have all the
   information about a parent subprogram or a referring subprogram
   (whether a subprogram inlined or not), so we can't guarantee we emit
   an imported entity correctly and place it in a proper subprogram tree.
   So now, we just gather needed details about the import itself and its
   parent entity (either a Subprogram or a LexicalBlock) during
   processing in `DwarfDebug::endFunctionImpl()`, but all the real work is
   done in `DwarfDebug::endModule()` when we have all the required
   information to make proper emission.

Authored-by: Kristina Bessonova <kbessonova@accesssoftek.com>
Differential Revision: https://reviews.llvm.org/D144004

16 months ago[InstCombine][CGP] Move swapMayExposeCSEOpportunities() fold
Nikita Popov [Fri, 9 Jun 2023 14:21:39 +0000 (16:21 +0200)]
[InstCombine][CGP] Move swapMayExposeCSEOpportunities() fold

InstCombine tries to swap compare operands to match sub instructions
in order to expose "CSE opportunities". However, it doesn't really
make sense to perform this transform in the middle-end, as we cannot
actually CSE the instructions there.

The backend already performs this fold in
https://github.com/llvm/llvm-project/blob/18f5446a45da5a61dbfb1b7667d27fb441ac62db/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp#L4236
on the SDAG level, however this only works within a single basic block.

To handle cross-BB cases, we do need to handle this in the IR layer.
This patch moves the fold from InstCombine to CGP in the backend,
while keeping the same (somewhat dubious) heuristic.

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

16 months ago[OpenMP] Correctly diagnose conflicting target identifierers for AMDGPU
Joseph Huber [Wed, 14 Jun 2023 21:58:11 +0000 (16:58 -0500)]
[OpenMP] Correctly diagnose conflicting target identifierers for AMDGPU

There are static checks on the target identifiers allowed in a single
TU. Previously theses checks were only applied to HIP even though they
should be the same for OpenMP targeting AMDGPU. Simply enable these
checks for OpenMP.

Reviewed By: JonChesterfield, yaxunl

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

16 months ago[libc] Move the definitions of the standard IO streams to the platform
Joseph Huber [Wed, 14 Jun 2023 23:59:29 +0000 (18:59 -0500)]
[libc] Move the definitions of the standard IO streams to the platform

This patch moves the definitions of the standard IO streams to the
platform file definition. This is necessary because previously we had a
level of indirection where the stream's `FILE *` was initialized based
on the pointer to the internal `__llvm_libc` version. This cannot be
resolved ahead of time by the linker because the address will not be
known until runtime. This caused the previous implementation to emit a
global constructor to initialize the pointer to the actual `FILE *`. By
moving these definitions so that we can bind their address to the
original file type we can avoid this global constructor.

This file keeps the entrypoints, but makes them empty files only
containing an external reference. This is so they still appear as
entrypoints and get emitted as declarations in the generated headers.

Reviewed By: lntue, sivachandra

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

16 months ago[GlobalIsel][X86] Add handling for G_FRAME_INDEX/G_GLOBAL_VALUE
Simon Pilgrim [Thu, 15 Jun 2023 11:53:29 +0000 (12:53 +0100)]
[GlobalIsel][X86] Add handling for G_FRAME_INDEX/G_GLOBAL_VALUE

Replace the legacy legalizer versions

16 months agoFix the LLVM Sphinx build
Aaron Ballman [Thu, 15 Jun 2023 11:56:42 +0000 (07:56 -0400)]
Fix the LLVM Sphinx build

This addresses the issue found in:
https://lab.llvm.org/buildbot/#/builders/30/builds/36346

16 months agoNo longer diagnose (functionally) empty structures under -Wuninitialized
Aaron Ballman [Thu, 15 Jun 2023 11:43:31 +0000 (07:43 -0400)]
No longer diagnose (functionally) empty structures under -Wuninitialized

An empty structure in C has no way to be initialized, so triggering a
-Wuninitialized warning for a variable of empty structure type is not
actionable for users. This silences the false positive warning, which
matches the behavior of GCC as well.

We no longer diagnose if the structure has no members, or has only
zero-sized members (unnamed bit-fields, zero-sized bit-fields, empty
structure types).

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