Slava Zakharin [Wed, 19 Jul 2023 16:10:54 +0000 (09:10 -0700)]
[flang][hlfir] Fixed finalization in hlfir.assign codegen.
When hlfir.assign is lowered into simple load/store,
we may still need to finalize the LHS.
The patch passes `needFinalization` to `genScalarAssignment`
for LHS of any derived type, so some `Destroy` calls
might be redundant. They can be removed later by propagating/deducing
IsFinalizable information about the LHS type.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D155664
Edoardo Sanguineti [Wed, 19 Jul 2023 21:29:25 +0000 (17:29 -0400)]
[libc++] Add basic runtime assertions to <semaphore>
Adding assertions will aid users that have bugs or logic mistakes in
their code to receive error messages when debugging.
Differential Revision: https://reviews.llvm.org/D155399
Justin Bogner [Wed, 19 Jul 2023 19:04:38 +0000 (12:04 -0700)]
[DirectX] Remove uses of isOpaquePointerTy(). NFC
isOpaquePointerTy now returns true for all pointers, so we can replace
these with isPointerTy().
Fangrui Song [Wed, 19 Jul 2023 21:23:28 +0000 (14:23 -0700)]
[FSAFDO] Switch to xxh3_64bits
Following recent changes switching from xxh64 to xxh32 for better
hashing performance. This particular instance may or may not have
noticeable performance difference, but this change makes us toward
removing xxHash64.
Ziqing Luo [Wed, 19 Jul 2023 21:02:06 +0000 (14:02 -0700)]
[-Wunsafe-buffer-usage] Do not assert that function parameters have names
It is possible that a function parameter does not have a name even in
a function definition. This patch deals with such cases in generating
function overload fix-its for safe buffers.
Reviewed by: NoQ (Artem Dergachev)
Differential revision: https://reviews.llvm.org/D155641
Felipe de Azevedo Piovezan [Fri, 14 Jul 2023 19:59:24 +0000 (15:59 -0400)]
[lldb] Make frame var --regex always search globals
Currently frame var --regex sometimes searches globals, sometimes it doesn't.
This happens because `StackFrame::GetVariableList` always returns the biggest
list it has, regardless of whether only globals were requested or not. In other
words, if a previous call to `GetVariableList` requested globals, all subsequent
calls will see them.
The implication here is that users of `StackFrame::GetVariableList` are expected
to filter the results of this function. This is what we do for a vanilla
`frame var` command. But it is not what we do when `--regex` is used. This
commit solves the issue by:
1. Making `--regex` imply `--globals`. This matches the behavior of `frame var
<some_name>`, which will also search the global scope.
2. Making the `--regex` search respect the command object options.
See the added test for an example of the oddities this patch addresses. Without
the patch, the test fails. However it could be made to pass by calling a plain
`frame var` before calling `frame var --regex A::`.
Differential Revision: https://reviews.llvm.org/D155334
Fangrui Song [Wed, 19 Jul 2023 21:08:13 +0000 (14:08 -0700)]
[COFF] Switch to xxh3_64bits
Similar to recent changes to ELF (e.g., commit
f4b4bc2f18dc0e44afde05735fb673d3de4d5c39) and Mach-O to improve hashing
performance.
John Harrison [Thu, 13 Jul 2023 22:50:06 +0000 (15:50 -0700)]
[lldb-vscode] Creating a new flag for adjusting the behavior of evaluation repl expressions to allow users to more easily invoke lldb commands.
This adds a new flag and lldb runtime command to allow users to manage the behavior of the lldb-vscode evaluate repl request.
When evaluating a repl context this now has runtime managed flag for control how the repl behaviors with the follow values:
* `variable` - the existing behavior, with this mode requests are evaluted in the current frame context as variable expressions. To trigger a lldb command prefix an expression with ` and it will be evaluted as an lldb command.
* `command` - all expressions are evaluated as lldb commands.
* `auto` - An alternative mode that will attempt to determine if the expression is an lldb command or a variable expression. Based off the intepreted results the expression will be evaluted either as a command or an expression.
Additionally, I enabled completions and ensured they work with the new repl expression behavior to provide auto-completes.
This commit includes updates to the tests to verify the new behavior after the previous failures from submitting https://reviews.llvm.org/D154030.
Differential Revision: https://reviews.llvm.org/D155248
Jakub Kuderski [Wed, 19 Jul 2023 20:52:36 +0000 (16:52 -0400)]
[mlir][spirv] Add D155747 to `.git-blame-ignore-revs`
Jakub Kuderski [Wed, 19 Jul 2023 20:48:46 +0000 (16:48 -0400)]
[mlir][spirv] Split op implementation file into subfiles. NFC.
The main op implementation file for SPIR-V grew past 5k LOC. This makes it
take a long time to compile and index with LSPs like clangd.
Pull out the first few SPIR-V extension ops into their own `.cpp` files,
just like we do with `.td` op definitions. This includes the
KHR/NV/Intel coop matrix and the integer dot prod extensions.
I plan to further split this in future revisions.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D155747
Piotr Zegar [Wed, 19 Jul 2023 19:11:24 +0000 (19:11 +0000)]
[clang-tidy][NFC] Fixes in release notes
Correct link in release notes and format of some notes.
Razvan Lupusoru [Wed, 19 Jul 2023 18:29:46 +0000 (11:29 -0700)]
[flang] Fix complex libm use logic problems
Fix the various complex libm selection logic issues from D155310:
- disableMlirComplex is set to false. This means that using mlir complex
is enabled. Yet, the current code still selects libm.
- If we enable mlir complex, we should not check if use approx is
enabled. Namely, we should use mlir complex either if we enable mlir
complex OR use approx is enabled.
To fix the issues, we flip the logic of `disableMlirComplex` to enable
instead. We set it to false by default since the intention from D155310
is to use libm by default. Then we use a logical `&&` with use approx
so that we select libm when BOTH mlir complex and use approx are
disabled.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D155737
Joseph Huber [Wed, 19 Jul 2023 20:23:25 +0000 (15:23 -0500)]
[libc][NFC] Move the RPC types to the `rpc_client.h` header
Summary:
Simple cleanup of the interface so we do not depend on the installed
headers and get everything we need just including rpc_client.h.
Dave Lee [Sat, 29 Oct 2022 22:07:49 +0000 (15:07 -0700)]
[llvm][utils] Add DenseMap data formatters
Add summary and synthetic data formatters for `llvm::DenseMap`.
This implementation avoids expression evaluation by using a heuristic. However, as
heuristics go, there is a corner case: A single deleted entry (a single "tombstone"),
will result in a child value with an invalid key but a valid value.
Instead of calling `getEmptyKey()` and `getTombstoneKey()` to determine which buckets
are empty, and which contain real key-values, the heuristic scans all buckets to
identify keys that exist only once. These singleton keys are considered valid.
The empty key will always exist multiple times. However the tombstone key may exist
zero, one, or many times. The heuristic has no problems when there are zero or many
tombstones, but when there is exactly one deleted entry (one tombstone), then the
heuristic will incorrectly identify it as valid.
Differential Revision: https://reviews.llvm.org/D137028
Craig Topper [Wed, 19 Jul 2023 19:33:08 +0000 (12:33 -0700)]
[RISCV] Add a DAG combine for (czero_eq X, (xor Y, 1)) -> (czero_ne X, Y) if Y is 0 or 1.
This is an alternative to D155288 that can handle other sources of
xori like FP compares. Unfortunately, it misses the i64 setge case
on RV32 in condops.ll.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D155328
Mahesh Ravishankar [Wed, 19 Jul 2023 18:45:10 +0000 (18:45 +0000)]
[mlir][Linalg] Fix warnings/errors on D155518.
This fixes some warnings (that were caught as errors) in https://reviews.llvm.org/D155518/.
Differential Revision: https://reviews.llvm.org/D155738
Nico Weber [Wed, 19 Jul 2023 19:17:50 +0000 (15:17 -0400)]
[gn] add include dir for
1f7c7d4bdd7b
wren romano [Tue, 18 Jul 2023 01:02:04 +0000 (18:02 -0700)]
[mlir][sparse] Renaming `CreationPolicy` to `Policy`
This change is mostly for brevity's sake; but it also paves the way for the `Policy` enum to be reuseable for other situations that require the same three-way semantics.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D155532
Mark de Wever [Wed, 19 Jul 2023 18:56:51 +0000 (20:56 +0200)]
[libc++][print] Disables tests with msan.
These tests break with msan on the sanitizer-aarch64-linux-bootstrap-msan
builder. Note the x86_64 builder is not affected. To unbreak the CI
temporary disable the tests completely with msan.
The breakage was introduced by D150044.
Wael Yehia [Thu, 1 Jun 2023 19:56:07 +0000 (15:56 -0400)]
Define llvm::thread::DefaultStackSize to 4 megabytes on AIX
Link time thinLTO spawns pthreads to parallelize optimization and
codegen of the input bitcode files. On AIX, the default pthread
stack size limit is ~192k for 64-bit programs; insufficient for a
normal LLVM compilation.
Reviewed By: ZarkoCA, MaskRay
Differential Revision: https://reviews.llvm.org/D155731
Alexey Bataev [Wed, 19 Jul 2023 18:20:39 +0000 (11:20 -0700)]
[SLP]Fix a crash when trying to cast scalable vector type to fixed.
Need to check for FixedVectorType, not a vector type, since later
compiler performs unconditional cast to FixedVectorType and gets the
number of elements in this type.
Fangrui Song [Wed, 19 Jul 2023 18:37:42 +0000 (11:37 -0700)]
[ELF] --build-id=fast: switch to xxh3_64bits
Fangrui Song [Wed, 19 Jul 2023 18:28:47 +0000 (11:28 -0700)]
[ELF] splitNonStrings: switch to xxh3_64bits
This is primarily used for .rodata.cst* duplicate elimination. The
sections are usually much smaller than .debug_str (D154813), so the
speedup is negligible. We do this switch for consistency as we want to
eliminate xxh64 in lld.
Vy Nguyen [Mon, 17 Jul 2023 19:37:51 +0000 (15:37 -0400)]
[lld-macho]Use install_name as Identifier for code-sign, if available.
Detail:
LD64 uses the name provided via -[dylib]install_name as "Identifier", when available.
For compatiblity, LLD should do that too.
Differential Revision: https://reviews.llvm.org/D155508
Joseph Huber [Wed, 19 Jul 2023 17:32:19 +0000 (12:32 -0500)]
[OpenMP][Docs] Add some things to the OpenMP support
This patch adds some information that we have support for in the OpenMP
clang support page.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D155727
Fangrui Song [Wed, 19 Jul 2023 18:13:26 +0000 (11:13 -0700)]
[ELF][test] Refactor merge.s
Daniel Thornburgh [Tue, 18 Jul 2023 21:51:10 +0000 (14:51 -0700)]
[sanitizer-common] Run module msan init before early sigaction test
MSAN wrappers can be inserted for e.g. the access to stderr in the
constructor of the test, which can segfault if the constructor function
runs before these data structures have been initialized.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D155648
Simon Pilgrim [Wed, 19 Jul 2023 17:58:12 +0000 (18:58 +0100)]
[X86] matchBinaryShuffle - relax PACKSS for v2i64 -> v4i32 shuffle truncation pattern match.
Similar to combineVectorSignBitsTruncation, we don't require all-signbits source inputs, just enough signbits to reach into the lowest i16 to safely use PACKSSDW.
Momchil Velikov [Wed, 19 Jul 2023 17:31:25 +0000 (18:31 +0100)]
[CodeGenPrepare] Refactor optimizeSelectInst (NFC)
Refactor to use BasicBlockUtils functions and make life easier for
a subsequent patch for updating the dominator tree.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D154053
Simon Pilgrim [Wed, 19 Jul 2023 17:55:37 +0000 (18:55 +0100)]
Fix MSVC "'GetVMSetForLMul': not all control paths return a value" warning. NFC.
Jake Egan [Wed, 19 Jul 2023 17:50:33 +0000 (13:50 -0400)]
[InstrProf][NFC] Ignore -Wcast-qual after D153911 to fix build failure on AIX
/scratch/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c:202:40: error: cast from 'const int (*)[0]' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
(void *)&dummy_name, (void *)&dummy_vnds};
^
1 error generated.
Mahesh Ravishankar [Wed, 19 Jul 2023 04:58:26 +0000 (04:58 +0000)]
[mlir][Linalg] Cleanup the drop unit dims pass in Linalg.
TL;DR the following API functions have been merged
```
void populateFoldUnitExtentDimsViaReshapesPatterns(RewritePatternSet &patterns);
void populateFoldUnitExtentDimsViaSlicesPatterns(RewritePatternSet &patterns);
```
into
```
void populateFoldUnitExtentDimsPatterns(RewritePatternSet &patterns,
ControlDropUnitDims &options);
```
To use the previous functionality use
```
ControlDropUnitDims options;
// By default options.rankReductionStrategy is
// ControlDropUnitDims::RankReductionStrategy::ReassociativeReshape.
populateFoldUnitExtentDimsPatterns(patterns, options);
```
and
```
ControlDropUnitDims options;
options.rankReductionStrategy = ControlDropUnitDims::RankReductionStrategy::ExtractInsertSlice
populateFoldUnitExtentDimsPatterns(patterns, options);
```
This pass is quite old and needed to be updated based on the current
approach to transformations in Linalg
- Instead of two patterns, one to just remove loop dimensions that are
unit extent (and using 0 in the indexing maps), and another to drop
the unit-extents in the operand shapes, combine into a single
transformation. This avoid creating an intermediate step with
indexing maps having 0's in the domains exp ressions.
- Expose the core transformation as a utility function and add a
pattern that calls this transformation.
This is a mostly NFC change, apart from the API change and dropping
the patterns/test that only dropped the loops that are unit extents.
Differential Revision: https://reviews.llvm.org/D155518
Wael Yehia [Wed, 19 Jul 2023 01:48:03 +0000 (21:48 -0400)]
[ThinLTO][AIX] Enable thinlto on AIX
Starting from AIX 7.2 TL5 SP6 and AIX 7.3 TL2 the system linker supports thinLTO.
Reviewed By: ZarkoCA, MaskRay
Differential Revision: https://reviews.llvm.org/D155700
Valentin Clement [Wed, 19 Jul 2023 17:30:42 +0000 (10:30 -0700)]
[mlir][openacc] Relax verifier for the acc.reduction.recipe
Allow the init and combiner regions to have more
arguments to pass information.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155656
Craig Topper [Wed, 19 Jul 2023 17:30:42 +0000 (10:30 -0700)]
[RISCV] Run mem2reg on the scalar C builtin tests to remove allocas and simplify checks. NFC
As requested on D155647.
Johannes Doerfert [Wed, 19 Jul 2023 17:11:29 +0000 (10:11 -0700)]
[AMDGPUAttributor][FIX] No endless recursion for recursive initializers
Fixes: https://github.com/llvm/llvm-project/issues/63956
Johannes Doerfert [Wed, 19 Jul 2023 17:13:03 +0000 (10:13 -0700)]
[Attributor][NFCI] Add a shortcut for constants
Johannes Doerfert [Wed, 19 Jul 2023 06:27:16 +0000 (23:27 -0700)]
[Attributor][NFCI] Avoid updating AAs that depend on missing callees
Momchil Velikov [Wed, 19 Jul 2023 16:27:56 +0000 (17:27 +0100)]
Refactor some BasicBlockUtils functions (NFC)
Add a more "flexible" `SplitBlockAndInsertIfThenElse` function
and re-implement some others on top of it.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D154052
Alex Voicu [Wed, 19 Jul 2023 17:04:31 +0000 (18:04 +0100)]
[Clang][CodeGen]`vtable`, `typeinfo` et al. are globals
All data structures and values associated with handling virtual functions / inheritance, as well as RTTI, are globals and thus can only reside in the global address space. This was not taken fully taken into account because for most targets, global & generic appear to coincide. However, on targets where global & generic ASes differ (e.g. AMDGPU), this was problematic, since it led to the generation of invalid bitcasts (which would trigger asserts in Debug) and less than optimal code. This patch does two things:
ensures that vtables, vptrs, vtts, typeinfo are generated in the right AS, and populated accordingly;
removes a bunch of bitcasts which look like left-overs from the typed ptr era.
Reviewed By: yxsamliu
Differential Revision: https://reviews.llvm.org/D153092
Craig Topper [Wed, 19 Jul 2023 17:03:57 +0000 (10:03 -0700)]
[RISCV] Upgrade Zvfh version to 1.0 and move out of experimental state.
This has been ratified according to https://wiki.riscv.org/display/HOME/Recently+Ratified+Extensions
Differential Revision: https://reviews.llvm.org/D155668
Fangrui Song [Wed, 19 Jul 2023 16:58:43 +0000 (09:58 -0700)]
[lld-macho] Switch to xxh3_64bits
xxh3 is substantially faster than xxh64.
For lld/ELF, there is substantial speedup in `.debug_str` duplicate
elimination (D154813). Use xxh3 for lld-macho as well.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D155677
Fangrui Song [Wed, 19 Jul 2023 16:56:53 +0000 (09:56 -0700)]
[DWARFLinkerParallel] Switch to xxh3_64bits
xxh3 is substantially faster than xxh64.
For lld `.debug_str` there is substantial speedup (D154813).
@avl reports that it is around 1-2% improvement for different number of input sets and for different threads configuration.
Reviewed By: avl
Differential Revision: https://reviews.llvm.org/D155675
Joseph Huber [Wed, 19 Jul 2023 15:58:45 +0000 (10:58 -0500)]
[libc] Fix global constructor being emitted for the RPC client
The indirection here is for some reason causing an unnecessary
constructor. If we leave this uninitialized we will get the default
constructor which simply zero initliaizes the global. I've checked the
output and confirmed that it uses the `zeroinitializer` so this should
be safe.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D155720
Luke Lau [Wed, 12 Jul 2023 00:13:14 +0000 (01:13 +0100)]
[RISCV] Fold ops into vmv.v.v as vmerge with all-ones mask
A vmv.v.v shares the same encoding as a vmerge that isn't masked, so we can
also fold it into its operands if we treat it as a vmerge with an all-ones
mask. We take care here not to actually transform the existing vmv into a
vmerge, otherwise things like True.hasOneUse() become inaccurate. Instead this
just returns an equivalent list of operands.
This is an alternative to D153351.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D155101
Luke Lau [Tue, 11 Jul 2023 16:52:23 +0000 (17:52 +0100)]
[RISCV] Fold vmerge into its ops with smaller VL if known
Currently when folding vmerge into its operands, we stop if the VLs aren't
identical. However since the body of (vmerge (vop)) is the intersection of
vmerge and vop's bodies, we can use the smaller of the two VLs if we know it
ahead of time. This patch relaxes the constraint on VL if they are both
constants, or if either of them are VLMAX.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D155071
Luke Lau [Tue, 11 Jul 2023 12:14:50 +0000 (13:14 +0100)]
[RISCV] Add tests for merges with differing VLs that could be folded
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D155069
Razvan Lupusoru [Wed, 19 Jul 2023 16:08:35 +0000 (09:08 -0700)]
[nfc][openacc] Add missing comma in acc dialect operation macros
A comma is missing which is incorrect if macro is used.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D155722
Simon Pilgrim [Wed, 19 Jul 2023 16:02:03 +0000 (17:02 +0100)]
[SLP][X86] Regenerate some test checks to reduce diff in D154891
Simon Pilgrim [Wed, 19 Jul 2023 13:55:54 +0000 (14:55 +0100)]
[X86] matchBinaryShuffle - match PACKSS for v2i64 -> v4i32 all-signbits shuffle truncation patterns.
Ideally matchShuffleWithPACK should be able to handle this, but it needs a major rewrite to handle illegal types.
David Spickett [Wed, 19 Jul 2023 09:19:13 +0000 (09:19 +0000)]
[libunwind] Fix build error on 32 bit Arm after -Wcast-qual was added
New warning was added in https://reviews.llvm.org/D153911 which caused:
https://buildkite.com/llvm-project/libcxx-ci/builds/28407#
01896b79-2a5e-4554-ac31-
2abec5a8b281
../../libunwind/src/UnwindLevel1-gcc-ext.c:172:47: error: cast from 'const unsigned int *' to 'unsigned int *' drops const qualifier [-Werror,-Wcast-qual]
ex.pr_cache.ehtp = (_Unwind_EHT_Header *) unwindInfo;
I don't see any reason there should be a const here in the first place,
so just remove it.
Reviewed By: #libunwind, michaelplatings, MaskRay
Differential Revision: https://reviews.llvm.org/D155685
Valentin Clement [Wed, 19 Jul 2023 15:53:50 +0000 (08:53 -0700)]
[flang] Represent unknown extent correctly in getTypeAsString
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155655
Nikita Popov [Wed, 19 Jul 2023 15:28:47 +0000 (17:28 +0200)]
[IR] Remove declaration of no longer existing constructor (NFC)
The definition was dropped in D155585, so drop the declaration
as well.
Thanks to Roman Divacky for pointing this out!
Ingo Müller [Tue, 18 Jul 2023 15:02:32 +0000 (15:02 +0000)]
[mlir][transform][gpu][python] Add .td file for bindings.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D155602
Fangrui Song [Wed, 19 Jul 2023 15:34:25 +0000 (08:34 -0700)]
[ELF] Use llvm::xxh3_64bits for MergeInputSection::splitStrings
See D154812 for the speedup.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D154813
Piotr Fusik [Fri, 14 Jul 2023 16:30:41 +0000 (18:30 +0200)]
[libc++] Work around dynamic linking of stringbuf::str() on Windows
https://github.com/llvm/llvm-project/issues/40363 caused the C++20
`str() const &` and `str() &&` to be dllimport'ed despite _LIBCPP_HIDE_FROM_ABI.
This is a temporary solution until #40363 is fixed.
Reviewed By: #libc, hans, ldionne, Mordante
Differential Revision: https://reviews.llvm.org/D155185
Maksim Kita [Wed, 19 Jul 2023 15:07:40 +0000 (17:07 +0200)]
[AggressiveInstCombine] Fold strcmp for short string literals
Fold strcmp() against 1-char string literals.
This designates AggressiveInstCombine as the pass for libcalls
simplifications that may need to change the control flow graph.
Fixes https://github.com/llvm/llvm-project/issues/58003.
Differential Revision: https://reviews.llvm.org/D154725
Joseph Huber [Tue, 11 Jul 2023 19:14:08 +0000 (14:14 -0500)]
[libc] Add basic support for calling host functions from the GPU
This patch adds the `rpc_host_call` function as a GPU extension. This is
exported from the `libc` project to use the RPC interface to call a
function pointer via RPC any copying the arguments by-value. The
interface can only support a single void pointer argument much like
pthreads. The function call here is the bare-bones version of what's
required for OpenMP reverse offloading. Full support will require
interfacing with the mapping table, nowait support, etc.
I decided to test this interface in `libomptarget` as that will be the
primary consumer and it would be more difficult to make a test in `libc`
due to the testing infrastructure not really having a concept of the
"host" as it runs directly on the GPU as if it were a CPU target.
Reviewed By: jplehr
Differential Revision: https://reviews.llvm.org/D155003
Jakub Kuderski [Wed, 19 Jul 2023 15:01:07 +0000 (11:01 -0400)]
[mlir][spirv] Add cooperative matrix store op
Implement cooperative matrix store for the `SPV_KHR_cooperative_matrix`
extension: https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/KHR/SPV_KHR_cooperative_matrix.html.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D155631
Jakub Kuderski [Wed, 19 Jul 2023 14:55:25 +0000 (10:55 -0400)]
[mlir][spirv] Add cooperative matrix load op
Implement cooperative matrix load for the `SPV_KHR_cooperative_matrix`
extension: https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/KHR/SPV_KHR_cooperative_matrix.html.
Also some minor fixes in common code for custom parsing.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D155616
Razvan Lupusoru [Tue, 18 Jul 2023 20:39:51 +0000 (13:39 -0700)]
[openacc] Add attribute to hold declare data clause information
For variables in declare clauses, their producing operation should be
marked with the data clause for ease of lookup and consistency
verification. Thus add an attribute that can be used for this purpose
plus verification that declare data operation matches the declare
data clause on variable.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D155640
Maksim Kita [Wed, 19 Jul 2023 14:52:55 +0000 (16:52 +0200)]
[AggressiveInstCombine] Fold strcmp for short string literals tests (NFC)
Precommit tests for D154725.
Differential Revision: https://reviews.llvm.org/D155053
Markus Böck [Tue, 18 Jul 2023 12:30:00 +0000 (14:30 +0200)]
[mlir][flang] Convert TBAA metadata to an attribute representation
The current representation of TBAA is the very last in-tree user of the `llvm.metadata` operation.
Using ops to model metadata has a few disadvantages:
* Building a graph has to be done through some weakly typed indirection mechanism such as `SymbolRefAttr`
* Creating the metadata has to be done through a builder within a metadata op.
* It is not multithreading safe as operation insertion into the same block is not thread-safe
This patch therefore converts TBAA metadata into an attribute representation, in a similar manner as it has been done for alias groups and access groups in previous patches.
This additionally has the large benefit of giving us more "correctness by construction" as it makes things like cycles in a TBAA graph, or references to an incorrectly typed metadata node impossible.
Differential Revision: https://reviews.llvm.org/D155444
Ingo Müller [Wed, 19 Jul 2023 11:55:00 +0000 (11:55 +0000)]
[mlir][transform][linalg][python] Add mix-in for FuseIntoContainingOp.
The class did not have any mix-in until now. The new mix-in has two
overloads for the constructor of the class: one with all arguments and
one without the result types, which are defaulted to `AnyOpType`.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D155695
Kadir Cetinkaya [Wed, 19 Jul 2023 10:31:40 +0000 (12:31 +0200)]
Reland "[clangd] Always run preamble indexing on a separate thread"
This reverts commit
92c0546941190973e9201a08fa10edf27cb6992d.
Prevents tsan issues by resetting ref-counted-pointers eagerly, before
passing the copies into a new thread.
Ingo Müller [Wed, 19 Jul 2023 14:19:57 +0000 (14:19 +0000)]
[mlir][transform][linalg][python] Fix test for TileToForallOp mixin.
The test was introduced recently by https://reviews.llvm.org/D155090,
but https://reviews.llvm.org/D155567, which I worked on concurrently
affected the output of that test and the two patches were never tested
together.
Differential Revision: https://reviews.llvm.org/D155709
Martin Erhart [Wed, 19 Jul 2023 14:13:27 +0000 (14:13 +0000)]
[mlir][bufferization] Add lowering of bufferization.dealloc to memref.dealloc
Adds a generic lowering that suppors all cases of bufferization.dealloc
and one specialized, more efficient lowering for the simple case. Using
a helper function with for loops in the general case enables
O(|num_dealloc_memrefs|+|num_retain_memrefs|) size of the lowered code.
Depends on D155467
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D155468
Joseph Huber [Wed, 19 Jul 2023 14:25:34 +0000 (09:25 -0500)]
Revert "[libc] Treat the locks array as a bitfield"
Summary:
This caused test failures on the gfx90a buildbot. This works on my
gfx1030 and the Nvidia buildbots, so we'll need to investigate what is
going wrong here. For now revert it to get the bots green.
This reverts commit
05abcc579244b68162b847a6780d27b22bd58f74.
Djordje Todorovic [Wed, 19 Jul 2023 09:25:51 +0000 (11:25 +0200)]
[RISCV] Add DAG combine for CTTZ/CTLZ in the case of input 0
Within the AggressiveInstCombine Pass we have
an analysis/optimization that matches that
pattern of the Table Based CTZ. Some Targets do
not support/define ctz(0), but since the
AggressiveInstCombine is just an extension of
InstCombine, it should be a target-independent
canonicalization Pass, and therefore, we decided
to introduce several instructions, such as select
and compare that produce canonical IR, even if
the input is 0. The task for the Targets that do
support that input is to handle such a case and
to produce an optimal assembly.
This patch optimizes the CTTZ/CTLZ instructions
if the input is 0 by performing the`DAG combine`,
by generating the cttz(x) & 0x1f pattern (the
same goes for ctlz as well).
Differential Revision: https://reviews.llvm.org/D151449
Ingo Müller [Wed, 12 Jul 2023 10:38:24 +0000 (10:38 +0000)]
[mlir][transform][linalg][python] Add extended TileToForallOp.
This patch adds a mixin for TileToForallOp to
_structured_transform_ops_ext.py with syntactic sugar for construction
such ops. First, the types of the results are made optional and filled
with common default values if omitted. Second, for num_threads and
tile_sizes, the three possible forms (static, dynamic, or packed), can
now all be given through the same respective argument, which gets
dispatched to the correct form-specific argument automatically.
Reviewed By: nicolasvasilache, ftynse
Differential Revision: https://reviews.llvm.org/D155090
Jie Fu [Wed, 19 Jul 2023 13:59:53 +0000 (21:59 +0800)]
[clangd] Fix -Wunused-variable of 'FIDIt' (NFC)
/data/llvm-project/clang-tools-extra/clangd/index/SymbolCollector.cpp:878:16: error: unused variable 'FIDIt' [-Werror,-Wunused-variable]
const auto FIDIt = IncludeFiles.find(SID);
^
1 error generated.
Viktoriia Bakalova [Wed, 14 Jun 2023 12:21:08 +0000 (12:21 +0000)]
[clangd] Update symbol collector to use include-cleaner.
Differential Revision: https://reviews.llvm.org/D152900
David Truby [Thu, 6 Jul 2023 14:59:16 +0000 (15:59 +0100)]
[flang] Implement tand intrinsic
This implements the tand intrinsic by performing a multiplication
by pi/180 to the argument before calling tan inline.
This is a commonly provided extension that is used by OpenRadioss
Differential Revision: https://reviews.llvm.org/D154614
David Truby [Fri, 14 Jul 2023 16:02:44 +0000 (17:02 +0100)]
[flang] Use libm functions for complex operations by default
This patch changes the default lowering for complex operations to use
the more accurate libm operations as opposed to the mlir complex
operations. This is necessary due to precision issues in the mlir
complex dialect that cause failures in e.g. the LAPACK tests.
The mlir complex dialect lowering will still be used when
`-fapprox-func` is set (and by extension `-ffast-math` and `-Ofast`)
Differential Revision: https://reviews.llvm.org/D155310
Simon Pilgrim [Wed, 19 Jul 2023 13:32:25 +0000 (14:32 +0100)]
[X86] getFauxShuffleMask - add SIGN_EXTEND_VECTOR_INREG handling for all-signbits sources
Add suport for shuffle combines (via combineEXTEND_VECTOR_INREG) to begin from SIGN_EXTEND_VECTOR_INREG nodes
Paweł Bylica [Wed, 19 Jul 2023 11:55:19 +0000 (13:55 +0200)]
[InstCombine] Preserve metadata when combining select+binop
Fixes https://github.com/llvm/llvm-project/issues/63910
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D155461
Paweł Bylica [Wed, 19 Jul 2023 11:54:51 +0000 (13:54 +0200)]
[InstCombine][NFC] Add tests for preserving metadata
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D155594
Felipe de Azevedo Piovezan [Thu, 13 Jul 2023 13:12:01 +0000 (09:12 -0400)]
[lldb][NFC] Refactor test to enable subsequent reuse
On a subsequent commit, I intend to update the expression and call the evaluate
function more times. This refactors enables reusing some of the existing code
for that.
Differential Revision: https://reviews.llvm.org/D155197
Felipe de Azevedo Piovezan [Fri, 14 Jul 2023 17:34:27 +0000 (13:34 -0400)]
[lldb][NFC] Factor out CommandObject code filtering results based on scope
We will need this code in a subsequent commit.
Differential Revision: https://reviews.llvm.org/D155332
Simon Pilgrim [Wed, 19 Jul 2023 13:04:30 +0000 (14:04 +0100)]
[X86] Add test coverage for Issue #63946
Simon Pilgrim [Wed, 19 Jul 2023 12:55:11 +0000 (13:55 +0100)]
[X86] matchUnaryShuffle - match SIGN_EXTEND_VECTOR_INREG patterns for 'all-signbits' sources
Adapt the existing ANY/ZERO_EXTEND_VECTOR_INREG shuffle matching to also recognise SIGN_EXTEND_VECTOR_INREG patterns to handle cases where we're effectively "splatting" all-signbits sources.
John Brawn [Wed, 5 Jul 2023 15:21:51 +0000 (16:21 +0100)]
[ARM] Correctly handle execute-only in EmitStructByval
Currently when compiling for an execute-only target without movt then
EmitStructByval will generate a constant pool load which isn't
compatible with execute-only. Handle this by emitting tMOVi32imm,
and also simplify the existing movt handling by emitting t2MOVi32imm
or MOVi32imm.
Differential Revision: https://reviews.llvm.org/D154944
John Brawn [Thu, 6 Jul 2023 09:43:40 +0000 (10:43 +0100)]
[ARM] Restructure MOVi32imm expansion to not do pointless instructions
The expansion of the various MOVi32imm pseudo-instructions works by
splitting the operand into components (either halfwords or bytes) and
emitting instructions to combine those components into the final
result. When the operand is an immediate with some components being
zero this can result in pointless instructions that just add zero.
Avoid this by restructuring things so that a separate function handles
splitting the operand into components, then don't emit the component
if it is a zero immediate. This is straightforward for movw/movt,
where we just don't emit the movt if it's zero, but the thumb1
expansion using mov/add/lsl is more complex, as even when we don't
emit a given byte we still need to get the shift correct.
Differential Revision: https://reviews.llvm.org/D154943
Ties Stuij [Wed, 19 Jul 2023 10:26:01 +0000 (11:26 +0100)]
[ARM] don't emit constant pool for Thumb1 XO/stack guard combo
Currently for armv6-m and armv8-m.baseline, we emit constant pool code when we
use execute-only (XO) in combination with stack guards.
XO is a new feature for armv6-m, and this patch is part of a series of patches
that substitutes constant pool generation with the tMOVi32imm equivalent.
However XO for armv8-m.baseline has been available for about 6 years, and so
for armv8-m.baseline this is a bugfix.
Reviewed By: simonwallis2, olista01
Differential Revision: https://reviews.llvm.org/D155170
Kelvin Li [Tue, 18 Jul 2023 14:40:39 +0000 (10:40 -0400)]
[flang] Simplify macros for the vec_sld and vec_sldw intrinsics
The ignore_tkr directive is applied to the third argument so that the number of
interfaces can be reduced.
Differential Revision: https://reviews.llvm.org/D155624
Carlos Galvez [Mon, 17 Jul 2023 19:54:23 +0000 (19:54 +0000)]
[clang-tidy] Warn only for copyable/movable classes in cppcoreguidelines-avoid-const-or-ref-members
Since that's what the guidelines require.
Fixes #63733
Differential Revision: https://reviews.llvm.org/D155625
Piyou Chen [Wed, 19 Jul 2023 08:58:02 +0000 (01:58 -0700)]
[RISCV] Replace zihintntl with zicond in ISAInfo unittest
Some ISAInfo unittest base on experimental-zihintntl, but zihintntl will become none-experimental. This patch use another experimental extension zicond to replace zihintntl.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155673
pvanhout [Tue, 11 Jul 2023 10:22:57 +0000 (12:22 +0200)]
[TableGen] Deprecate old GI Combiner Emitter
Will be removed in a month or so.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D154939
Igor Kirillov [Mon, 26 Jun 2023 17:26:43 +0000 (17:26 +0000)]
[CodeGen] Extend ComplexDeinterleaving pass to recognise patterns using integer types
AArch64 introduced CMLA and CADD instructions as part of SVE2. This
change allows to generate such instructions when this architecture
feature is available.
Differential Revision: https://reviews.llvm.org/D153808
Simon Pilgrim [Wed, 19 Jul 2023 10:56:14 +0000 (11:56 +0100)]
[DAG] hoistLogicOpWithSameOpcodeHands - add support for SIGN_EXTEND_INREG nodes.
This can reuse the existing *_EXTEND node handling (with special handling for the valuetype arg)
Ivan Kosarev [Wed, 19 Jul 2023 10:34:25 +0000 (11:34 +0100)]
[AMDGPU] Combine the SDAG and GISel versions of the fmed3.ll test.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D155590
Ivan Kosarev [Wed, 19 Jul 2023 10:00:13 +0000 (11:00 +0100)]
[AMDGPU][AsmParser][NFC] Translate parsed DS instructions to MCInsts automatically.
Part of <https://github.com/llvm/llvm-project/issues/62629>.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D155620
Jie Fu [Wed, 19 Jul 2023 09:50:11 +0000 (17:50 +0800)]
[InstrProf] Ignore -Wcast-qual after D153911 to fix build failure (NFC)
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:46:60: error: cast from 'const char *' to 'struct __llvm_profile_header *' drops const qualifier [-Werror,-Wcast-qual]
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:49:30: error: cast from 'const char *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:77:41: error: cast from 'const struct __llvm_profile_data *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
DstData = (__llvm_profile_data *)__llvm_profile_begin_data();
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:109:60: error: cast from 'const char *' to 'struct __llvm_profile_header *' drops const qualifier [-Werror,-Wcast-qual]
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:116:30: error: cast from 'const char *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:129:40: error: cast from 'const struct __llvm_profile_data *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
DstData = (__llvm_profile_data *)__llvm_profile_begin_data(),
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:179:34: error: cast from 'const char *' to 'struct ValueProfData *' drops const qualifier [-Werror,-Wcast-qual]
VPMergeHook((ValueProfData *)SrcValueProfData, DstData);
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:181:46: error: cast from 'const char *' to 'struct ValueProfData *' drops const qualifier [-Werror,-Wcast-qual]
SrcValueProfData + ((ValueProfData *)SrcValueProfData)->TotalSize;
^
...
Simon Pilgrim [Wed, 19 Jul 2023 09:50:07 +0000 (10:50 +0100)]
[DAG] hoistLogicOpWithSameOpcodeHands - add support for *_EXTEND_VECTOR_INREG nodes.
This can reuse the existing *_EXTEND node handling.
Mikhail Goncharov [Wed, 19 Jul 2023 09:21:42 +0000 (11:21 +0200)]
[bazel] remove PythonAttr TD after
67a910bbff772ebf4c47e8b434b59cdc4820bb68
Differential Revision: https://reviews.llvm.org/D155686
Guray Ozen [Wed, 19 Jul 2023 08:29:41 +0000 (10:29 +0200)]
[mlir][nvvm] Introduce Syncronization Ops for WGMMA
This work introduces : `wgmma.fence.aligned`, `wgmma.commit.group.sync.aligned` and `wgmma.wait.group.sync.aligned` Ops. They are used to syncronize warpgroup level matrix multiply-accumulate instructions, as known as WGMMA.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D155676
Jay Foad [Wed, 19 Jul 2023 07:29:14 +0000 (08:29 +0100)]
[AMDGPU] Insert s_nop before s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
Differential Revision: https://reviews.llvm.org/D155681
Jay Foad [Mon, 17 Jul 2023 15:20:32 +0000 (16:20 +0100)]
[ARM] Add a regression test for D154281
This is a reduced version of one of the tests that was broken by the
original commit of D154281 "[CodeGen] Store SP adjustment in
MachineBasicBlock. NFCI.".
Differential Revision: https://reviews.llvm.org/D155471
Jingu Kang [Wed, 19 Jul 2023 09:30:30 +0000 (10:30 +0100)]
Revert "[MachineLICM] Handle Subloops"
This reverts commit
33e60484d750291e99301e29e60fe72c8fa48ccd.
Shivam Gupta [Wed, 19 Jul 2023 09:19:43 +0000 (14:49 +0530)]
[clang][Docs] Added release note for D142609