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
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.
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.
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
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
Krzysztof Parzyszek [Tue, 6 Jun 2023 14:08:08 +0000 (07:08 -0700)]
[Hexagon] Do not track reserved regs in RDF optimizations
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
Matt Arsenault [Tue, 13 Jun 2023 23:05:54 +0000 (19:05 -0400)]
HIP: Add a few more cmath header tests
Matt Arsenault [Tue, 13 Jun 2023 22:18:32 +0000 (18:18 -0400)]
OpenMP: Add a new test for constantexpr evaluation of math headers
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
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!
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.
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
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
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
Louis Dionne [Wed, 14 Jun 2023 20:44:46 +0000 (13:44 -0700)]
[libc++][NFC] clang-format new_handler.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
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.
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
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
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
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
Matt Arsenault [Wed, 14 Jun 2023 14:22:14 +0000 (10:22 -0400)]
LangRef: Delete trailing whitespace
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.
Benjamin Kramer [Thu, 15 Jun 2023 13:42:08 +0000 (15:42 +0200)]
Matt Arsenault [Wed, 14 Jun 2023 23:34:54 +0000 (19:34 -0400)]
AMDGPU: Delete some stray / dead check prefixes
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
Matt Arsenault [Wed, 14 Jun 2023 19:14:04 +0000 (15:14 -0400)]
ValueTracking: Add some baseline tests for issue #63316
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
Amaury Séchet [Thu, 15 Jun 2023 12:32:22 +0000 (12:32 +0000)]
[NFC] Autogenerate CodeGen/SPARC/LeonInsertNOPLoadPassUT.ll
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
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.
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
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
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.
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
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
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
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
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
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
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
Timm Bäder [Thu, 26 Jan 2023 15:25:52 +0000 (16:25 +0100)]
[clang][Interp] Virtual function calls
Add a CallVirt opcode and implement virtual function calls this way.
Differential Revision: https://reviews.llvm.org/D142630
Matt Arsenault [Wed, 14 Jun 2023 12:31:59 +0000 (08:31 -0400)]
AMDGPU: Perform basic folds on llvm.amdgcn.exp2
Matt Arsenault [Wed, 14 Jun 2023 12:23:26 +0000 (08:23 -0400)]
AMDGPU: Add baseline tests for llvm.amdgcn.exp2 folds
Matt Arsenault [Wed, 14 Jun 2023 12:07:25 +0000 (08:07 -0400)]
AMDGPU: Add llvm.amdgcn.exp2 intrinsic
Provide direct access to v_exp_f32 and v_exp_f16, so we can start
correctly lowering the generic exp intrinsics.
Unfortunately have to break from the usual naming convention of
matching the instruction name and stripping the v_ prefix. exp is
already taken by the export intrinsic. On the clang builtin side, we
have a choice of maintaining the convention to the instruction name,
or following the intrinsic name.
Matt Arsenault [Wed, 14 Jun 2023 12:01:30 +0000 (08:01 -0400)]
AMDGPU: Add llvm.amdgcn.log to intrinsic documentation
Matt Arsenault [Wed, 14 Jun 2023 11:58:08 +0000 (07:58 -0400)]
AMDGPU: Correct semantic bearing typo in intrinsic description
Jan Svoboda [Wed, 31 May 2023 21:53:11 +0000 (14:53 -0700)]
[clang][index] NFCI: Make `CXFile` a `FileEntryRef`
This patch swaps out the `void *` behind `CXFile` from `FileEntry *` to `FileEntryRef::MapEntry *`. This allows us to remove some deprecated uses of `FileEntry::getName()`.
Depends on D151854.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D151938
Peixin Qiao [Thu, 15 Jun 2023 09:52:04 +0000 (09:52 +0000)]
[flang][OpenMP][OpenACC] Support stop statement in OpenMP/OpenACC region
[flang][OpenMP][OpenACC] Support stop statement in OpenMP/OpenACC region
This supports lowering of stop statement in OpenMP/OpenACC region.
* OpenMP/OpenACC: Emit `fir.unreachable` only if the block is not
terminated by any terminator. This avoids knocking off an existing
OpenMP/OpenACC terminator.
* OpenMP: Emit the OpenMP terminator instead of `fir.unreachable` since
OpenMP regions can only be terminated by OpenMP terminators. This is
currently skipped for OpenACC since unstructured code is not yet
handled specially in OpenACC lowering.
Fixes #60737
Fixes #61877
Co-authored-by: Kiran Chandramohan <kiranchandramohan@gmail.com>
Co-authored-by: Val Donaldson <vdonaldson@nvidia.com>
Reviewed By: vdonaldson, peixin
Differential Revision: https://reviews.llvm.org/D129969
Matthias Springer [Thu, 15 Jun 2023 09:30:03 +0000 (11:30 +0200)]
[mlir][test] Drop op type from test passes in TestPatterns.cpp
When possible, use `OperationPass<>` instead of `OperationPass<ModuleOp>` or `OperationPass<FuncOp>`.
Differential Revision: https://reviews.llvm.org/D153005
Jan Svoboda [Thu, 15 Jun 2023 09:22:48 +0000 (11:22 +0200)]
[clang] Deprecate `DirectoryEntry::getName()`
This finally officially deprecates `DirectoryEntry::getName()`. I checked no usages remain in targets built by any of `check-clang`, `check-clang-tools`, `check-clang-extra`. There are probably some remaining usages in places like LLDB and other clients. This will give them a chance to transition to `DirectoryEntryRef::getName()` before we remove the function altogether.
Depends on D151922.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D151927
Florian Hahn [Thu, 15 Jun 2023 10:11:05 +0000 (11:11 +0100)]
[LSR] Move new test to X86 subdir.
The test added in
1665cb06307 requires the X86 backend, so move it to
the X86 subdirectory.
Ivan Kosarev [Thu, 15 Jun 2023 10:04:52 +0000 (11:04 +0100)]
[AMDGPU][AsmParser][NFC] Simplify v_interp-related operand definitions.
Part of <https://github.com/llvm/llvm-project/issues/62629>.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D152897
Ivan Kosarev [Thu, 15 Jun 2023 09:56:56 +0000 (10:56 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 9.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D152902
Jan Svoboda [Thu, 15 Jun 2023 09:59:31 +0000 (11:59 +0200)]
[lldb] Fix build error after
7bca6f45
Ivan Kosarev [Thu, 15 Jun 2023 09:47:00 +0000 (10:47 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 8.
Reviewed By: Joe_Nash
Differential Revision: https://reviews.llvm.org/D152809
Ivan Kosarev [Thu, 15 Jun 2023 09:40:53 +0000 (10:40 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 7.
Reviewed By: Joe_Nash
Differential Revision: https://reviews.llvm.org/D152808
Ivan Kosarev [Thu, 15 Jun 2023 09:34:19 +0000 (10:34 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 6.
Reviewed By: Joe_Nash
Differential Revision: https://reviews.llvm.org/D152807
Nikita Popov [Thu, 15 Jun 2023 09:34:01 +0000 (11:34 +0200)]
[X86] Add test for icmp/sub operand order across blocks (NFC)
Ivan Kosarev [Thu, 15 Jun 2023 09:28:10 +0000 (10:28 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 5.
Reviewed By: Joe_Nash
Differential Revision: https://reviews.llvm.org/D152805
Ivan Kosarev [Thu, 15 Jun 2023 09:09:07 +0000 (10:09 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 4.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D152717
Jan Svoboda [Thu, 15 Jun 2023 09:09:02 +0000 (11:09 +0200)]
[clang] NFC: Use `DirectoryEntryRef` in `FileManager::getCanonicalName()`
This patch removes the last use of deprecated `DirectoryEntry::getName()`.
Depends on D151855.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D151922
Jan Svoboda [Thu, 15 Jun 2023 08:47:27 +0000 (10:47 +0200)]
[clang] Use `{File,Directory}EntryRef` in modular header search (part 2/2)
This patch removes some deprecated uses of `{File,Directory}Entry::getName()`. No functional change intended.
Depends on D151854.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D151855
Matthias Springer [Thu, 15 Jun 2023 09:15:07 +0000 (11:15 +0200)]
[mlir][Interfaces] Symbols are not trivially dead
The greedy pattern rewrite driver removes ops that are "trivially dead". This could include symbols that are still referenced by other ops. Dead symbols should be removed with the `-symbol-dce` pass instead.
This bug was not triggered for `func::FuncOp`, because ops are not considered "trivally dead" if they do not implement the `MemoryEffectOpInterface`, indicating that the op may or may not have side effects. It is, however, triggered for `transform::NamedSequenceOp`, which implements that interface because it is required for all transform dialect ops.
Differential Revision: https://reviews.llvm.org/D152994
Simon Pilgrim [Thu, 15 Jun 2023 09:17:04 +0000 (10:17 +0100)]
[GlobalIsel][X86] Add handling for G_CONCAT_VECTORS
Replace the legacy legalizer versions - interestingly the only concat_vectors isel patterns we currently have are for AVX512 predicate masks, which gisel doesn't handle at all yet.
Florian Hahn [Thu, 15 Jun 2023 09:15:12 +0000 (10:15 +0100)]
[LSR] Add test cases showing bad handling of extends of post-inc uses.
Tests from #38847, #62852.
Job Noorman [Thu, 15 Jun 2023 08:52:11 +0000 (10:52 +0200)]
[BOLT] Move from RuntimeDyld to JITLink
RuntimeDyld has been deprecated in favor of JITLink. [1] This patch
replaces all uses of RuntimeDyld in BOLT with JITLink.
Care has been taken to minimize the impact on the code structure in
order to ease the inspection of this (rather large) changeset. Since
BOLT relied on the RuntimeDyld API in multiple places, this wasn't
always possible though and I'll explain the changes in code structure
first.
Design note: BOLT uses a JIT linker to perform what essentially is
static linking. No linked code is ever executed; the result of linking
is simply written back to an executable file. For this reason, I
restricted myself to the use of the core JITLink library and avoided ORC
as much as possible.
RuntimeDyld contains methods for loading objects (loadObject) and symbol
lookup (getSymbol). Since JITLink doesn't provide a class with a similar
interface, the BOLTLinker abstract class was added to implement it. It
was added to Core since both the Rewrite and RuntimeLibs libraries make
use of it. Wherever a RuntimeDyld object was used before, it was
replaced with a BOLTLinker object.
There is one major difference between the RuntimeDyld and BOLTLinker
interfaces: in JITLink, section allocation and the application of fixups
(relocation) happens in a single call (jitlink::link). That is, there is
no separate method like finalizeWithMemoryManagerLocking in RuntimeDyld.
BOLT used to remap sections between allocating (loadObject) and linking
them (finalizeWithMemoryManagerLocking). This doesn't work anymore with
JITLink. Instead, BOLTLinker::loadObject accepts a callback that is
called before fixups are applied which is used to remap sections.
The actual implementation of the BOLTLinker interface lives in the
JITLinkLinker class in the Rewrite library. It's the only part of the
BOLT code that should directly interact with the JITLink API.
For loading object, JITLinkLinker first creates a LinkGraph
(jitlink::createLinkGraphFromObject) and then links it (jitlink::link).
For the latter, it uses a custom JITLinkContext with the following
properties:
- Use BOLT's ExecutableFileMemoryManager. This one was updated to
implement the JITLinkMemoryManager interface. Since BOLT never
executes code, its finalization step is a no-op.
- Pass config: don't use the default target passes since they modify
DWARF sections in a way that seems incompatible with BOLT. Also run a
custom pre-prune pass that makes sure sections without symbols are not
pruned by JITLink.
- Implement symbol lookup. This used to be implemented by
BOLTSymbolResolver.
- Call the section mapper callback before the final linking step.
- Copy symbol values when the LinkGraph is resolved. Symbols are stored
inside JITLinkLinker to ensure that later objects (i.e.,
instrumentation libraries) can find them. This functionality used to
be provided by RuntimeDyld but I did not find a way to use JITLink
directly for this.
Some more minor points of interest:
- BinarySection::SectionID: JITLink doesn't have something equivalent to
RuntimeDyld's Section IDs. Instead, sections can only be referred to
by name. Hence, SectionID was updated to a string.
- There seem to be no tests for Mach-O. I've tested a small hello-world
style binary but not more than that.
- On Mach-O, JITLink "normalizes" section names to include the segment
name. I had to parse the section name back from this manually which
feels slightly hacky.
[1] https://reviews.llvm.org/D145686#4222642
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D147544
Andrzej Warzynski [Fri, 2 Jun 2023 14:32:12 +0000 (15:32 +0100)]
[mlir][Vector] Add pattern to reorder elementwise and broadcast ops
The new pattern will replace elementwise(broadcast) with
broadcast(elementwise) when safe.
This change affects tests for vectorising nD-extract. In one case
("vectorize_nd_tensor_extract_with_tensor_extract") I just trimmed the
test and only preserved the key parts (scalar and contiguous load from
the original Op). We could do the same with some other tests if that
helps maintainability.
Differential Revision: https://reviews.llvm.org/D152812
Ivan Kosarev [Thu, 15 Jun 2023 08:41:32 +0000 (09:41 +0100)]
[AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 3.
Reviewed By: Joe_Nash
Differential Revision: https://reviews.llvm.org/D152716
Amara Emerson [Wed, 14 Jun 2023 22:42:43 +0000 (15:42 -0700)]
[DAGCombiner] Fix crash when trying to replace an indexed store with a narrow store.
rdar://
108818859
Differential Revision: https://reviews.llvm.org/D152978
Nikita Popov [Thu, 15 Jun 2023 08:47:54 +0000 (10:47 +0200)]
[InstCombine] Add additional tests for displaced shifts (NFC)
David Spickett [Thu, 15 Jun 2023 08:38:08 +0000 (08:38 +0000)]
[lldb] Fix dead link in JIT debugging doc
Thanks to Zhang on Discord for spotting this.
eopXD [Thu, 18 May 2023 12:27:40 +0000 (05:27 -0700)]
[1/3][RISCV] Define machine instruction to write an immediate into vxrm
This patch-set wants to model rounding mode for the fixed-point
intrinsics of the RVV C intrinsics.
The specification PR: [riscv-non-isa/rvv-intrinsic-doc#222](https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/222)
The 3 patches is a proof-of-concept with a bottom-up approach
Going from machine instruction to LLVM intrinsics, then to the C
intrinsics. The 3 patches applies the rounding mode control on the
`vaadd` instruction. Proceeding patches will extend the change to all
other fixed-point computations.
---
This is the 1st commit of the patch-set. This patch gives a name to
the machine instruction that writes an immediate into the CSR `vxrm`.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D151395
Simon Tatham [Thu, 15 Jun 2023 08:26:20 +0000 (09:26 +0100)]
[ARM,AArch64] Add a full set of -mtp= options.
AArch64 has five system registers intended to be useful as thread
pointers: one for each exception level which is RW at that level and
inaccessible to lower ones, and the special TPIDRRO_EL0 which is
readable but not writable at EL0. AArch32 has three, corresponding to
the AArch64 ones that aren't specific to EL2 or EL3.
Currently clang supports only a subset of these registers, and not
even a consistent subset between AArch64 and AArch32:
- For AArch64, clang permits you to choose between the four TPIDR_ELn
thread registers, but not the fifth one, TPIDRRO_EL0.
- In AArch32, on the other hand, the //only// thread register you can
choose (apart from 'none, use a function call') is TPIDRURO, which
corresponds to (the bottom 32 bits of) AArch64's TPIDRRO_EL0.
So there is no thread register that you can currently use in both
targets!
For custom and bare-metal purposes, users might very reasonably want
to use any of these thread registers. There's no reason they shouldn't
all be supported as options, even if the default choices follow
existing practice on typical operating systems.
This commit extends the range of values acceptable to the `-mtp=`
clang option, so that you can specify any of these registers by (the
lower-case version of) their official names in the ArmARM:
- For AArch64: tpidr_el0, tpidrro_el0, tpidr_el1, tpidr_el2, tpidr_el3
- For AArch32: tpidrurw, tpidruro, tpidrprw
All existing values of the option are still supported and behave the
same as before. Defaults are also unchanged. No command line that
worked already should change behaviour as a result of this.
The new values for the `-mtp=` option have been agreed with Arm's gcc
developers (although I don't know whether they plan to implement them
in the near future).
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D152433
David Green [Thu, 15 Jun 2023 08:25:28 +0000 (09:25 +0100)]
[AArch64] Fix check lines for arm64-neon-across.ll. NFC
Commit
de0707a2b98162ab52fa2dd9277a9bbb4f7256c7 updated the check lines, but
due to conflicting assembly not all functions kept their checks. This now
distinguishes between selection-dag and global isel.
David Green [Thu, 15 Jun 2023 08:17:50 +0000 (09:17 +0100)]
[AArch64][SVE] Enable shouldFoldSelectWithIdentityConstant for SVE.
Instcombine will canonicalize `select(c, binop(a, b), a)` to
`binop(select(c, b, identityvalue), a)`. The original select form
makes a more natural form for vector predicated operations for
vector architectures like SVE where predication is well supported.
This patch enables shouldFoldSelectWithIdentityConstant for SVE so
that more predicated instructions can be generated, helping simplify
the handling with identity constants.
Predicated FMA patterns have also been adjusted here as they need to
look at FMF's. Other operations like add/sub, mul, and/or/xor and
mla/mls have been recently updated.
There is one test (scalable_int_min_max) that increases in size. There
are multiple selects that could be combined into a single select but
does not currently fold.
Differential Revision: https://reviews.llvm.org/D149967
Nikita Popov [Thu, 15 Jun 2023 08:03:29 +0000 (10:03 +0200)]
[CGCall] Directly create opaque pointers (NFCI)
David Green [Thu, 15 Jun 2023 07:47:10 +0000 (08:47 +0100)]
[AArch64] Don't look at type size for scalable types in isExtFreeImpl
This fixes one of those 'Request for a fixed element count on a scalable
object' errors in the AArch64 isExtFreeImpl method, where the uses of a sext
are checked to see if the instruction can be considered free.
https://godbolt.org/z/debYP9c4G
Differential Revision: https://reviews.llvm.org/D152930
Animesh Kumar [Tue, 6 Jun 2023 10:46:13 +0000 (16:16 +0530)]
[OpenMP] Update the default version of OpenMP to 5.1
The default version of OpenMP is updated from 5.0 to 5.1 which means if -fopenmp is specified but -fopenmp-version is not specified with clang, the default version of OpenMP is taken to be 5.1. After modifying the Frontend for that, various LIT tests were updated. This patch contains all such changes. At a high level, these are the patterns of changes observed in LIT tests -
# RUN lines which mentioned `-fopenmp-version=50` need to kept only if the IR for version 5.0 and 5.1 are different. Otherwise only one RUN line with no version info(i.e. default version) needs to be there.
# Test cases of this sort already had the RUN lines with respect to the older default version 5.0 and the version 5.1. Only swapping the version specification flag `-fopenmp-version` from newer version RUN line to older version RUN line is required.
# Diagnostics: Remove the 5.0 version specific RUN lines if there was no difference in the Diagnostics messages with respect to the default 5.1.
# Diagnostics: In case there was any difference in diagnostics messages between 5.0 and 5.1, mention version specific messages in tests.
# If the test contained version specific ifdef's e.g. "#ifdef OMP5" but there were no RUN lines for any other version than 5.X, then bring the code guarded by ifdef's outside and remove the ifdef's.
# Some tests had RUN lines for both 5.0 and 5.1 versions, but it is found that the IR for 5.0 is not different from the 5.1, therefore such RUN lines are redundant. So, such duplicated lines are removed.
# To generate CHECK lines automatically, use the script llvm/utils/update_cc_test_checks.py
Reviewed By: saiislam, ABataev
Differential Revision: https://reviews.llvm.org/D129635
(cherry picked from commit
9dd2999907dc791136a75238a6000f69bf67cf4e)
Nikita Popov [Fri, 9 Jun 2023 07:57:21 +0000 (09:57 +0200)]
[Clang] Directly create opaque pointers
In CGTypes, directly create opaque pointers, without computing the
LLVM element type. This is not as straightforward as I though it
would be, because apparently computing the LLVM type also causes a
number of side effects.
In particular, we no longer produce diagnostics like -Wpacked for
typed (only) behind pointers, because we no longer depend on their
layout.
Differential Revision: https://reviews.llvm.org/D152505
Fangrui Song [Thu, 15 Jun 2023 06:57:03 +0000 (23:57 -0700)]
[MC] Properly report errors for .subsection
For the out-of-range error, MCConstantExpr doesn't have a location, so we
can only show "<unknown>:0:".
Also, allow subsection numbers up to
2147483647, which is the maximum value GNU
assembler supports. (GNU assembler also supports negative numbers.)
AdityaK [Thu, 15 Jun 2023 06:13:59 +0000 (23:13 -0700)]
Remove small data limit for riscv64.*android triples
On Android GP register has been repurposed for SCS so there is no need to have .sdata section.
Reviewers: enh, craig.topper, pirama, kito-cheng, jrtc27
Differential Revision: https://reviews.llvm.org/D151512
eopXD [Wed, 14 Jun 2023 14:39:31 +0000 (07:39 -0700)]
[lldb][RISCV] Replace enumeration of RVV builtin types with inclusion to RISCVVTypes.def
This approach prevents us from adding new lines into the switch case
when new types are introduced.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D152922
esmeyi [Thu, 15 Jun 2023 05:28:45 +0000 (01:28 -0400)]
[XCOFF] FixupOffsetInCsect should be 0 for R_REF relocation.
Summary: The FixupOffsetInCsect should be 0 for R_REF relocation since it specifies a nonrelocating reference. Otherwise liker would try to relocate the symbol through its address and an error like following occurred.
```
ld: 0711-547 SEVERE ERROR: Object /tmp/1-2a7ea1.o cannot be processed.
RLD address 0x65 for section 2 (.data) is
not contained in the section.
```
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D152777
Pravin Jagtap [Thu, 15 Jun 2023 05:18:38 +0000 (01:18 -0400)]
[AMDGPU] Enable Atomic Optimizer and Default to Iterative Scan Strategy.
The D147408 implemented new Iterative approach for scan computations
and added new flag `amdgpu-atomic-optimizer-strategy` which is
defaulted to DPP.
The changeset https://github.com/GPUOpen-Drivers/llpc/pull/2506
adapts to the new changes in LLPC.
This patch enables atomic optimizer pass and selects Iterative
approach for scan computations by default for compute pipeline.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D152649
Carl Ritson [Thu, 15 Jun 2023 04:45:15 +0000 (13:45 +0900)]
[AMDGPU] Place returns on stack if they would violate VGPR limit
Check no VGPRs above configured maximum would be used by a return
when deciding if it can be lowered.
Reviewed By: sebastian-ne
Differential Revision: https://reviews.llvm.org/D152912
Carl Ritson [Thu, 15 Jun 2023 04:44:54 +0000 (13:44 +0900)]
[AMDGPU] Remove return VGPRs from callee save list
There is no need to generate spill/restore for registers used in
return value. This matters for amdgpu_gfx calling convention
where CSR and Ret definitions overlap.
Reviewed By: sebastian-ne
Differential Revision: https://reviews.llvm.org/D152892
Kazu Hirata [Thu, 15 Jun 2023 05:04:47 +0000 (22:04 -0700)]
[mlir] Remove unused forward declaration OpAsmParserResult
The corresponding class definition was removed by:
commit
17ef97bf7e124d7cba023011a7764e64b2889212
Author: Chris Lattner <clattner@google.com>
Date: Tue Aug 7 09:12:35 2018 -0700
Kazu Hirata [Thu, 15 Jun 2023 05:04:46 +0000 (22:04 -0700)]
[mlir] Remove unused forward declaration FilteredValueUseIterator
The corresponding class definition was removed by:
commit
48e9ef4320a315ba1f2358db7295d53917a14f4b
Author: River Riddle <riddleriver@gmail.com>
Date: Thu Apr 23 16:23:34 2020 -0700
Kazu Hirata [Thu, 15 Jun 2023 05:04:44 +0000 (22:04 -0700)]
[mlir] Remove unused forward declaration AffineSymbolExprStorage
The corresponding struct definition was removed by:
commit
c74996d199e8931d4fc3d72acd50754b43c4ec2d
Author: Alex Zinenko <zinenko@google.com>
Date: Tue May 21 01:34:13 2019 -0700
Kazu Hirata [Thu, 15 Jun 2023 05:04:43 +0000 (22:04 -0700)]
[lldb] Remove unused forward declaration RecordingMemoryManager
The corresponding class definition was removed by:
commit
8dfb68e0398ef48d41dc8ea058e9aa750b5fc85f
Author: Sean Callanan <scallanan@apple.com>
Date: Tue Mar 19 00:10:07 2013 +0000
Kazu Hirata [Thu, 15 Jun 2023 05:04:41 +0000 (22:04 -0700)]
[lld] Remove unused forward declarations for DefinedRelative
The corresponding class definition was removed by:
commit
502d4ce2e4921cc38ef1226ae093e594d900fe46
Author: Reid Kleckner <rnk@google.com>
Date: Mon Jun 26 15:39:52 2017 +0000
Kazu Hirata [Thu, 15 Jun 2023 05:04:40 +0000 (22:04 -0700)]
[CodeGen] Remove unused function GetOrCreateRTTIProxyGlobalVariable
The last use was removed by:
commit
46f366494f3ca8cc98daa6fb4f29c7c446c176b6
Author: Fangrui Song <i@maskray.me>
Date: Sat May 20 08:24:20 2023 -0700
This patch also removes RTTIProxyMap, which becomes unused once I
remove GetOrCreateRTTIProxyGlobalVariable.
Differential Revision: https://reviews.llvm.org/D152782
Kazu Hirata [Thu, 15 Jun 2023 05:04:38 +0000 (22:04 -0700)]
[mlir] Remove unused declaration createComposedAffineApplyOp
The corresponding function definition was removed by:
commit
362557e11c8185e172a49f7542dc04c519857230
Author: Nicolas Vasilache <ntv@google.com>
Date: Fri Jan 11 16:08:16 2019 -0800
Kazu Hirata [Thu, 15 Jun 2023 05:04:37 +0000 (22:04 -0700)]
[mlir] Use DenseMapBase::lookup (NFC)
Martin Braenne [Tue, 13 Jun 2023 07:05:15 +0000 (07:05 +0000)]
Prevent deadlocks in death tests.
We have recently started seeing deadlocks in death tests while running in an internal test environment.
Per the documentation here, there are issues with death tests in the presence of threads:
https://github.com/google/googletest/blob/main/docs/advanced.md#death-tests-and-threads
To avoid the deadlocks, I first tried appending `DeathTest` to the relevant test suite names, which has the effect of running these test suites before all other tests. However, this did not prevent the deadlocks.
This patch therefore uses the option of setting the `death_test_style` flag to `"threadsafe"` (see description in the page linked above under "Death Test Styles"), and this prevents the deadlocks.
The documentation notes that the "threadsafe" death test style "trades increased test execution time (potentially dramatically so) for improved thread safety". This is because, to execute a death test, "threadsafe" does a "fork + exec", then re-executes the current test in the child process, whereas the default "fast" death test style does only a fork (on those platforms that support it). However, as we have relatively few death tests, the increased execution time does not make a big difference in total test execution time in my testing.
Note that other projects, such as Chromium, also choose to set the "threadsafe" death test style globally:
https://source.chromium.org/chromium/chromium/src/+/main:base/test/test_suite.cc;l=367
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D152696
Younan Zhang [Wed, 14 Jun 2023 01:59:30 +0000 (09:59 +0800)]
[clang][NFC] Add a notice to desugarForDiagnostic
`desugarForDiagnostic` only sets ShouldAKA to true if desugaring
happens, otherwise ShouldAKA is left intact and might be uninitialized.
Victims (including me):
https://github.com/llvm/llvm-project/commit/
25bf8cb3c0e3c41231289a6ff0a37b6d49b24011
https://github.com/llvm/llvm-project/commit/
0e8384a0fe4f03d60cd92aba1cae074512481ca2
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D152880
Yaxun (Sam) Liu [Thu, 15 Jun 2023 03:39:35 +0000 (23:39 -0400)]
Fix test target_cpu_features.f90
Change-Id: Iae75abc3e4d1508f08080f687aba0ee1af74da2b
Yaxun (Sam) Liu [Wed, 24 May 2023 16:59:01 +0000 (12:59 -0400)]
[HIP] emit macro `__HIP_NO_IMAGE_SUPPORT`
HIP texture/image support is optional as some devices
do not have image instructions. A macro __HIP_NO_IMAGE_SUPPORT
is defined for device not supporting images (https://github.com/ROCm-Developer-Tools/HIP/blob/
d0448aa4c4dd0f4b29ccf6a663b7f5ad9f5183e0/docs/reference/kernel_language.md?plain=1#L426 )
Currently the macro is defined by HIP header based on predefined macros
for GPU, e.g __gfx*__ , which is error prone. This patch let clang
emit the predefined macro.
Reviewed by: Matt Arsenault, Artem Belevich
Differential Revision: https://reviews.llvm.org/D151349