SuccessChanges

Summary

  1. [CodeGen] add test for NAN creation; NFC (details)
  2. [Sema] Support Comma operator for fp16 vectors. (details)
  3. Fix interaction of `constinit` and `weak`. (details)
  4. [OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload (details)
  5. [OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def (details)
  6. [AIX][Clang][Driver] Link libm in c++ mode (details)
  7. Exception support for basic block sections (details)
  8. [lldb/ipv6] Support running lldb tests in an ipv6-only environment. (details)
  9. [MLIR] Add async.value type to Async dialect (details)
  10. [lldb-vscode] Allow an empty 'breakpoints' field to clear breakpoints. (details)
  11. Fix crash in SBStructuredData::GetDescription() when there's no StructuredDataPlugin. (details)
  12. [test][NewPM][SampleProfile] Fix more tests under NPM (details)
  13. [libc++] Make sure we don't attempt to run check-cxx-abilist when libc++ doesn't define new/delete (details)
  14. Revert "[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload" (details)
  15. [CodeGen] improve coverage for float (32-bit) type of NAN; NFC (details)
  16. Revert "[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def" (details)
  17. Add GDB prettyprinters for a few more MLIR types. (details)
  18. [mlir][vector] First step of vector distribution transformation (details)
Commit 187686bea3878c0bf2b150d784e7eab223434e25 by spatel
[CodeGen] add test for NAN creation; NFC

This goes with the APFloat change proposed in
D88238.
This is copied from the MIPS-specific test in
builtin-nan-legacy.c to verify that the normal
behavior is correct on other targets without the
complication of an inverted quiet bit.
The file was addedclang/test/CodeGen/builtin-nan-exception.c
Commit 700e63293eea4a23440f300b1e9125ca2e80c6e9 by flo
[Sema] Support Comma operator for fp16 vectors.

The current half vector was enforcing an assert expecting
"(LHS is half vector) == (RHS is half vector)"
for comma.

Reviewed By: ahatanak, fhahn

Differential Revision: https://reviews.llvm.org/D88265
The file was modifiedclang/lib/Sema/SemaExpr.cpp
The file was modifiedclang/test/Sema/fp16vec-sema.c
Commit 892df30a7f344b6cb9995710efbc94bb25cfb95b by richard
Fix interaction of `constinit` and `weak`.

We previously took a shortcut and said that weak variables never have
constant initializers (because those initializers are never correct to
use outside the variable). We now say that weak variables can have
constant initializers, but are never usable in constant expressions.
The file was modifiedclang/lib/Sema/SemaDeclCXX.cpp
The file was modifiedclang/lib/AST/Decl.cpp
The file was addedclang/test/SemaCXX/cxx20-constinit.cpp
The file was modifiedclang/lib/AST/ExprConstant.cpp
Commit 9d2378b59150f6f1cb5c9cf42ea06b0bb57029a1 by huberjn
[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload

Summary:
This patch adds an error to Clang that detects if OpenMP offloading is used
between two architectures with incompatible pointer sizes. This ensures that
the data mapping can be done correctly and solves an issue in code generation
generating the wrong size pointer.

Reviewer: jdoerfert

Subscribers:

Tags: #OpenMP #Clang

Differential Revision:
The file was modifiedclang/include/clang/Basic/DiagnosticDriverKinds.td
The file was modifiedclang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
The file was addedclang/test/OpenMP/target_incompatible_architecture_messages.cpp
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
Commit 90eaedda9b8ef46e2c0c1b8bce33e98a3adbb68c by jhuber6
[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def

Summary:
Replace the OpenMP Runtime Library functions used in CGOpenMPRuntimeGPU
for OpenMP device code generation with ones in OMPKinds.def and use
OMPIRBuilder for generating runtime calls. This allows us to consolidate
more OpenMP code generation into the OMPIRBuilder. This patch also
invalidates specifying target architectures with conflicting pointer
sizes.

Reviewers: jdoerfert

Subscribers: aaron.ballman cfe-commits guansong llvm-commits sstefan1 yaxunl

Tags: #OpenMP #Clang #LLVM

Differential Revision: https://reviews.llvm.org/D88430
The file was modifiedclang/lib/CodeGen/CGOpenMPRuntime.h
The file was modifiedclang/lib/CodeGen/CodeGenModule.h
The file was modifiedclang/test/OpenMP/nvptx_parallel_codegen.cpp
The file was modifiedllvm/include/llvm/Frontend/OpenMP/OMPKinds.def
The file was modifiedllvm/test/Transforms/OpenMP/add_attributes.ll
The file was modifiedclang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
Commit afc277b0ed0dcd9fbbde6015bbdf289349fb2104 by daltenty
[AIX][Clang][Driver] Link libm in c++ mode

since that is the normal behaviour of other compilers on the platform.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D88500
The file was modifiedclang/test/Driver/aix-ld.c
The file was modifiedclang/lib/Driver/ToolChains/AIX.cpp
Commit 8955950c121c97a686310991203c89ba14c90b82 by rahmanl
Exception support for basic block sections

This is part of the Propeller framework to do post link code layout optimizations. Please see the RFC here: https://groups.google.com/forum/#!msg/llvm-dev/ef3mKzAdJ7U/1shV64BYBAAJ and the detailed RFC doc here: https://github.com/google/llvm-propeller/blob/plo-dev/Propeller_RFC.pdf

This patch provides exception support for basic block sections by splitting the call-site table into call-site ranges corresponding to different basic block sections. Still all landing pads must reside in the same basic block section (which is guaranteed by the the core basic block section patch D73674 (ExceptionSection) ). Each call-site table will refer to the landing pad fragment by explicitly specifying @LPstart (which is omitted in the normal non-basic-block section case). All these call-site tables will share their action and type tables.

The C++ ABI somehow assumes that no landing pads point directly to LPStart (which works in the normal case since the function begin is never a landing pad), and uses LP.offset = 0 to specify no landing pad. In the case of basic block section where one section contains all the landing pads, the landing pad offset relative to LPStart could actually be zero. Thus, we avoid zero-offset landing pads by inserting a **nop** operation as the first non-CFI instruction in the exception section.

**Background on Exception Handling in C++ ABI**
https://github.com/itanium-cxx-abi/cxx-abi/blob/master/exceptions.pdf

Compiler emits an exception table for every function. When an exception is thrown, the stack unwinding library queries the unwind table (which includes the start and end of each function) to locate the exception table for that function.

The exception table includes a call site table for the function, which is used to guide the exception handling runtime to take the appropriate action upon an exception. Each call site record in this table is structured as follows:

| CallSite                       |  -->  Position of the call site (relative to the function entry)
| CallSite length           |  -->  Length of the call site.
| Landing Pad               |  -->  Position of the landing pad (relative to the landing pad fragment’s begin label)
| Action record offset  |  -->  Position of the first action record

The call site records partition a function into different pieces and describe what action must be taken for each callsite. The callsite fields are relative to the start of the function (as captured in the unwind table).

The landing pad entry is a reference into the function and corresponds roughly to the catch block of a try/catch statement. When execution resumes at a landing pad, it receives an exception structure and a selector value corresponding to the type of the exception thrown, and executes similar to a switch-case statement. The landing pad field is relative to the beginning of the procedure fragment which includes all the landing pads (@LPStart). The C++ ABI requires all landing pads to be in the same fragment. Nonetheless, without basic block sections, @LPStart is the same as the function @Start (found in the unwind table) and can be omitted.

The action record offset is an index into the action table which includes information about which exception types are caught.

**C++ Exceptions with Basic Block Sections**
Basic block sections break the contiguity of a function fragment. Therefore, call sites must be specified relative to the beginning of the basic block section. Furthermore, the unwinding library should be able to find the corresponding callsites for each section. To do so, the .cfi_lsda directive for a section must point to the range of call-sites for that section.
This patch introduces a new **CallSiteRange** structure which specifies the range of call-sites which correspond to every section:

  `struct CallSiteRange {
    // Symbol marking the beginning of the precedure fragment.
    MCSymbol *FragmentBeginLabel = nullptr;
    // Symbol marking the end of the procedure fragment.
    MCSymbol *FragmentEndLabel = nullptr;
    // LSDA symbol for this call-site range.
    MCSymbol *ExceptionLabel = nullptr;
    // Index of the first call-site entry in the call-site table which
    // belongs to this range.
    size_t CallSiteBeginIdx = 0;
    // Index just after the last call-site entry in the call-site table which
    // belongs to this range.
    size_t CallSiteEndIdx = 0;
    // Whether this is the call-site range containing all the landing pads.
    bool IsLPRange = false;
  };`

With N basic-block-sections, the call-site table is partitioned into N call-site ranges.

Conceptually, we emit the call-site ranges for sections sequentially in the exception table as if each section has its own exception table. In the example below, two sections result in the two call site ranges (denoted by LSDA1 and LSDA2) placed next to each other. However, their call-sites will refer to records in the shared Action Table. We also emit the header fields (@LPStart and CallSite Table Length) for each call site range in order to place the call site ranges in separate LSDAs. We note that with -basic-block-sections, The CallSiteTableLength will not actually represent the length of the call site table, but rather the reference to the action table. Since the only purpose of this field is to locate the action table, correctness is guaranteed.

Finally, every call site range has one @LPStart pointer so the landing pads of each section must all reside in one section (not necessarily the same section). To make this easier, we decide to place all landing pads of the function in one section (hence the `IsLPRange` field in CallSiteRange).

|  @LPStart                   |  --->  Landing pad fragment     ( LSDA1 points here)
| CallSite Table Length | ---> Used to find the action table.
| CallSites                     |
| …                                 |
| …                                 |
| @LPStart                    |  --->  Landing pad fragment ( LSDA2 points here)
| CallSite Table Length |
| CallSites                     |
| …                                 |
| …                                 |


|      Action Table          |
|      Types Table           |

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D73739
The file was modifiedllvm/include/llvm/CodeGen/AsmPrinterHandler.h
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
The file was addedllvm/test/CodeGen/X86/gcc_except_table_bb_sections_ehpad_groups_with_cold.ll
The file was modifiedllvm/lib/CodeGen/AsmPrinter/EHStreamer.h
The file was modifiedllvm/include/llvm/CodeGen/AsmPrinter.h
The file was modifiedllvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
The file was modifiedllvm/lib/CodeGen/AsmPrinter/WasmException.cpp
The file was modifiedllvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
The file was modifiedllvm/lib/CodeGen/BasicBlockSections.cpp
The file was addedllvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll
The file was modifiedllvm/lib/CodeGen/AsmPrinter/WasmException.h
The file was modifiedllvm/lib/Target/ARM/ARMAsmPrinter.cpp
Commit c3193e464cbd5e8b7cade103032c222bf8bc0e27 by rupprecht
[lldb/ipv6] Support running lldb tests in an ipv6-only environment.

When running in an ipv6-only environment where `AF_INET` sockets are not available, many lldb tests (mostly gdb remote tests) fail because things like `127.0.0.1` don't work there.

Use `localhost` instead of `127.0.0.1` whenever possible, or include a fallback of creating `AF_INET6` sockets when `AF_INET` fails.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D87333
The file was modifiedlldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
The file was modifiedlldb/test/API/tools/lldb-server/commandline/TestStubReverseConnect.py
The file was modifiedlldb/tools/lldb-server/lldb-gdbserver.cpp
The file was modifiedlldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
The file was modifiedlldb/unittests/Host/SocketTest.cpp
The file was modifiedlldb/unittests/Host/SocketTestUtilities.cpp
The file was modifiedlldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
Commit 655af658c93bf7f133341e7eb5a2dfa176282781 by ezhulenev
[MLIR] Add async.value type to Async dialect

Return values from async regions as !async.value<...>.

Reviewed By: mehdi_amini, csigg

Differential Revision: https://reviews.llvm.org/D88510
The file was modifiedmlir/include/mlir/Dialect/Async/IR/Async.h
The file was modifiedmlir/include/mlir/Dialect/Async/IR/AsyncBase.td
The file was modifiedmlir/include/mlir/Dialect/Async/IR/AsyncOps.td
The file was modifiedmlir/lib/Dialect/Async/IR/Async.cpp
The file was modifiedmlir/test/Dialect/Async/ops.mlir
Commit ad865d9d10b8cf93738470175aae1be7a4a3eb6b by rupprecht
[lldb-vscode] Allow an empty 'breakpoints' field to clear breakpoints.

Per the DAP spec for SetBreakpoints [1], the way to clear breakpoints is: `To clear all breakpoint for a source, specify an empty array.`

However, leaving the breakpoints field unset is also a well formed request (note the `breakpoints?:` in the `SetBreakpointsArguments` definition). If it's unset, we have a couple choices:

1. Crash (current behavior)
2. Clear breakpoints
3. Return an error response that the breakpoints field is missing.

I propose we do (2) instead of (1), and treat an unset breakpoints field the same as an empty breakpoints field.

[1] https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetBreakpoints

Reviewed By: wallace, labath

Differential Revision: https://reviews.llvm.org/D88513
The file was modifiedlldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
The file was modifiedlldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
The file was modifiedlldb/tools/lldb-vscode/lldb-vscode.cpp
Commit afaeb6af79a4278249ef9114755e5685d0b35984 by jingham
Fix crash in SBStructuredData::GetDescription() when there's no StructuredDataPlugin.

Also, use the StructuredData::Dump method to print the StructuredData if there
is no plugin, rather than just returning an error.

Differential Revision: https://reviews.llvm.org/D88266
The file was modifiedlldb/include/lldb/Core/StructuredDataImpl.h
The file was modifiedlldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
Commit 2d761a368c3637cb6a6b05eb10ac8d839efe77cc by aeubanks
[test][NewPM][SampleProfile] Fix more tests under NPM

These all have separate legacy and new PM RUN lines.
The file was modifiedllvm/test/Transforms/SampleProfile/profile-sample-accurate.ll
The file was modifiedllvm/test/Transforms/SampleProfile/flattened.ll
The file was modifiedllvm/test/Transforms/SampleProfile/inline-mergeprof.ll
Commit 490b556a0f3c9daddd05651d945662b93b3b13b9 by Louis Dionne
[libc++] Make sure we don't attempt to run check-cxx-abilist when libc++ doesn't define new/delete

That would make the test fail spuriously because we don't generate
an ABI list for that configuration.
The file was modifiedlibcxx/lib/abi/CMakeLists.txt
Commit bdc85292fb0f2a3965c8c65f9461d285b04841ed by huberjn
Revert "[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload"

Failing tests on Arm due to the tests automatically populating
incomatible pointer width architectures. Reverting until the tests are
updated. Failing tests:

OpenMP/distribute_parallel_for_num_threads_codegen.cpp
OpenMP/distribute_parallel_for_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp

This reverts commit 9d2378b59150f6f1cb5c9cf42ea06b0bb57029a1.
The file was modifiedclang/include/clang/Basic/DiagnosticDriverKinds.td
The file was removedclang/test/OpenMP/target_incompatible_architecture_messages.cpp
The file was modifiedclang/lib/Frontend/CompilerInvocation.cpp
The file was modifiedclang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
Commit 81921ebc430536ae5718da70a54328c790c8ae19 by spatel
[CodeGen] improve coverage for float (32-bit) type of NAN; NFC

Goes with D88238
The file was modifiedclang/test/CodeGen/builtin-nan-exception.c
Commit 1b60f63e4fd041550019b692dc7bf490dce2c75c by jhuber6
Revert "[OpenMP] Replace OpenMP RTL Functions With OMPIRBuilder and OMPKinds.def"

Failing tests on Arm due to the tests automatically populating
incomatible pointer width architectures. Reverting until the tests are
updated. Failing tests:

OpenMP/distribute_parallel_for_num_threads_codegen.cpp
OpenMP/distribute_parallel_for_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_if_codegen.cpp
OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_if_codegen.cpp
OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp

This reverts commit 90eaedda9b8ef46e2c0c1b8bce33e98a3adbb68c.
The file was modifiedllvm/test/Transforms/OpenMP/add_attributes.ll
The file was modifiedllvm/include/llvm/Frontend/OpenMP/OMPKinds.def
The file was modifiedclang/lib/CodeGen/CGOpenMPRuntime.h
The file was modifiedclang/test/OpenMP/nvptx_parallel_codegen.cpp
The file was modifiedclang/lib/CodeGen/CodeGenModule.h
The file was modifiedclang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
Commit e9b38841619f20a6f4c8657880fd487083ba499a by csigg
Add GDB prettyprinters for a few more MLIR types.

Reviewed By: dblaikie, jpienaar

Differential Revision: https://reviews.llvm.org/D87159
The file was modifieddebuginfo-tests/CMakeLists.txt
The file was modifieddebuginfo-tests/llvm-prettyprinters/gdb/lit.local.cfg
The file was addeddebuginfo-tests/llvm-prettyprinters/gdb/mlir-support.gdb
The file was modifieddebuginfo-tests/lit.cfg.py
The file was addedmlir/utils/gdb-scripts/prettyprinters.py
The file was modifieddebuginfo-tests/lit.site.cfg.py.in
The file was modifieddebuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
The file was addeddebuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
Commit dd14e5825209386129770296f9bc3a14ab0b4592 by thomasraoux
[mlir][vector] First step of vector distribution transformation

This is the first of several steps to support distributing large vectors. This
adds instructions extract_map and insert_map that allow us to do incremental
lowering. Right now the transformation only apply to simple pointwise operation
with a vector size matching the multiplicity of the IDs used to distribute the
vector.
This can be used to distribute large vectors to loops or SPMD.

Differential Revision: https://reviews.llvm.org/D88341
The file was modifiedmlir/lib/Dialect/Vector/VectorOps.cpp
The file was modifiedmlir/lib/Dialect/Vector/VectorTransforms.cpp
The file was modifiedmlir/test/Dialect/Vector/invalid.mlir
The file was addedmlir/test/Dialect/Vector/vector-distribution.mlir
The file was modifiedmlir/include/mlir/Dialect/Vector/VectorTransforms.h
The file was modifiedmlir/test/lib/Transforms/TestVectorTransforms.cpp
The file was modifiedmlir/include/mlir/Dialect/Vector/VectorOps.td
The file was modifiedmlir/test/Dialect/Vector/ops.mlir