platform/upstream/llvm.git
12 months ago[mlir][openacc] Relax verifier for the acc.reduction.recipe
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

12 months ago[RISCV] Run mem2reg on the scalar C builtin tests to remove allocas and simplify...
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.

12 months ago[AMDGPUAttributor][FIX] No endless recursion for recursive initializers
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

12 months ago[Attributor][NFCI] Add a shortcut for constants
Johannes Doerfert [Wed, 19 Jul 2023 17:13:03 +0000 (10:13 -0700)]
[Attributor][NFCI] Add a shortcut for constants

12 months ago[Attributor][NFCI] Avoid updating AAs that depend on missing callees
Johannes Doerfert [Wed, 19 Jul 2023 06:27:16 +0000 (23:27 -0700)]
[Attributor][NFCI] Avoid updating AAs that depend on missing callees

12 months agoRefactor some BasicBlockUtils functions (NFC)
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

12 months ago[Clang][CodeGen]`vtable`, `typeinfo` et al. are globals
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

12 months ago[RISCV] Upgrade Zvfh version to 1.0 and move out of experimental state.
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

12 months ago[lld-macho] Switch to xxh3_64bits
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

12 months ago[DWARFLinkerParallel] Switch to xxh3_64bits
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

12 months ago[libc] Fix global constructor being emitted for the RPC client
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

12 months ago[RISCV] Fold ops into vmv.v.v as vmerge with all-ones mask
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

12 months ago[RISCV] Fold vmerge into its ops with smaller VL if known
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

12 months ago[RISCV] Add tests for merges with differing VLs that could be folded
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

12 months ago[nfc][openacc] Add missing comma in acc dialect operation macros
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

12 months ago[SLP][X86] Regenerate some test checks to reduce diff in D154891
Simon Pilgrim [Wed, 19 Jul 2023 16:02:03 +0000 (17:02 +0100)]
[SLP][X86] Regenerate some test checks to reduce diff in D154891

12 months ago[X86] matchBinaryShuffle - match PACKSS for v2i64 -> v4i32 all-signbits shuffle trunc...
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.

12 months ago[libunwind] Fix build error on 32 bit Arm after -Wcast-qual was added
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

12 months ago[flang] Represent unknown extent correctly in getTypeAsString
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

12 months ago[IR] Remove declaration of no longer existing constructor (NFC)
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!

12 months ago[mlir][transform][gpu][python] Add .td file for bindings.
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

12 months ago[ELF] Use llvm::xxh3_64bits for MergeInputSection::splitStrings
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

12 months ago[libc++] Work around dynamic linking of stringbuf::str() on Windows
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

12 months ago[AggressiveInstCombine] Fold strcmp for short string literals
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

12 months ago[libc] Add basic support for calling host functions from the GPU
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

12 months ago[mlir][spirv] Add cooperative matrix store op
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

12 months ago[mlir][spirv] Add cooperative matrix load op
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

12 months ago[openacc] Add attribute to hold declare data clause information
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

12 months ago[AggressiveInstCombine] Fold strcmp for short string literals tests (NFC)
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

12 months ago[mlir][flang] Convert TBAA metadata to an attribute representation
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

12 months ago[mlir][transform][linalg][python] Add mix-in for FuseIntoContainingOp.
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

12 months agoReland "[clangd] Always run preamble indexing on a separate thread"
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.

12 months ago[mlir][transform][linalg][python] Fix test for TileToForallOp mixin.
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

12 months ago[mlir][bufferization] Add lowering of bufferization.dealloc to memref.dealloc
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

12 months agoRevert "[libc] Treat the locks array as a bitfield"
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.

12 months ago[RISCV] Add DAG combine for CTTZ/CTLZ in the case of input 0
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

12 months ago[mlir][transform][linalg][python] Add extended TileToForallOp.
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

12 months ago[clangd] Fix -Wunused-variable of 'FIDIt' (NFC)
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.

12 months ago[clangd] Update symbol collector to use include-cleaner.
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

12 months ago[flang] Implement tand intrinsic
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

12 months ago[flang] Use libm functions for complex operations by default
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

12 months ago[X86] getFauxShuffleMask - add SIGN_EXTEND_VECTOR_INREG handling for all-signbits...
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

12 months ago[InstCombine] Preserve metadata when combining select+binop
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

12 months ago[InstCombine][NFC] Add tests for preserving metadata
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

12 months ago[lldb][NFC] Refactor test to enable subsequent reuse
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

12 months ago[lldb][NFC] Factor out CommandObject code filtering results based on scope
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

12 months ago[X86] Add test coverage for Issue #63946
Simon Pilgrim [Wed, 19 Jul 2023 13:04:30 +0000 (14:04 +0100)]
[X86] Add test coverage for Issue #63946

12 months ago[X86] matchUnaryShuffle - match SIGN_EXTEND_VECTOR_INREG patterns for 'all-signbits...
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.

12 months ago[ARM] Correctly handle execute-only in EmitStructByval
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

12 months ago[ARM] Restructure MOVi32imm expansion to not do pointless instructions
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

12 months ago[ARM] don't emit constant pool for Thumb1 XO/stack guard combo
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

12 months ago[flang] Simplify macros for the vec_sld and vec_sldw intrinsics
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

12 months ago[clang-tidy] Warn only for copyable/movable classes in cppcoreguidelines-avoid-const...
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

12 months ago[RISCV] Replace zihintntl with zicond in ISAInfo unittest
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

12 months ago[TableGen] Deprecate old GI Combiner Emitter
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

12 months ago[CodeGen] Extend ComplexDeinterleaving pass to recognise patterns using integer types
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

12 months ago[DAG] hoistLogicOpWithSameOpcodeHands - add support for SIGN_EXTEND_INREG nodes.
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)

12 months ago[AMDGPU] Combine the SDAG and GISel versions of the fmed3.ll test.
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

12 months ago[AMDGPU][AsmParser][NFC] Translate parsed DS instructions to MCInsts automatically.
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

12 months ago[InstrProf] Ignore -Wcast-qual after D153911 to fix build failure (NFC)
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;
                                             ^
...

12 months ago[DAG] hoistLogicOpWithSameOpcodeHands - add support for *_EXTEND_VECTOR_INREG nodes.
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.

12 months ago[bazel] remove PythonAttr TD after 67a910bbff772ebf4c47e8b434b59cdc4820bb68
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

12 months ago[mlir][nvvm] Introduce Syncronization Ops for WGMMA
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

12 months ago[AMDGPU] Insert s_nop before s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
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

12 months ago[ARM] Add a regression test for D154281
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

12 months agoRevert "[MachineLICM] Handle Subloops"
Jingu Kang [Wed, 19 Jul 2023 09:30:30 +0000 (10:30 +0100)]
Revert "[MachineLICM] Handle Subloops"

This reverts commit 33e60484d750291e99301e29e60fe72c8fa48ccd.

12 months ago[clang][Docs] Added release note for D142609
Shivam Gupta [Wed, 19 Jul 2023 09:19:43 +0000 (14:49 +0530)]
[clang][Docs] Added release note for D142609

12 months ago[VectorCombine] Use poison insteaf of undef as placeholder [NFC]
Nuno Lopes [Wed, 19 Jul 2023 09:24:41 +0000 (10:24 +0100)]
[VectorCombine] Use poison insteaf of undef as placeholder [NFC]
These vector lanes are never accessed. They are used for shifting a value into the right lane
and therefore only 1 value of the whole vector is actually used

12 months agoReapply: [MemCpyOpt] implement single BB stack-move optimization which unify the...
khei4 [Tue, 18 Jul 2023 09:58:20 +0000 (18:58 +0900)]
Reapply: [MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas

This reverts commit 8f3864ba4323a253bcf29825d23cd325b52c4106.
Differential Revision: https://reviews.llvm.org/D153453

12 months ago[MemCpyOpt] add terminator user test for D153453(NFC)
khei4 [Tue, 18 Jul 2023 09:55:26 +0000 (18:55 +0900)]
[MemCpyOpt] add terminator user test for D153453(NFC)
Differential Revision: https://reviews.llvm.org/D155571

12 months ago[mlir][linalg][transform][python] Add type arg to MatchOp extension.
Ingo Müller [Tue, 18 Jul 2023 09:07:17 +0000 (09:07 +0000)]
[mlir][linalg][transform][python] Add type arg to MatchOp extension.

The extension class to MatchOp has a class method called match_op_names.
The previous version of that function did not allow to specify the
result type. This, however, may be useful/necessary if the op consuming
the resulting handle requires a particular type (such as the
bufferization.EmptyTensorToAllocTensorOp). This patch adds an overload
to match_op_names that allows to specify the result type.

Reviewed By: ftynse

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

12 months ago[X86] LowerEXTEND_VECTOR_INREG - add sign_extend_vector_inreg fast path for all-signb...
Simon Pilgrim [Wed, 19 Jul 2023 09:10:15 +0000 (10:10 +0100)]
[X86] LowerEXTEND_VECTOR_INREG - add sign_extend_vector_inreg fast path for all-signbits source values

If the source operand is already all-signbits we don't need to create the sign extended elements - just splat the source element to the destination element width

12 months ago[mlir][bazel] Fix build.
Oleg Shyshkov [Wed, 19 Jul 2023 09:10:53 +0000 (11:10 +0200)]
[mlir][bazel] Fix build.

12 months ago[libc][NFC] Rename files
Guillaume Chatelet [Tue, 18 Jul 2023 15:29:42 +0000 (15:29 +0000)]
[libc][NFC] Rename files

This patch mostly renames files so it better reflects the function they declare.

Reviewed By: michaelrj

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

12 months ago[lldb] XFAIL command-disassemble-mixed.c on Windows
David Spickett [Wed, 19 Jul 2023 09:04:13 +0000 (09:04 +0000)]
[lldb] XFAIL command-disassemble-mixed.c on Windows

Either clang-cl has different assembly output or we're not mapping
source to assembly properly on Windows. We (Linaro) will find out which.

https://lab.llvm.org/buildbot/#/builders/219/builds/4195

12 months ago[NFC] Adjust test for pr63595
Chuanqi Xu [Wed, 19 Jul 2023 08:50:26 +0000 (16:50 +0800)]
[NFC] Adjust test for pr63595

The original test case is not strictly correct but our ODR checking
system doesn't find it.

12 months agoRevert "[clangd] Remove unused private field 'Opts' in UpdateIndexCallbacks (NFC)"
Kadir Cetinkaya [Wed, 19 Jul 2023 08:45:06 +0000 (10:45 +0200)]
Revert "[clangd] Remove unused private field 'Opts' in UpdateIndexCallbacks (NFC)"

This reverts commit c4fa97fca7e92c736fcb09779c84b42c25ffae70.

12 months ago[libc][memfunctions] Explicit error when platform in not supported
Guillaume Chatelet [Tue, 18 Jul 2023 16:32:04 +0000 (16:32 +0000)]
[libc][memfunctions] Explicit error when platform in not supported

Reviewed By: JonChesterfield, jhuber6

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

12 months ago[LoopPeel] Clear dispositions after peeling
Nikita Popov [Mon, 26 Jun 2023 13:33:09 +0000 (15:33 +0200)]
[LoopPeel] Clear dispositions after peeling

Block dispositions of values defined inside the loop may change
during peeling, so clear them. We already do this for other kinds
of unrolling.

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

12 months agoRevert "[clangd] Always run preamble indexing on a separate thread"
Kadir Cetinkaya [Wed, 19 Jul 2023 07:14:23 +0000 (09:14 +0200)]
Revert "[clangd] Always run preamble indexing on a separate thread"

This reverts commit 036a1b2202cb71aacfa72ef15145a88dc50a02cf.

Triggering failures under tsan, https://lab.llvm.org/buildbot/#/builders/131/builds/48349

12 months ago[Clang][Driver] Pass through the --be8 endian flag to linker in BareMetal driver...
Simi Pallipurath [Fri, 30 Jun 2023 10:48:47 +0000 (11:48 +0100)]
[Clang][Driver] Pass through the --be8 endian flag to linker in BareMetal driver For Arm.

When linking a big-endian image for Arm, clang has
to select  between BE8 and BE32 formats. The default
is dependent on the selected target architecture.
For ARMv6 and later architectures the default is
BE8, for older architectures the default is BE32.
For BE8 and BE32, compiler outputs a big endian ELF
relocatable object file with the instructions and
data both big endian. The difference is that at
link time, for BE8 a linker must endian reverse
the instructions to little endian. For BE8, the
clang has to pass --be8 to the linker for Arm.

At the moment clang is not passing the --be8 flag
to linker for the baremetal target architectures
above ArmV6 for Arm. This patch passes through --be8
and -BE or EL to the linker, taking into account the
target and the -mbig-endian and -mlittle-endian flag.
Also there are few more changes in the baremetal
driver so that the code can cope with AArch64 being
big-endian as well.

Reviewed By: michaelplatings, MaskRay

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

12 months ago[clangd] Make an include always refer to itself. Background: clang-review expects...
Viktoriia Bakalova [Tue, 18 Jul 2023 15:48:24 +0000 (15:48 +0000)]
[clangd] Make an include always refer to itself. Background: clang-review expects all referents to have definition, declaration or reference(s).

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

12 months ago[AMDGPU] Regenerate is.fpclass checks
Jay Foad [Wed, 19 Jul 2023 08:20:08 +0000 (09:20 +0100)]
[AMDGPU] Regenerate is.fpclass checks

12 months ago[libcxx] Link to fewer MSVC CRT libraries
Martin Storsjö [Sun, 16 Jul 2023 21:35:04 +0000 (00:35 +0300)]
[libcxx] Link to fewer MSVC CRT libraries

The library msvcrt.lib pulls in ucrt.lib and vcruntime.lib anyway,
there's no need to manually link against the individual dependencies.

This matches how the tests link against libraries - they only link
against msvcrt and msvcprt, not directly against ucrt and vcruntime.

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

12 months ago[libcxx] [test] Remove a stray double space from a test config. NFC.
Andrew Ng [Fri, 14 Jul 2023 08:49:24 +0000 (11:49 +0300)]
[libcxx] [test] Remove a stray double space from a test config. NFC.

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

12 months ago[mlir] Update SVE integration tests to use mlir-cpu-runner
Andrzej Warzynski [Mon, 10 Apr 2023 13:43:39 +0000 (13:43 +0000)]
[mlir] Update SVE integration tests to use mlir-cpu-runner

With the recent addition of "-mattr" and "-march" to the list of options
supported by mlir-cpu-runner [1], the SVE integration
tests can be updated to use mlir-cpu-runner instead of lli. This will
allow better code re-use and more consistency

This patch updates 2 tests to demonstrate the new logic. The remaining
tests will be updated in the follow-up patches.

[1] https://reviews.llvm.org/D146917

Depends on D155403

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

12 months ago[CMake] Clean up old code for handling MSVC runtime setting the old way
Martin Storsjö [Mon, 17 Jul 2023 08:16:05 +0000 (11:16 +0300)]
[CMake] Clean up old code for handling MSVC runtime setting the old way

This was left in place to reduce the risk of breaking anything,
and to keep the diff smaller, in D155233.

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

12 months ago[IR] Deprecate opaque pointer compatibility APIs
Nikita Popov [Tue, 18 Jul 2023 10:13:59 +0000 (12:13 +0200)]
[IR] Deprecate opaque pointer compatibility APIs

This deprecates various compatibility APIs that have been
introduced as part of the opaque pointer migration.

These will be removed at some point after the LLVM 17 release.

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

12 months agoReland [AArch64] Fix an immediate out of range for large realignments on Windows
Martin Storsjö [Mon, 17 Jul 2023 12:19:14 +0000 (15:19 +0300)]
Reland [AArch64] Fix an immediate out of range for large realignments on Windows

Also add a missing FrameSetup flag on the existing add instruction.

This fixes https://github.com/llvm/llvm-project/issues/63701.

Since the previous iteration, change ADDXrr to ADDXrx64, which
works with this use of SP.

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

12 months ago[X86] Add PBNDKB instruction.
Freddy Ye [Wed, 19 Jul 2023 08:14:06 +0000 (16:14 +0800)]
[X86] Add PBNDKB instruction.

For more details about this instruction, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

Reviewed By: pengfei, skan

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

12 months ago[NFC] Add a blank line after directives in StandardCPlusPlusModules.rst
Chuanqi Xu [Wed, 19 Jul 2023 08:10:55 +0000 (16:10 +0800)]
[NFC] Add a blank line after  directives in StandardCPlusPlusModules.rst

12 months ago[clang][analyzer] StdLibraryFunctionsChecker: Allow NULL buffer in `fread` and `fwrit...
Balázs Kéri [Wed, 19 Jul 2023 07:23:32 +0000 (09:23 +0200)]
[clang][analyzer] StdLibraryFunctionsChecker: Allow NULL buffer in `fread` and `fwrite` if size is zero.

Reviewed By: donat.nagy

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

12 months ago[NFC][AMDGPULowerModuleLDSPass] Use shorter APIs in markUsedByKernel
Juan Manuel MARTINEZ CAAMAÑO [Wed, 19 Jul 2023 07:37:42 +0000 (09:37 +0200)]
[NFC][AMDGPULowerModuleLDSPass] Use shorter APIs in markUsedByKernel

* Use shorter versions of the LLVM API

Reviewed By: JonChesterfield

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

12 months ago[NFC][AMDGPULowerModuleLDSPass] Cleanup of getTableLookupKernelIndex
Juan Manuel MARTINEZ CAAMAÑO [Wed, 19 Jul 2023 07:37:29 +0000 (09:37 +0200)]
[NFC][AMDGPULowerModuleLDSPass] Cleanup of getTableLookupKernelIndex

* Do a single lookup when querying the map
* Use shorter versions of the LLVM API

Reviewed By: JonChesterfield

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

12 months ago[mlir][LLVM] add `llvm.ssa.copy` intrinsic
Markus Böck [Wed, 19 Jul 2023 07:32:17 +0000 (09:32 +0200)]
[mlir][LLVM] add `llvm.ssa.copy` intrinsic

This is quite the niche intrinsic, whose whole purpose is to be able to essentially split an SSA value to be able to attach additional information to the new value.
It therefore really acts like a noop that just passes through its argument. It interestingly does not have any support in CodeGen and is therefore required to also be deleted by any pass creating it.

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

12 months ago[IR] Remove Type::getPointerElementType() (NFC)
Nikita Popov [Wed, 19 Jul 2023 07:40:48 +0000 (09:40 +0200)]
[IR] Remove Type::getPointerElementType() (NFC)

This method has been deprecated since the LLVM 15 release and
can no longer meaningfully be used, so remove it.

12 months ago[NFC] [C++20] [Modules] Add a performance tip to the document
Chuanqi Xu [Wed, 19 Jul 2023 07:46:52 +0000 (15:46 +0800)]
[NFC] [C++20] [Modules] Add a performance tip to the document

It is a known problem that the compiler isn't efficiency when there are
a lot of duplications in the modules to developers. But it may not be
verbose to the (potential) new users of C++20 modules.

It may be necessary to mention this in the document.

12 months ago[clangd] Remove unused private field 'Opts' in UpdateIndexCallbacks (NFC)
Jie Fu [Wed, 19 Jul 2023 07:28:38 +0000 (15:28 +0800)]
[clangd] Remove unused private field 'Opts' in UpdateIndexCallbacks (NFC)

/Users/jiefu/llvm-project/clang-tools-extra/clangd/ClangdServer.cpp:167:32: error: private field 'Opts' is not used [-Werror,-Wunused-private-field]
  const ClangdServer::Options &Opts;
                               ^
1 error generated.

12 months ago[mlir][NFC] Avoid `OpBuilder::setListener` when possible
Matthias Springer [Wed, 19 Jul 2023 06:59:02 +0000 (08:59 +0200)]
[mlir][NFC] Avoid `OpBuilder::setListener` when possible

`setListener` is dangerous because an already registered listener may accidentally be overwritten/replaced. (A `ForwardingListener` must be used in such cases.) This change updates a few trivial call sites of `setListener`, where no forwarding listener is needed.

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

12 months ago[RISCV] Make SubtargetFeature description strings consistent with AssemblerPredicate.
Craig Topper [Wed, 19 Jul 2023 07:12:19 +0000 (00:12 -0700)]
[RISCV] Make SubtargetFeature description strings consistent with AssemblerPredicate.

Mostily capitalizing 'Z' for multi-letter extensions.