platform/upstream/llvm.git
2 years agoAMDGPU/GlobalISel: Fix assert on invalid cond code for llvm.amdgcn.icmp
Matt Arsenault [Tue, 18 Jan 2022 23:37:27 +0000 (18:37 -0500)]
AMDGPU/GlobalISel: Fix assert on invalid cond code for llvm.amdgcn.icmp

2 years ago[flang] split character procedure arguments in target-rewrite pass
Jean Perier [Thu, 27 Jan 2022 13:59:38 +0000 (14:59 +0100)]
[flang] split character procedure arguments in target-rewrite pass

When passing a character procedure as a dummy procedure, the result
length must be passed along the function address. This is to cover
the cases where the dummy procedure is declared with assumed length
inside the scope that will call it (it will need the length to allocate
the result on the caller side).

To be compatible with other Fortran compiler, this length must be
appended after all other argument just like character objects
(fir.boxchar).

A fir.boxchar cannot be used to implement this feature because it
is meant to take an object address, not a function address.

Instead, argument like `tuple<function type, integer type> {fir.char_proc}`
will be recognized as being character dummy procedure in FIR. That way
lowering does not have to do the argument split.

This patch adds tools in Character.h to create this type and tuple
values as well as to recognize them and extract its tuple members.

It also updates the target rewrite pass to split these arguments like
fir.boxchar.

This part is part of fir-dev upstreaming. It was reviwed previously
in: https://github.com/flang-compiler/f18-llvm-project/pull/1393

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

2 years agoAMDGPU/GlobalISel: Fix flat_scratch_init handling for shaders
Matt Arsenault [Tue, 18 Jan 2022 22:45:51 +0000 (17:45 -0500)]
AMDGPU/GlobalISel: Fix flat_scratch_init handling for shaders

I don't think this is actually defined for mesa, but this is what we
were doing on the DAG path.

2 years agoclang-format: [JS] sort import aliases.
Martin Probst [Thu, 27 Jan 2022 14:15:30 +0000 (15:15 +0100)]
clang-format: [JS] sort import aliases.

Users can define aliases for long symbols using import aliases:

    import X = A.B.C;

Previously, these were unhandled and would terminate import sorting.
With this change, aliases sort as their own group, coming last after all
other imports.

Aliases are not sorted within their group, as they may reference each
other, so order is significant.

Revision URI: https://reviews.llvm.org/D118361

2 years ago[X86][SSE] Add combineBitOpWithShift for BITOP(SHIFT(X,Z),SHIFT(Y,Z)) -> SHIFT(BITOP...
Simon Pilgrim [Thu, 27 Jan 2022 14:54:16 +0000 (14:54 +0000)]
[X86][SSE] Add combineBitOpWithShift for BITOP(SHIFT(X,Z),SHIFT(Y,Z)) -> SHIFT(BITOP(X,Y),Z) vector folds

InstCombine performs this more generally with SimplifyUsingDistributiveLaws, but we don't need anything that complex here - this is mainly to fix up cases where logic ops get created late on during lowering, often in conjunction with sext/zext ops for type legalization.

https://alive2.llvm.org/ce/z/gGpY5v

2 years ago[AMDGPU] SILoadStoreOptimizer: Allow merging across a swizzled access
Jay Foad [Wed, 26 Jan 2022 17:09:38 +0000 (17:09 +0000)]
[AMDGPU] SILoadStoreOptimizer: Allow merging across a swizzled access

Swizzled accesses are not merged, but there is no particular reason not
to merge two instructions if any of the intervening instructions happens
to be a swizzled access.

This moves the check for swizzled accesses out of checkAndPrepareMerge
into collectMergeableInsts where I think it makes more sense.

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

2 years ago[AArch64] Add vector compare/select tests with UNE predicate.
Florian Hahn [Thu, 27 Jan 2022 14:20:30 +0000 (14:20 +0000)]
[AArch64] Add vector compare/select tests with UNE predicate.

Precommit some additional tests for D118256.

2 years ago[lldb] Delete TestBacktraceAll.py
Pavel Labath [Thu, 27 Jan 2022 13:55:49 +0000 (14:55 +0100)]
[lldb] Delete TestBacktraceAll.py

This test is completely nondeterministic, environment-dependent and does
not test what it was supposed to test (reverting the associated patch
does not make it fail).

I tried to figure out what the patch was meant to fix to see if I can
create a better test with the current tools, but I was not able to
understand the problem (it sounds like it has something to do with local
classes, but I don't understand the details).

2 years ago[ConstraintSystem] Mark function as const (NFC).
Florian Hahn [Thu, 27 Jan 2022 13:44:47 +0000 (13:44 +0000)]
[ConstraintSystem] Mark function as const (NFC).

2 years ago[OMPIRBuilder] Avoid pointer element type access
Nikita Popov [Thu, 27 Jan 2022 13:33:29 +0000 (14:33 +0100)]
[OMPIRBuilder] Avoid pointer element type access

Use isOpaqueOrPointeeTypeEquals() instead.

2 years ago[ConstraintElimination] Use simplified constraint for == 0.
Florian Hahn [Thu, 27 Jan 2022 13:31:23 +0000 (13:31 +0000)]
[ConstraintElimination] Use simplified constraint for == 0.

When checking x == 0, checking x u<= 0 is sufficient and simpler than
x u>= 0 && x u<= 0.

https://alive2.llvm.org/ce/z/btM7d3

    ----------------------------------------
    define i1 @src(i4 %a) {
    %0:
      %c = icmp eq i4 %a, 0
      ret i1 %c
    }
    =>
    define i1 @tgt(i4 %a) {
    %0:
       %c = icmp ule i4 %a, 0
       ret i1 %c
    }
    Transformation seems to be correct!

2 years ago[X86] Fold TESTZ(OR(LO(X),HI(X)),OR(LO(Y),HI(Y))) -> TESTZ(X,Y)
Simon Pilgrim [Thu, 27 Jan 2022 13:20:36 +0000 (13:20 +0000)]
[X86] Fold TESTZ(OR(LO(X),HI(X)),OR(LO(Y),HI(Y))) -> TESTZ(X,Y)

Helps fix a number of poor codegen cases for allof(cmp()) with 256-bit vectors on AVX1

2 years ago[X86] Add test showing failure to combine 128-bit PTEST of split vectors
Simon Pilgrim [Thu, 27 Jan 2022 12:56:50 +0000 (12:56 +0000)]
[X86] Add test showing failure to combine 128-bit PTEST of split vectors

2 years ago[AArch64][SVE] Avoid using ptrue for unpredicated predicate AND.
Sander de Smalen [Thu, 27 Jan 2022 12:15:12 +0000 (12:15 +0000)]
[AArch64][SVE] Avoid using ptrue for unpredicated predicate AND.

Reviewed By: david-arm

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

2 years ago[mlir][BufferOptimization] Use datalayout instead of a flag to find index size
Benjamin Kramer [Thu, 27 Jan 2022 12:02:34 +0000 (13:02 +0100)]
[mlir][BufferOptimization] Use datalayout instead of a flag to find index size

This has the additional advantage of supporting more types.

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

2 years ago[mlir][complex] Lower complex.constant to LLVM
Benjamin Kramer [Thu, 27 Jan 2022 12:08:08 +0000 (13:08 +0100)]
[mlir][complex] Lower complex.constant to LLVM

This fixes a regression from 480cd4cb8560532e544fc0c234749912dde759c6

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

2 years ago[ConstraintElimination] Introduce struct to manage constraints. (NFC)
Florian Hahn [Thu, 27 Jan 2022 12:40:09 +0000 (12:40 +0000)]
[ConstraintElimination] Introduce struct to manage constraints. (NFC)

This patch adds a struct to manage a list of constraints. It simplifies
a follow-up change, that adds pre-conditions that must hold before a
list of constraints can be used.

2 years ago[lldb] [gdb-remote] Support getting siginfo via API
Michał Górny [Mon, 24 Jan 2022 17:52:49 +0000 (18:52 +0100)]
[lldb] [gdb-remote] Support getting siginfo via API

Add Thread::GetSiginfo() and SBThread::GetSiginfo() methods to retrieve
the siginfo value from server.

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

2 years ago[lldb] [Platform] Support synthesizing siginfo_t
Michał Górny [Wed, 19 Jan 2022 19:16:07 +0000 (20:16 +0100)]
[lldb] [Platform] Support synthesizing siginfo_t

Support synthesizing the siginfo_t type from the Platform plugin.
This type is going to be used by LLDB client to process the raw siginfo
data received from lldb-server without the necessity of relying
on target's debug info being present.

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

2 years ago[AMDGPU] Precommit test for swizzled store aliasing two loads
Jay Foad [Thu, 27 Jan 2022 12:10:48 +0000 (12:10 +0000)]
[AMDGPU] Precommit test for swizzled store aliasing two loads

2 years ago[Test] Add data layout to relevant tests + some wide-typed tests
Max Kazantsev [Thu, 27 Jan 2022 12:05:23 +0000 (19:05 +0700)]
[Test] Add data layout to relevant tests + some wide-typed tests

2 years ago[clangd][Hover] Suppress initializers with many tokens
Kadir Cetinkaya [Wed, 26 Jan 2022 16:55:52 +0000 (17:55 +0100)]
[clangd][Hover] Suppress initializers with many tokens

This results in excessive memory usage and eats a lot of screen estate.
Especially in the cases with lots of nested macro calls.

This patch tries to remedy it before the release cut by suppressing the
initializers. For better UX we should probably update the expression printer to
truncate those (behind some policy).

Fixes https://github.com/clangd/clangd/issues/917

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

2 years ago[IR] Support ifuncs in opaque pointer mode
Nikita Popov [Thu, 27 Jan 2022 11:46:47 +0000 (12:46 +0100)]
[IR] Support ifuncs in opaque pointer mode

Relax the type assertion for opaque pointers, and enumerate the
value type in TypeFinder and ValueEnumerator.

2 years ago[Support] [Windows] Don't cancel delete if we failed to set delete
Shezan Baig [Thu, 27 Jan 2022 11:57:38 +0000 (13:57 +0200)]
[Support] [Windows] Don't cancel delete if we failed to set delete

Following up on commit 177176f75c6fa3f624d6d964b9d340ce39511565, if we
failed to setDeleteDisposition(true) during TempFile creation, then
don't try to setDeleteDisposition(false) during TempFile::keep, since it
will likely fail as well.

Instead of letting TempFile::keep just fail, we should let it go ahead
and try renaming the file.

This fixes an issue we are seeing when running clang-cl.exe through the
Incredibuild distributed build system.  We're seeing that renaming
temporary object files would fail here:
https://github.com/llvm/llvm-project/blob/5c1f7b296ac0dddeca02891976e6ab5cfc006719/clang/lib/Frontend/CompilerInstance.cpp#L789

Reviewed By: mstorsjo

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

2 years agoRevert "[mlir][bufferize] Insert memref.cast ops during finalizing pass"
Matthias Springer [Thu, 27 Jan 2022 11:45:06 +0000 (20:45 +0900)]
Revert "[mlir][bufferize] Insert memref.cast ops during finalizing pass"

This reverts commit 1043107ce5e2dee38f6a9bf459549a75f78a83b2.

This commit caused a breakage in `finalizing-bufferize.mlir`.

2 years ago[AArch64][SVE] Avoid using ptrue for ptest in VECREDUCE_OR.
Sander de Smalen [Thu, 27 Jan 2022 11:01:56 +0000 (11:01 +0000)]
[AArch64][SVE] Avoid using ptrue for ptest in VECREDUCE_OR.

Reviewed By: david-arm

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

2 years ago[IR] Handle opaque pointers in PtrToArgument mangling
Nikita Popov [Thu, 27 Jan 2022 11:36:25 +0000 (12:36 +0100)]
[IR] Handle opaque pointers in PtrToArgument mangling

It appears that this mangling type is currently unused. Make it
compatible with opaque pointers in case it becomes used again...

2 years ago[InstCombine] Avoid pointer element type access in PointerReplacer
Nikita Popov [Thu, 27 Jan 2022 11:26:32 +0000 (12:26 +0100)]
[InstCombine] Avoid pointer element type access in PointerReplacer

This code replaces the address space of the pointers while keeping
the element type. Use the appropriate helpers to make this work
with opaque pointers.

2 years ago[OpenCL] Add support of __opencl_c_device_enqueue feature macro.
Anton Zabaznov [Mon, 13 Dec 2021 15:43:37 +0000 (18:43 +0300)]
[OpenCL] Add support of __opencl_c_device_enqueue feature macro.

This feature requires support of __opencl_c_generic_address_space and
__opencl_c_program_scope_global_variables so diagnostics for that is provided as well.

Reviewed By: Anastasia

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

2 years ago[libcxx] [test] Narrow down a MinGW bug workaround in rand.dist.uni.int/eval.pass.cpp
Martin Storsjö [Thu, 20 Jan 2022 22:33:56 +0000 (22:33 +0000)]
[libcxx] [test] Narrow down a MinGW bug workaround in rand.dist.uni.int/eval.pass.cpp

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

2 years ago[AArch64][SVE] Implement missing lowering for extract_subvector for predicates.
Sander de Smalen [Thu, 27 Jan 2022 10:31:10 +0000 (10:31 +0000)]
[AArch64][SVE] Implement missing lowering for extract_subvector for predicates.

Reviewed By: efriedma

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

2 years ago[DAG] SelectionDAG::getNode(N1,N2) - detect N2 constant vector splats as well as...
Simon Pilgrim [Thu, 27 Jan 2022 10:59:03 +0000 (10:59 +0000)]
[DAG] SelectionDAG::getNode(N1,N2) - detect N2 constant vector splats as well as scalars

We already perform some basic folds (add/sub with zero etc.) on scalar types, this patch adds some basic support for constant splats as well in a few cases (we can add more with future test coverage).

In the cases I've enabled, we can handle buildvector implicit truncation as we're not creating new constant nodes from the vector types - we're just returning existing nodes. This allows us to get a number of extra cases in the aarch64 tests.

I haven't enabled support for undefs in buildvector splats, as we're often checking for zero/allones patterns that return the original constant and we shouldn't be returning undef elements in some of these cases - we can enable this later if we're OK with creating new constants.

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

2 years ago[AMDGPU] Update MachineMemOperands syntax in commented out tests
Jay Foad [Thu, 27 Jan 2022 10:56:35 +0000 (10:56 +0000)]
[AMDGPU] Update MachineMemOperands syntax in commented out tests

2 years ago[AMDGPU] Remove unused CI check lines
Jay Foad [Thu, 27 Jan 2022 10:52:59 +0000 (10:52 +0000)]
[AMDGPU] Remove unused CI check lines

2 years ago[ConstantFold] Disable gep of array bitcast fold with opaque pointers
Nikita Popov [Thu, 27 Jan 2022 10:50:27 +0000 (11:50 +0100)]
[ConstantFold] Disable gep of array bitcast fold with opaque pointers

Once again, this fold is meaningless with opaque pointers, as there
is no pointer element type to canonicalize. At some point, we may
want to do GEP type canonicalizations.

2 years ago[mlir][linalg][bufferize] Support arith.index_cast bufferization
Matthias Springer [Thu, 27 Jan 2022 10:37:58 +0000 (19:37 +0900)]
[mlir][linalg][bufferize] Support arith.index_cast bufferization

This is in preparation of switching `-tensor-constant-bufferize` and `-arith-bufferize` to BufferizableOpInterface-based implementations.

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

2 years ago[AMDGPU] Remove unused GFX6 check lines
Jay Foad [Thu, 27 Jan 2022 10:48:15 +0000 (10:48 +0000)]
[AMDGPU] Remove unused GFX6 check lines

2 years ago[InstCombine] Mark element type access as non-opaque (NFC)
Nikita Popov [Thu, 27 Jan 2022 10:39:34 +0000 (11:39 +0100)]
[InstCombine] Mark element type access as non-opaque (NFC)

Also make the function static to make it more obvious that it is
only used in the one place.

2 years ago[OpenCL] opencl-c.h: add missing read_write image guards
Sven van Haastregt [Thu, 27 Jan 2022 10:33:12 +0000 (10:33 +0000)]
[OpenCL] opencl-c.h: add missing read_write image guards

The get_image_num_mip_levels overloads that take a read_write image
parameter were missing the __opencl_c_read_write_images guard.

2 years ago[mlir][tensor] Replace tensor-bufferize with BufferizableOpInterface impl
Matthias Springer [Thu, 27 Jan 2022 10:18:59 +0000 (19:18 +0900)]
[mlir][tensor] Replace tensor-bufferize with BufferizableOpInterface impl

This commit switches the `tensor-bufferize` pass over to BufferizableOpInterface-based bufferization.

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

2 years ago[AArch64][SVE] Implement PFALSE with explicit AArch64ISD node.
Sander de Smalen [Thu, 27 Jan 2022 09:17:29 +0000 (09:17 +0000)]
[AArch64][SVE] Implement PFALSE with explicit AArch64ISD node.

The ISel patterns for PFALSE helps recognise the instructions as being
free of side-effects, which helps MachineCSE remove redundant
PFALSE instructions.

Reviewed By: dmgreen

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

2 years ago[CMake][Fuchsia] Only build iossim runtimes for arm64
Petr Hosek [Thu, 27 Jan 2022 10:27:18 +0000 (02:27 -0800)]
[CMake][Fuchsia] Only build iossim runtimes for arm64

x86_64 isn't supported with the recent Xcode SDK.

2 years ago[AMDGPU] SILoadStoreOptimizer: Remove redundant check for volatile
Jay Foad [Wed, 26 Jan 2022 16:50:08 +0000 (16:50 +0000)]
[AMDGPU] SILoadStoreOptimizer: Remove redundant check for volatile

SILoadStoreOptimizer::collectMergeableInsts already ends the current
block if it sees a volatile (or ordered) memory access, so there is no
need to check for them again when scanning the instructions between two
pairing candidates in a block.

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

2 years ago[mlir][bufferize] Insert memref.cast ops during finalizing pass
Matthias Springer [Thu, 27 Jan 2022 10:04:44 +0000 (19:04 +0900)]
[mlir][bufferize] Insert memref.cast ops during finalizing pass

The pass can currently not handle to_memref(to_tensor(x)) folding where a cast is necessary. This is required with the new unified bufferization. There is already a canonicalization pattern that handles such foldings and it should be used during this pass.

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

2 years ago[NFC][CodeGen] Use llvm::DenseMap for DeferredDecls
Dawid Jurczak [Tue, 25 Jan 2022 15:53:05 +0000 (16:53 +0100)]
[NFC][CodeGen] Use llvm::DenseMap for DeferredDecls

CodeGenModule::DeferredDecls std::map::operator[] seem to be hot especially while code generating huge compilation units.
In such cases using DenseMap instead gives observable compile time improvement. Patch was tested on Linux build with default config acting as benchmark.
Build was performed on isolated CPU cores in silent x86-64 Linux environment following: https://llvm.org/docs/Benchmarking.html#linux rules.
Compile time statistics diff produced by perf and time before and after change are following:
instructions -0.15%, cycles -0.7%, max-rss +0.65%.
Using StringMap instead DenseMap doesn't bring any visible gains.

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

2 years ago[LoopVersioning] Use IRBuilder for OR simplification.
Florian Hahn [Thu, 27 Jan 2022 09:55:38 +0000 (09:55 +0000)]
[LoopVersioning] Use IRBuilder for OR simplification.

2 years ago[LLDB] Add formatters for PointerIntPair, PointerUnion
Sergej Jaskiewicz [Thu, 20 Jan 2022 13:36:41 +0000 (16:36 +0300)]
[LLDB] Add formatters for PointerIntPair, PointerUnion

Also, add summaries for `SmallVector` and `ArrayRef`,
and fix the `StringRef` summary provider so it doesn't
ignore the `Length` field.

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

2 years ago[InstCombine] Skip GEP of bitcast transform with opaque pointers
Nikita Popov [Thu, 27 Jan 2022 09:51:45 +0000 (10:51 +0100)]
[InstCombine] Skip GEP of bitcast transform with opaque pointers

This transform is fundamentally incompatible with opaque pointers.
Usually we would not hit it anyway because the bitcast is folded
away earlier, but due to worklist order it might survive until
here, so make sure we bail out explicitly.

2 years ago[InstCombine] Extract GEP of bitcast folds into separate function (NFC)
Nikita Popov [Thu, 27 Jan 2022 09:47:29 +0000 (10:47 +0100)]
[InstCombine] Extract GEP of bitcast folds into separate function (NFC)

2 years ago[RISCV] Fix test case expected output
Fraser Cormack [Thu, 27 Jan 2022 09:26:20 +0000 (09:26 +0000)]
[RISCV] Fix test case expected output

I didn't correctly update this before landing D118058.

2 years ago[BTFDebug] Avoid pointer element type access
Nikita Popov [Thu, 27 Jan 2022 09:30:21 +0000 (10:30 +0100)]
[BTFDebug] Avoid pointer element type access

Use the global value type instead.

2 years ago[InstCombine] Skip PromoteCastOfAllocation() transform under opaque pointers
Nikita Popov [Thu, 27 Jan 2022 09:24:15 +0000 (10:24 +0100)]
[InstCombine] Skip PromoteCastOfAllocation() transform under opaque pointers

I think this can't be hit anyway (because a ptr-to-ptr bitcast would
get folded earlier), but in the interest of being explicit skip
this transform for opaque pointers entirely.

2 years ago[lldb/test] Fix gnu-style-compression.yaml
Pavel Labath [Thu, 27 Jan 2022 09:16:56 +0000 (10:16 +0100)]
[lldb/test] Fix gnu-style-compression.yaml

In the rush to get the bot green, I did not realize I was building the
file with -gsplit-dwarf, and therefore the yaml ended up referring to a
file I did not check it.

This rebuilds the file without split dwarf.

2 years ago[InstCombine] Remove some pointer element type accesses
Nikita Popov [Thu, 27 Jan 2022 09:14:44 +0000 (10:14 +0100)]
[InstCombine] Remove some pointer element type accesses

One of these is guarded against opaque pointers, and the others
were accessing the call function type in a rather convoluted way.

2 years ago[SelectionDAG][VP] Provide expansion for VP_MERGE
Fraser Cormack [Mon, 24 Jan 2022 18:11:14 +0000 (18:11 +0000)]
[SelectionDAG][VP] Provide expansion for VP_MERGE

This patch adds support for expanding VP_MERGE through a sequence of
vector operations producing a full-length mask setting up the elements
past EVL/pivot to be false, combining this with the original mask, and
culminating in a full-length vector select.

This expansion should work for any data type, though the only use for
RVV is for boolean vectors, which themselves rely on an expansion for
the VSELECT.

Reviewed By: craig.topper

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

2 years ago[lldb] Convert ProcessWindowsLog to the new API
Pavel Labath [Thu, 27 Jan 2022 07:47:52 +0000 (08:47 +0100)]
[lldb] Convert ProcessWindowsLog to the new API

2 years ago[lldb/DWARF] Make manual dwarf index deterministic
Pavel Labath [Wed, 26 Jan 2022 15:29:51 +0000 (16:29 +0100)]
[lldb/DWARF] Make manual dwarf index deterministic

Currently, running the test suite with LLVM_ENABLE_EXPENSIVE_CHECKS=On
causes a couple of tests to fail. This happens because they expect a
certain order of variables (all of them happen to use the "target
variable" command, but other lookup functions should suffer from the
same issues), all of which have the same name. Sort algorithms often
preserve the order of equivalent elements (in this case the entries in
the NameToDIE map), but that not guaranteed, and
LLVM_ENABLE_EXPENSIVE_CHECKS stresses that by pre-shuffling all inputs
before sorting.

While this could easily be fixed by relaxing the test expectations,
having a deterministic output seems like a worthwhile goal,
particularly, as this could have bigger consequences than just a
different print order -- in some cases we just pick the first entry that
we find, whatever that is. Therefore this patch makes the sort
deterministic by introducing another sort key -- UniqueCString::Sort
gets a value comparator functor, which can be used to sort elements with
the same name -- in the DWARF case we use DIERef::operator<, which
roughly equals the order in which the entries appear in the debug info,
and matches the current "accidental" order.

Using a extra functor seemed preferable to using stable_sort, as the
latter allocates extra O(n) of temporary memory.

I observed no difference in debug info parsing speed with this patch
applied.

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

2 years ago[lldb/test] Replace gnu-style-compression.cpp with a yaml file
Pavel Labath [Thu, 27 Jan 2022 09:01:59 +0000 (10:01 +0100)]
[lldb/test] Replace gnu-style-compression.cpp with a yaml file

In D117744, llvm removed writing support for this format, breaking the
test. We may eventually want to remove reading support as well, but for
now I have converted the test to a yaml file to maintain coverage.

2 years ago[clang-format] Format ParseOpenMP.cpp changes
Saiyedul Islam [Thu, 27 Jan 2022 08:55:08 +0000 (08:55 +0000)]
[clang-format] Format ParseOpenMP.cpp changes

Properly format D116549.

2 years ago[mlir][Bazel] Add TestMemRef target.
Adrian Kuegel [Thu, 27 Jan 2022 08:44:06 +0000 (09:44 +0100)]
[mlir][Bazel] Add TestMemRef target.

Needed after D118285

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

2 years ago[MC] Add MCAsmParser::parseRParen to improve consistency and simplify code
Fangrui Song [Thu, 27 Jan 2022 08:37:49 +0000 (00:37 -0800)]
[MC] Add MCAsmParser::parseRParen to improve consistency and simplify code

Some diagnostics are more verbose but they don't seem to be more useful than
simple `expected ')'`

2 years ago[mlir][Bazel] Add missing dependency to ArithmeticTransforms.
Adrian Kuegel [Thu, 27 Jan 2022 08:31:55 +0000 (09:31 +0100)]
[mlir][Bazel] Add missing dependency to ArithmeticTransforms.

2 years agoAdd missing namespace to PPCLinux.cpp
Mike Hommey [Thu, 27 Jan 2022 08:26:16 +0000 (09:26 +0100)]
Add missing namespace to PPCLinux.cpp

This fixes a build failure with MSVC introduced in
https://reviews.llvm.org/D112906

Reviewed By: nemanjai

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

2 years ago[MC] Remove unreachable .comm/.lcomm diagnostic
Fangrui Song [Thu, 27 Jan 2022 08:10:57 +0000 (00:10 -0800)]
[MC] Remove unreachable .comm/.lcomm diagnostic

and make another diagnostic math the prevailing format.

2 years ago[RISCV] fix dead code
Wu Xinlong [Thu, 27 Jan 2022 07:48:25 +0000 (15:48 +0800)]
[RISCV] fix dead code

fix dead code mentioned on https://reviews.llvm.org/D98136

Reviewed By: craig.topper

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

2 years ago[mlir] Don't emit unused labels
Marius Brehler [Tue, 25 Jan 2022 16:13:30 +0000 (16:13 +0000)]
[mlir] Don't emit unused labels

Stop the Cpp target from emitting unused labels. The previosly generated
code generated warning if `-Wunused-label` is passed to a compiler.

Co-authored-by: Simon Camphausen <simon.camphausen@iml.fraunhofer.de>
Reviewed By: jpienaar

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

2 years ago[CSKY] Add floating operation support including float and double
Zi Xuan Wu [Thu, 27 Jan 2022 06:49:43 +0000 (14:49 +0800)]
[CSKY] Add floating operation support including float and double

CSKY arch has multiple FPU instruction versions such as FPU, FPUv2 and FPUv3 to implement floating operations.
For now, we just only support FPUv2 and FPUv3.

It includes the encoding, asm parsing of instructions and codegen of DAG nodes.

2 years ago[RISCV][CodeGen] Implement IR Intrinsic support for K extension
Wu Xinlong [Thu, 27 Jan 2022 03:59:13 +0000 (11:59 +0800)]
[RISCV][CodeGen] Implement IR Intrinsic support for K extension

This revision implements IR Intrinsic support for RISCV Scalar Crypto extension according to the specification of version [[ https://github.com/riscv/riscv-crypto/releases/tag/v1.0.0-scalar | 1.0]]
Co-author:@ksyx & @VincentWu & @lihongliang & @achieveartificialintelligence

Reviewed By: craig.topper

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

2 years ago[ELF] Parallelize computeIsPreemptible
Fangrui Song [Thu, 27 Jan 2022 07:45:03 +0000 (23:45 -0800)]
[ELF] Parallelize computeIsPreemptible

2 years ago[MLIR] NFC. Rename pass cmd-line to prefix affine
Uday Bondhugula [Thu, 27 Jan 2022 02:36:26 +0000 (08:06 +0530)]
[MLIR] NFC. Rename pass cmd-line to prefix affine

Prefix "affine-" to affine transform passes that were missing it -- to
avoid ambiguity and for uniformity. There were only two needed this.

Move mispaced affine coalescing test case file.

NFC.

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

2 years ago[MLIR] Fix integration tests broken by D118285
Uday Bondhugula [Thu, 27 Jan 2022 07:30:19 +0000 (13:00 +0530)]
[MLIR] Fix integration tests broken by D118285

[MLIR] Fix integration tests broken by D118285.

2 years agoAdd email addresses to create a topic via email in a specific category.
Tanya Lattner [Thu, 27 Jan 2022 07:22:04 +0000 (23:22 -0800)]
Add email addresses to create a topic via email in a specific category.

2 years ago[mlir] Finish replacing OwningRewritePatternList with RewritePatternSet
River Riddle [Wed, 26 Jan 2022 22:42:38 +0000 (14:42 -0800)]
[mlir] Finish replacing OwningRewritePatternList with RewritePatternSet

OwningRewritePatternList has been deprecated for ~10 months now, we can remove
the leftover using directives at this point.

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

2 years ago[mlir] Move ComposeSubView+ExpandOps from Standard to MemRef
River Riddle [Wed, 26 Jan 2022 22:18:21 +0000 (14:18 -0800)]
[mlir] Move ComposeSubView+ExpandOps from Standard to MemRef

These transformations already operate on memref operations (as part of
splitting up the standard dialect). Now that the operations have moved,
it's time for these transformations to move as well.

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

2 years ago[ELF] Optimize two vector. NFC
Fangrui Song [Thu, 27 Jan 2022 07:10:40 +0000 (23:10 -0800)]
[ELF] Optimize two vector. NFC

2 years ago[ELF] Optimize -Map. NFC
Fangrui Song [Thu, 27 Jan 2022 06:51:31 +0000 (22:51 -0800)]
[ELF] Optimize -Map. NFC

getVA is slow. Avoid calling it in the llvm::sort comparator.

2 years ago[ELF] Simplify InputSection::writeTo. NFC
Fangrui Song [Thu, 27 Jan 2022 06:03:26 +0000 (22:03 -0800)]
[ELF] Simplify InputSection::writeTo. NFC

2 years ago[NFC] Remove duplicate include
Jim Lin [Thu, 27 Jan 2022 01:52:45 +0000 (09:52 +0800)]
[NFC] Remove duplicate include

2 years ago[mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h
River Riddle [Wed, 26 Jan 2022 23:49:53 +0000 (15:49 -0800)]
[mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h

These are used pervasively during parsing.

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

2 years ago[mlir][NFC] Add a using for llvm::BitVector to LLVM.h
River Riddle [Wed, 26 Jan 2022 23:30:56 +0000 (15:30 -0800)]
[mlir][NFC] Add a using for llvm::BitVector to LLVM.h

BitVector is becoming widespread enough that we should add a proper using.

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

2 years ago[mlir:Function][NFC] Use BitVector instead of ArrayRef for indices when removing...
River Riddle [Mon, 24 Jan 2022 23:18:04 +0000 (15:18 -0800)]
[mlir:Function][NFC] Use BitVector instead of ArrayRef for indices when removing arguments/results

We already convert to BitVector internally, and other APIs (namely Operation::eraseOperands)
already use BitVector as well. Switching over provides a common format between
API and also reduces the amount of format conversions necessary.

Fixes #53325

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

2 years ago[mlir:PassOptions] Fix parsing of nested option values/better handle escaping
River Riddle [Mon, 24 Jan 2022 22:30:03 +0000 (14:30 -0800)]
[mlir:PassOptions] Fix parsing of nested option values/better handle escaping

The option parser currently does not properly handle nested options, meaning that
in some cases we can print pass pipelines that we can't actually parse back in. For example,
from #52885 we currently can't parse in inliner pipelines that have nested pipeline strings.

This commit adds handling for string values (e.g. "...") and nested options
(e.g. `foo{baz{bar=10 pizza=11}}`).

Fixes #52885

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

2 years ago[IVDescriptor] Get the exact FP instruction that does not allow reordering
Congzhe Cao [Thu, 27 Jan 2022 05:24:12 +0000 (00:24 -0500)]
[IVDescriptor] Get the exact FP instruction that does not allow reordering

This is a bugfix in IVDescriptor.cpp.

The helper function `RecurrenceDescriptor::getExactFPMathInst()`
is supposed to return the 1st FP instruction that does not allow
reordering. However, when constructing the RecurrenceDescriptor,
we trace the use-def chain staring from a PHI node and for each
instruction in the use-def chain, its descriptor overrides the
previous one. Therefore in the final RecurrenceDescriptor we
constructed, we lose previous FP instructions that does not allow
reordering.

Reviewed By: kmclaughlin

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

2 years ago[Test] Add test for or-reduce idiom symmetrical to and-reduce
Max Kazantsev [Thu, 27 Jan 2022 05:26:19 +0000 (12:26 +0700)]
[Test] Add test for or-reduce idiom symmetrical to and-reduce

2 years ago[Test] Add one more add-reduce test w/ pointer bitcasts
Max Kazantsev [Thu, 27 Jan 2022 05:13:07 +0000 (12:13 +0700)]
[Test] Add one more add-reduce test w/ pointer bitcasts

2 years ago[clang-tidy] Fix nested namespaces in `readability-static-definition-in-anonymous...
Evgeny Shulgin [Thu, 27 Jan 2022 00:55:14 +0000 (17:55 -0700)]
[clang-tidy] Fix nested namespaces in `readability-static-definition-in-anonymous-namespace` check

The check previously inspected only the immediate parent namespace.
`static` in a named namespace within an unnamed namespace is still
redundant.
We will use `Decl::isInAnonymousNamespace()` method that traverses the
namespaces hierarchy recursively.

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

2 years ago[ObjC] Emit selector load right before msgSend call.
Ahmed Bougacha [Thu, 27 Jan 2022 01:31:26 +0000 (17:31 -0800)]
[ObjC] Emit selector load right before msgSend call.

We currently emit the selector load early, but only because we need
it to compute the signature (so that we know which msgSend variant to
call).  We can prepare the signature with a plain undef, and replace
it with the materialized selector value if (and only if) needed, later.

Concretely, this usually doesn't have an effect, but tests need updating
because we reordered the receiver bitcast and the selector load, which
is always fine.

There is one notable change: with this, when a msgSend needs a
receiver null check, the selector is now loaded in the non-null
block, instead of before the null check.  That should be a mild
improvement.

2 years ago[libc++] Fix LWG3390: move_iterator now handles move-only iterators.
Arthur O'Dwyer [Fri, 14 Jan 2022 16:25:56 +0000 (11:25 -0500)]
[libc++] Fix LWG3390: move_iterator now handles move-only iterators.

This can't really be tested until C++20 move_iterator is completely implemented.

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

2 years ago[PowerPC] Add the Power10 XS[MAX|MIN]CQP instruction
Ting Wang [Thu, 27 Jan 2022 04:00:43 +0000 (23:00 -0500)]
[PowerPC] Add the Power10 XS[MAX|MIN]CQP instruction

Add the Power 10 instruction XS[MAX|MIN]CQP.

Reviewed By: shchenz, amyk

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

2 years ago[CMake][Fuchsia] Drop 32-bit ios runtimes
Petr Hosek [Thu, 27 Jan 2022 02:48:20 +0000 (18:48 -0800)]
[CMake][Fuchsia] Drop 32-bit ios runtimes

These are no longer supported in the recent Xcode SDK versions.

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

2 years ago[RISCV] Use vnsrl.wx with x0 instead of vnsrl.vi for truncate.
Craig Topper [Thu, 27 Jan 2022 02:20:04 +0000 (18:20 -0800)]
[RISCV] Use vnsrl.wx with x0 instead of vnsrl.vi for truncate.

This matches what the spec uses for the vncvt.x.x.w assembly
pseudoinstruction.

Reviewed By: kito-cheng

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

2 years ago[RISCV] Remove unused flags from FeatureKind in TargetParser.h. NFC
Craig Topper [Thu, 27 Jan 2022 02:19:52 +0000 (18:19 -0800)]
[RISCV] Remove unused flags from FeatureKind in TargetParser.h. NFC

These flags aren't used and we shouldn't add more flags for new
ratified extensions. So clear out the unused flags to avoid any
confusion.

Reviewed By: khchen

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

2 years ago[gn build] Format gn files
Arthur Eubanks [Thu, 27 Jan 2022 02:37:03 +0000 (18:37 -0800)]
[gn build] Format gn files

2 years ago[gn build] Move -fno-builtin to crt_code
Arthur Eubanks [Wed, 26 Jan 2022 22:54:11 +0000 (14:54 -0800)]
[gn build] Move -fno-builtin to crt_code

crt_code seems to correspond to SANITIZER_COMMON_CFLAGS which contains -fno-builtin.

Reviewed By: thakis

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

2 years ago[NFC] [AST] Move isSameEntity into ASTContext
Chuanqi Xu [Thu, 27 Jan 2022 02:26:40 +0000 (10:26 +0800)]
[NFC] [AST] Move isSameEntity into ASTContext

Currently we are trying to implement the semantics of C++ Modules. A big
challenge would be the ODR checking. Previously we did this in
ASTReader, it would handle the cases like:
```
module;
export module a_module;
import another_module; //  check the ODR consistency here
```
or
```
export module m;
import a_module;
import another_module; // check the ODR consistency here
```

However, it wouldn't handle the case:
```
import another_module; // When we check ODR here, everything looks fine.
```

In the case, the read process is ended. But we need to check the ODR
still. To reuse the facility we do in ASTReader, this patch moves the
corresponding codes into ASTContext. This should be good since there
were facilities like `hasSameTemplateName` and `hasSameType`.

Although the patch is a little bit big, all of the change should be
trivial.

Reviewed By: erichkeane

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

2 years ago[asan] Add missing #include of sanitizer_platform.h
Roland McGrath [Thu, 27 Jan 2022 00:39:36 +0000 (16:39 -0800)]
[asan] Add missing #include of sanitizer_platform.h

The "asan/asan_mapping.h" header relies on sanitizer_platform.h
macros, but doesn't directly include the header.  All the existing
uses until recently happened to be in places where some other header
had indirectly included sanitizer_platform.h first.  The addition of
asan_rtl_x86_64.S was the first place to use "asan/asan_mapping.h"
alone.  It so happens that its uses of the macros make having no
macros defined equivalent to SANITIZER_LINUX, so this did not affect
Linux builds.  But the assembly constants in asan_rtl_x86_64.S were
wrong for Fuchsia when SANITIZER_FUCHSIA was not properly defined.

Reviewed By: vitalybuka

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

2 years agoDefault to DWARFv4 on Windows
David Blaikie [Thu, 27 Jan 2022 02:00:43 +0000 (18:00 -0800)]
Default to DWARFv4 on Windows

2 years ago[clang] Use proper type to left shift after D117262
Arthur Eubanks [Thu, 27 Jan 2022 01:54:37 +0000 (17:54 -0800)]
[clang] Use proper type to left shift after D117262

Causing warnings like
warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits
as reported in D117262.

2 years ago[BOLT][TEST] Adjust tests for BOLT_CLANG_EXE=clang-{6..9}
Amir Ayupov [Thu, 27 Jan 2022 01:08:13 +0000 (17:08 -0800)]
[BOLT][TEST] Adjust tests for BOLT_CLANG_EXE=clang-{6..9}

Fix tests to pass with clang-6..9 on Ubuntu 20.04.

Reviewed By: yota9

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

2 years ago[mlir][amx] add a full tile matrix mult integral example to integration tests
Aart Bik [Thu, 27 Jan 2022 00:05:31 +0000 (16:05 -0800)]
[mlir][amx] add a full tile matrix mult integral example to integration tests

Reviewed By: dcaballe

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