platform/upstream/llvm.git
3 years ago[AArch64] Add a few more vector extension tests.
Florian Hahn [Mon, 29 Mar 2021 17:19:24 +0000 (18:19 +0100)]
[AArch64] Add a few more vector extension tests.

3 years ago[lldb][NFC] Fix -Wdocumentation issue in ModuleSpec.h/ThreadTrace.h
Raphael Isemann [Mon, 29 Mar 2021 17:47:17 +0000 (19:47 +0200)]
[lldb][NFC] Fix -Wdocumentation issue in ModuleSpec.h/ThreadTrace.h

3 years ago[lldb][NFC] Fix -Wdocumentation issue in ProcessMinidump
Raphael Isemann [Mon, 29 Mar 2021 17:40:41 +0000 (19:40 +0200)]
[lldb][NFC] Fix -Wdocumentation issue in ProcessMinidump

3 years ago[PrologEpilogInserter][AMDGPU] Only adjust offset for emergency spill slots if the...
Roger Ferrer Ibanez [Mon, 29 Mar 2021 13:30:48 +0000 (13:30 +0000)]
[PrologEpilogInserter][AMDGPU] Only adjust offset for emergency spill slots if the stack grows down

D89239 adjusts the stack offset of emergency spill slots for overaligned
stacks. However the adjustment is not valid for targets whose stack
grows up (such as AMDGPU).

This change makes the adjustment conditional only to those targets whose
stack grows down.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49686

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

3 years ago[RISCV] When custom iseling masked loads/stores, copy the mask into V0 instead of...
Craig Topper [Mon, 29 Mar 2021 17:11:18 +0000 (10:11 -0700)]
[RISCV] When custom iseling masked loads/stores, copy the mask into V0 instead of virtual register.

This matches what we do in our isel patterns. In our internal
testing we've found this is needed to make the fast register
allocator happy at -O0. Otherwise it may assign V0 to an earlier
operand and find itself with no registers left when it reaches
the mask operand. By using V0 explicitly, the fast register allocator
will see it when it checks for phys register usages before it
starts allocating vregs. I'll try to update this with a test case.

Unfortunately, this does appear to prevent some instruction reordering
by the pre-RA scheduler which leads to the increased spills seen in
some tests. I suspect that problem could already occur for other
instructions that already used V0 directly.

There's a lot of repeated code here that could do with some
wrapper functions. Not sure if that should be at the level of the
new code that deals with V0. That would require multiple output
parameters to pass the glue, chain and register back. Maybe it
should be at a higher level over the entire set of push_backs.

Reviewed By: frasercrmck, HsiangKai

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

3 years ago[flang] Fix CHECK() calls on erroneous procedure declarations
Peter Steinfeld [Thu, 25 Mar 2021 15:04:19 +0000 (08:04 -0700)]
[flang] Fix CHECK() calls on erroneous procedure declarations

When writing tests for a previous problem, I ran across situations where the
compiler was failing calls to CHECK().  In these situations, the compiler had
inconsistent semantic information because the programs were erroneous.  This
inconsistent information was causing the calls to CHECK().

I fixed this by avoiding the code that ended up making the failed calls to
CHECK() and making sure that we were only avoiding these situations when the
associated symbols were erroneous.

I also added tests that would cause the calls to CHECK() without these changes.

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

3 years ago[X86] Always use rip-relative addressing on 64-bit when rematerializing all zeros...
Craig Topper [Mon, 29 Mar 2021 16:54:26 +0000 (09:54 -0700)]
[X86] Always use rip-relative addressing on 64-bit when rematerializing all zeros/ones registers using a folded load.

Previously we only used RIP relative when PIC was enabled. But
we know we're in small/kernel code model here so we should
be able to always use RIP-relative which will give a smaller
encoding.

Here's a godbolt link that demonstrates the current codegen https://godbolt.org/z/j3158o
Note in the non-PIC version the load from .LCPI0_0 doesn't use
RIP-relative addressing, but if you change the constant in the
source from 0.0 to 1.0 it will become RIP-relative.

Reviewed By: RKSimon

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

3 years ago[RISCV] Fix offset computation for RVV
Roger Ferrer Ibanez [Thu, 18 Mar 2021 10:26:33 +0000 (10:26 +0000)]
[RISCV] Fix offset computation for RVV

In D97111 we changed the RVV frame layout when using sp or bp to address
the stack slots so we could address the emergency stack slot. The idea
is to put the RVV objects as far as possible (in offset terms) from the
frame reference register (sp / fp / bp).

When using fp this happens naturally because the RVV objects are already
the top of the stack and due to the constraints of RVV (VLENB being a
power of two >= 128) the stack remains aligned. The rest of this summary
does not apply to this case.

When using sp / bp we need to skip the non-RVV stack slots. The size of
the the non-RVV objects is computed subtracting the callee saved
register size (whose computation is added in D97111 itself) to the total
size of the stack (which does not account for RVV stack slots). However,
when doing so we round to 16 bytes when computing that size and we end
emitting a smaller offset that may belong to a scalar stack slot (see
D98801). So this change removes that rounding.

Also, because we want the RVV objects be between the non-RVV stack slots
and the callee-saved register slots, we need to make sure the RVV
objects are properly aligned to 8 bytes. Adding a padding of 8 would
render the stack unaligned. So when allocating space for RVV (only when
we don't use fp) we need to have extra padding that preserves the stack
alignment. This way we can round to 8 bytes the offset that skips the
non-RVV objects and we do not misalign the whole stack in the way. In
some circumstances this means that the RVV objects may have padding
before (=lower offsets from sp/bp) and after (before the CSR stack
slots).

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

3 years ago[NFC][RISCV] Add test showing wrong stack slot for GPR and RVV spilled registers
Roger Ferrer Ibanez [Thu, 18 Mar 2021 10:37:18 +0000 (10:37 +0000)]
[NFC][RISCV] Add test showing wrong stack slot for GPR and RVV spilled registers

This testcase shows that we attempt to assign the same offset sp + 16 to
two different stack objects.

The fix will come in a later change.

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

3 years ago[NFC][RISCV] Pass file through update_llc_tests to fix whitespace issues
Roger Ferrer Ibanez [Wed, 17 Mar 2021 18:24:58 +0000 (18:24 +0000)]
[NFC][RISCV] Pass file through update_llc_tests to fix whitespace issues

While addressing RVV frame layout issues I found this file had
whitespace differences that made diffs noisier than they should be.

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

3 years ago[CSSPGO][llvm-profgen] Context-sensitive global pre-inliner
Wenlei He [Fri, 5 Mar 2021 15:50:36 +0000 (07:50 -0800)]
[CSSPGO][llvm-profgen] Context-sensitive global pre-inliner

This change sets up a framework in llvm-profgen to estimate inline decision and adjust context-sensitive profile based on that. We call it a global pre-inliner in llvm-profgen.

It will serve two purposes:
  1) Since context profile for not inlined context will be merged into base profile, if we estimate a context will not be inlined, we can merge the context profile in the output to save profile size.
  2) For thinLTO, when a context involving functions from different modules is not inined, we can't merge functions profiles across modules, leading to suboptimal post-inline count quality. By estimating some inline decisions, we would be able to adjust/merge context profiles beforehand as a mitigation.

Compiler inline heuristic uses inline cost which is not available in llvm-profgen. But since inline cost is closely related to size, we could get an estimate through function size from debug info. Because the size we have in llvm-profgen is the final size, it could also be more accurate than the inline cost estimation in the compiler.

This change only has the framework, with a few TODOs left for follow up patches for a complete implementation:
  1) We need to retrieve size for funciton//inlinee from debug info for inlining estimation. Currently we use number of samples in a profile as place holder for size estimation.
  2) Currently the thresholds are using the values used by sample loader inliner. But they need to be tuned since the size here is fully optimized machine code size, instead of inline cost based on not yet fully optimized IR.

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

3 years ago[Clang] Fix line numbers in CHECK lines.
Florian Hahn [Mon, 29 Mar 2021 16:37:48 +0000 (17:37 +0100)]
[Clang] Fix line numbers in CHECK lines.

3 years ago[SampleFDO] Do not scale the magic number NOMORE_ICP_MAGICNUM in value profile
Wei Mi [Thu, 25 Mar 2021 23:59:10 +0000 (16:59 -0700)]
[SampleFDO] Do not scale the magic number NOMORE_ICP_MAGICNUM in value profile
during profile update.

When we inline a function and update the profile, the value profiles of the
indirect call in the inliner and inlinee will be scaled. In
https://reviews.llvm.org/D96806 and https://reviews.llvm.org/D97350, we start
using the magic number NOMORE_ICP_MAGICNUM (-1) to mark targets which have
been promoted. The magic number shouldn't be scaled during the profile update.

Although the problem has been suppressed by https://reviews.llvm.org/D98187
for SampleFDO, which stops profile update for inlining in sampleFDO, the patch
is still wanted since it will be more consistent to handle the magic number
properly in profile update.

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

3 years ago[Clang] Only run test when X86 backend is built.
Florian Hahn [Mon, 29 Mar 2021 16:27:01 +0000 (17:27 +0100)]
[Clang] Only run test when X86 backend is built.

After c773d0f97304 the remark is only emitted if the loop is profitable
to vectorize, but cannot be vectorized. Hence, it depends on
X86-specific cost-modeling.

3 years ago[lldb] Move UpdateISAToDescriptorMap into ClassInfoExtractor (NFC)
Jonas Devlieghere [Mon, 29 Mar 2021 16:14:06 +0000 (09:14 -0700)]
[lldb] Move UpdateISAToDescriptorMap into ClassInfoExtractor (NFC)

Move UpdateISAToDescriptorMap into ClassInfoExtractor so that all the
formerly public functions can be private and remain an implementation
detail of the extractor.

Differential revision: https://reviews.llvm.org/D99448

3 years ago[OpenMP] Trim error messages in CUDA plugin
Joseph Huber [Mon, 29 Mar 2021 15:00:39 +0000 (11:00 -0400)]
[OpenMP] Trim error messages in CUDA plugin

Summary:
Remove some of the error messages printed when the CUDA plugin fails. The current error messages can be confusing because they are the first error messages printed after the async stream finds an error. This means that the printed values aren't related to what caused the issue, but are simply the last asyncronous operation that succeeded on the device. Remove these as they can be misleading.

Reviewers: jdoerfert

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

3 years ago[mlir][Linalg] Rewrite SubTensors that take a slice out of a unit-extend dimension.
MaheshRavishankar [Mon, 29 Mar 2021 16:18:43 +0000 (09:18 -0700)]
[mlir][Linalg] Rewrite SubTensors that take a slice out of a unit-extend dimension.

Subtensor operations that are taking a slice out of a tensor that is
unit-extent along a dimension can be rewritten to drop that dimension.

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

3 years ago[flang] Update output format test to use GTest
Asher Mancinelli [Mon, 29 Mar 2021 15:56:43 +0000 (16:56 +0100)]
[flang] Update output format test to use GTest

Better document each test in output formatting tests. Use GTest primitives and infrastructure in same
spirit as [[ https://reviews.llvm.org/D97403 | D97403 ]]. [[ https://github.com/flang-compiler/f18/issues/995#issuecomment-790737912 | See legacy github issue linked here ]] for additional context. Reorganize long test cases to be more readable.

Reviewed By: awarzynski, klausler

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

3 years ago[mlir][Linalg] Drop spurious error message
MaheshRavishankar [Mon, 29 Mar 2021 16:16:06 +0000 (09:16 -0700)]
[mlir][Linalg] Drop spurious error message

Drop usage of `emitRemark` and use `notifyMatchFailure` instead to
avoid unnecessary spew during compilation.

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

3 years ago[libcxx] adds std::identity to <functional>
Christopher Di Bella [Thu, 18 Mar 2021 17:21:35 +0000 (17:21 +0000)]
[libcxx] adds std::identity to <functional>

Implements parts of:
    - P0898R3 Standard Library Concepts

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

3 years ago[SystemZ][z/OS] Add test of leading zero length bitfield in const/volatile struct
Fanbo Meng [Mon, 29 Mar 2021 16:06:12 +0000 (12:06 -0400)]
[SystemZ][z/OS] Add test of leading zero length bitfield in const/volatile struct

Reviewed By: abhina.sreeskantharajan

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

3 years ago[lldb] Include llvm-config.h instead of config.h
Jonas Devlieghere [Mon, 29 Mar 2021 15:55:58 +0000 (08:55 -0700)]
[lldb] Include llvm-config.h instead of config.h

This distinction doesn't matter for an in-tree build, but when building
against an installed llvm, only the former is present.

This should fix the LLDB Standalone bot:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/

3 years ago[mlir][vector] Add lowering of Transfer_read with broadcast and permutation map
thomasraoux [Wed, 24 Mar 2021 16:53:53 +0000 (09:53 -0700)]
[mlir][vector] Add lowering of Transfer_read with broadcast and permutation map

Convert transfer_read ops with permutation maps into simpler
transfer_read with minority map + vector.braodcast and vector.transpose.
And transfer_read with leading dimensions broacast into transfer_read of
lower rank.

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

3 years ago[libcxx] reworks invocable and regular_invocable tests
Christopher Di Bella [Fri, 26 Mar 2021 03:26:22 +0000 (03:26 +0000)]
[libcxx] reworks invocable and regular_invocable tests

The tests for `std::invocable` and `std::regular_invocable` were
woefully incomplete. This patch closes many of the gaps (though some
probably remain).

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

3 years agoRecommit "[LV] Move runtime pointer size check to LVP::plan()."
Florian Hahn [Mon, 29 Mar 2021 14:16:03 +0000 (15:16 +0100)]
Recommit "[LV] Move runtime pointer size check to LVP::plan()."

Re-apply 25fbe803d4db, with a small update to emit the right remark
class.

Original message:
    [LV] Move runtime pointer size check to LVP::plan().

    This removes the need for the remaining doesNotMeet check and instead
    directly checks if there are too many runtime checks for vectorization
    in the planner.

    A subsequent patch will adjust the logic used to decide whether to
    vectorize with runtime to consider their cost more accurately.

    Reviewed By: lebedev.ri

3 years ago[SelectionDAG][AArch64][SVE] Perform SETCC condition legalization in LegalizeVectorOps
Bradley Smith [Thu, 18 Mar 2021 15:52:48 +0000 (15:52 +0000)]
[SelectionDAG][AArch64][SVE] Perform SETCC condition legalization in LegalizeVectorOps

This is currently performed in SelectionDAGLegalize, here we make it also
happen in LegalizeVectorOps, allowing a target to lower the SETCC condition
codes first in LegalizeVectorOps and then lower to a custom node afterwards,
without having to duplicate all of the SETCC condition legalization in the
target specific lowering.

As a result of this, fixed length floating point SETCC nodes can now be
properly lowered for SVE.

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

3 years ago[OPENMP]Map data field with l-value reference types.
Alexey Bataev [Tue, 9 Mar 2021 13:16:02 +0000 (05:16 -0800)]
[OPENMP]Map data field with l-value reference types.

Added initial support dfor the mapping of the data members with l-value
reference types.

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

3 years ago[flang][driver] Add default intrinsic module path in f18 to make f18 behave like...
Arnamoy Bhattacharyya [Mon, 29 Mar 2021 13:47:38 +0000 (09:47 -0400)]
[flang][driver] Add default intrinsic module path in f18 to make f18 behave like flang-new (with respect to the module paths), make it possible to share more tests between the drivers and make using f18 easier (the default path means that users are no longer required to specify it)

Reviewed By: awarzynski

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

3 years ago[OPENMP]Fix PR49636: Assertion `(!Entry.getAddress() || Entry.getAddress() == Addr...
Alexey Bataev [Wed, 24 Mar 2021 20:21:43 +0000 (13:21 -0700)]
[OPENMP]Fix PR49636: Assertion `(!Entry.getAddress() || Entry.getAddress() == Addr) && "Resetting with the new address."' failed.

The original issue is caused by the fact that the variable is allocated
with incorrect type i1 instead of i8. This causes the bitcasting of the
declaration to i8 type and the bitcast expression does not match the
original variable.
To fix the problem, the UndefValue initializer and the original
variable should be emitted with type i8, not i1.

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

3 years ago[SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variabl...
Fanbo Meng [Mon, 29 Mar 2021 13:43:46 +0000 (09:43 -0400)]
[SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variables on z/OS target

On z/OS there is a hard limitation on on the maximum requestable alignment in aligned attribute for static variables. We need to truncate values greater than that.

Reviewed By: abhina.sreeskantharajan

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

3 years agoRevert "[LV] Move runtime pointer size check to LVP::plan()."
Florian Hahn [Mon, 29 Mar 2021 13:41:53 +0000 (14:41 +0100)]
Revert "[LV] Move runtime pointer size check to LVP::plan()."

This reverts commit 25fbe803d4dbcf8ff3a3a9ca161f5b9a68353ed0.

This breaks a clang test which filters for the wrong remark type.

3 years ago[SLP] allow matching integer min/max intrinsics as reduction ops
Sanjay Patel [Mon, 29 Mar 2021 12:19:01 +0000 (08:19 -0400)]
[SLP] allow matching integer min/max intrinsics as reduction ops

This is a 2nd try of:
3c8473ba534
which was reverted at:
 a26312f9d4f
because of crashing.

This version includes extra code and tests to avoid the known
crashing examples as discussed in PR49730.

Original commit message:
As noted in D98152, we need to patch SLP to avoid regressions when
we start canonicalizing to integer min/max intrinsics.
Most of the real work to make this possible was in:
7202f47508

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

3 years ago[OPENMP]Fix PR49052: Clang crashed when compiling target code with assert(0).
Alexey Bataev [Fri, 26 Mar 2021 21:25:18 +0000 (14:25 -0700)]
[OPENMP]Fix PR49052: Clang crashed when compiling target code with assert(0).

Need to insert a basic block during generation of the target region to
avoid crash for the GPU to be able always calling a cleanup action.
This cleanup action is required for the correct emission of the target
region for the GPU.

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

3 years ago[mlir][Linalg] Allow calling named ops when available and make it the default.
Nicolas Vasilache [Fri, 26 Mar 2021 08:40:07 +0000 (08:40 +0000)]
[mlir][Linalg] Allow calling named ops when available and make it the default.

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

3 years ago[libc++] Use _EnableIf and __iter_value_type consistently. NFCI.
Arthur O'Dwyer [Thu, 4 Mar 2021 04:02:20 +0000 (23:02 -0500)]
[libc++] Use _EnableIf and __iter_value_type consistently. NFCI.

Specifically, use these metafunctions consistently in areas that are
about to be affected by P1518R2's changes.

This is the NFCI part of https://reviews.llvm.org/D97742 .
The functional-change part is still waiting for P1518R2 to be
officially merged into the working draft.

3 years ago[TableGen] Add support for the 'assert' statement in class definitions.
Paul C. Anagnostopoulos [Mon, 22 Mar 2021 17:38:38 +0000 (13:38 -0400)]
[TableGen] Add support for the 'assert' statement in class definitions.

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

3 years ago[LV] Move runtime pointer size check to LVP::plan().
Florian Hahn [Mon, 29 Mar 2021 12:29:34 +0000 (13:29 +0100)]
[LV] Move runtime pointer size check to LVP::plan().

This removes the need for the remaining doesNotMeet check and instead
directly checks if there are too many runtime checks for vectorization
in the planner.

A subsequent patch will adjust the logic used to decide whether to
vectorize with runtime to consider their cost more accurately.

Reviewed By: lebedev.ri

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

3 years ago[SimpleLoopUnswitch] Fix wrong assertions in partial-unswitch.ll
Jingu Kang [Mon, 29 Mar 2021 13:02:59 +0000 (14:02 +0100)]
[SimpleLoopUnswitch] Fix wrong assertions in partial-unswitch.ll

3 years agoReapply "OpaquePtr: Turn inalloca into a type attribute"
Matt Arsenault [Mon, 29 Mar 2021 12:42:23 +0000 (08:42 -0400)]
Reapply "OpaquePtr: Turn inalloca into a type attribute"

This reverts commit 07e46367baeca96d84b03fa215b41775f69d5989.

3 years ago[LoopUnswitch] Use reference variables instead of pointer one
Jingu Kang [Mon, 29 Mar 2021 11:18:51 +0000 (12:18 +0100)]
[LoopUnswitch] Use reference variables instead of pointer one

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

3 years ago[SimpleLoopUnswitch] Add tests to check partially invariant unswitch
Jingu Kang [Mon, 29 Mar 2021 10:09:33 +0000 (11:09 +0100)]
[SimpleLoopUnswitch] Add tests to check partially invariant unswitch

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

3 years ago[MLIR][Shape] Canonicalize casted dynamic extent tensor
Frederik Gossen [Mon, 29 Mar 2021 11:44:03 +0000 (13:44 +0200)]
[MLIR][Shape] Canonicalize casted dynamic extent tensor

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

3 years agoDon't use $ as suffix for symbol names in ThinLTOBitcodeWriter and other places
Hans Wennborg [Thu, 25 Feb 2021 15:51:31 +0000 (16:51 +0100)]
Don't use $ as suffix for symbol names in ThinLTOBitcodeWriter and other places

Using $ breaks demangling of the symbols. For example,

$ c++filt _Z3foov\$123
_Z3foov$123

This causes problems for developers who would like to see nice stack traces
etc., but also for automatic crash tracking systems which try to organize
crashes based on the stack traces.

Instead, use the period as suffix separator, since Itanium demanglers normally
ignore such suffixes:

$ c++filt _Z3foov.123
foo() [clone .123]

This is already done in some places; try to do it everywhere.

Differential revision: https://reviews.llvm.org/D97484

3 years agoRevert "[mlir] Introduce CloneOp and adapt test cases in BufferDeallocation."
Alexander Belyaev [Mon, 29 Mar 2021 10:47:59 +0000 (12:47 +0200)]
Revert "[mlir] Introduce CloneOp and adapt test cases in BufferDeallocation."

This reverts commit 06b03800f3fcbf49f5ddd4145b40f04e4ba4eb42.
Until some kind of support for region args is added.

3 years ago[lldb][NFC] Add a test case for Objective-C properties with conflicting names
Raphael Isemann [Mon, 29 Mar 2021 10:28:48 +0000 (12:28 +0200)]
[lldb][NFC] Add a test case for Objective-C properties with conflicting names

This is an LLDB test for the ASTImporter crash that got fixed in D99077.
The test is using Clang modules for the properties as it seems the conflicting
names are not actually correctly handled when generating debug information
(only the first property is emitted and the second one is ignored in the current
clang ToT).

3 years agoRevert "Reapply "OpaquePtr: Turn inalloca into a type attribute""
Oliver Stannard [Mon, 29 Mar 2021 10:31:17 +0000 (11:31 +0100)]
Revert "Reapply "OpaquePtr: Turn inalloca into a type attribute""

Reverting because test 'Bindings/Go/go.test' is failing on most
buildbots.

This reverts commit fc9df309917e57de704f3ce4372138a8d4a23d7a.

3 years ago[X86][F16C] Add F16C -O0 test coverage
Simon Pilgrim [Mon, 29 Mar 2021 10:30:16 +0000 (11:30 +0100)]
[X86][F16C] Add F16C -O0 test coverage

Ensure the duplicate conversions noticed in D48614 have gone

3 years ago[X86] Regenerate tests to add missing @PLT
Simon Pilgrim [Mon, 29 Mar 2021 10:22:59 +0000 (11:22 +0100)]
[X86] Regenerate tests to add missing @PLT

3 years ago[X86][SSE] combineHorizOpWithShuffle - consistently use getTargetShuffleInputs to...
Simon Pilgrim [Sun, 28 Mar 2021 12:00:36 +0000 (13:00 +0100)]
[X86][SSE] combineHorizOpWithShuffle - consistently use getTargetShuffleInputs to decode shuffles

Minor cleanup before I start trying to merge the unary/binary shuffle combining paths.

3 years ago[SVE][Analysis]Instruction costs for ops on scalable-vec
Nashe Mncube [Wed, 17 Mar 2021 12:00:31 +0000 (12:00 +0000)]
[SVE][Analysis]Instruction costs for ops on scalable-vec

The following operations have no associated cost for them
when applied to scalable vectors, and as a consequence
can trigger a crash when a call is made to
AArch64TTIImpl::getCastInstrCost():
- fptrunc
- trunc
- fpext
- fpto(u,s)i

This patch adds costs for these operations and
relevant regression tests.

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

3 years ago[Orc][tests] Moving one MCJIT test over to Orc to make sure the PowerPC fix worked
Stefan Gränitz [Mon, 29 Mar 2021 09:43:11 +0000 (11:43 +0200)]
[Orc][tests] Moving one MCJIT test over to Orc to make sure the PowerPC fix worked

The PowerPC fix landed in d9069dd9b576. This is in preparation for D98931.

3 years ago[NFC][LoopUnswitch] Move hasPartialIVCondition to LoopUtils
Jingu Kang [Mon, 29 Mar 2021 09:12:52 +0000 (10:12 +0100)]
[NFC][LoopUnswitch] Move hasPartialIVCondition to LoopUtils

Differential revision: https://reviews.llvm.org/D99490

3 years ago[AMDGPU] Extend gfx10 test coverage. NFC.
Petar Avramovic [Mon, 29 Mar 2021 09:12:46 +0000 (11:12 +0200)]
[AMDGPU] Extend gfx10 test coverage. NFC.

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

3 years ago[lldb] Don't search for system specific strings in assert.test
Raphael Isemann [Mon, 29 Mar 2021 08:39:10 +0000 (10:39 +0200)]
[lldb] Don't search for system specific strings in assert.test

Commit 6bc1e69de270db8d7191200f54158e4192f997ba changed the search string
to also check for the generated strings that surround the plain assert:

    Assertion `false && "lldb-test assert"' failed
                                         ^^^^^^^^^

This causes the test to fail on setups where the generated assert message
looks different. E.g., on macOS the generated message looks like this:

    Assertion failed: (false && "lldb_assert failed"), function lldb_assert

This reverts the old behaviour of just checking for the actual string we
have inside LLDB.

3 years ago[mlir] Introduce CloneOp and adapt test cases in BufferDeallocation.
Julian Gross [Thu, 18 Mar 2021 13:07:49 +0000 (14:07 +0100)]
[mlir] Introduce CloneOp and adapt test cases in BufferDeallocation.

Add a new clone operation to the memref dialect. This operation implicitly
copies data from a source buffer to a new buffer. In contrast to the linalg.copy
operation, this operation does not accept a target buffer as an argument.
Instead, this operation performs a conceptual allocation which does not need to
be performed manually.

Furthermore, this operation resolves the dependency from the linalg-dialect
in the BufferDeallocation pass. In addition, we also extended the canonicalization
patterns to fold clone operations. The copy removal pass has been removed.

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

3 years ago[ARM] Extend MVE lane interleaving to handle other non-instruction leaves
David Green [Mon, 29 Mar 2021 08:05:45 +0000 (09:05 +0100)]
[ARM] Extend MVE lane interleaving to handle other non-instruction leaves

This extends the recent MVE lane interleaving passto handle other
non-instruction leaves, for which a new shuffle is added. This helps
especially for constants and potentially for arguments.

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

3 years agoMLIR][STD] Fold trunci (sexti).
KareemErgawy-TomTom [Mon, 29 Mar 2021 06:33:56 +0000 (08:33 +0200)]
MLIR][STD] Fold trunci (sexti).

This patch folds the following pattern:

```
%arg0 = ...
%0 = sexti %arg0 : i1 to i8
%1 = trunci %0 : i8 to i1
```

into just `%arg0`.

Reviewed By: mehdi_amini

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

3 years ago[lldb] Fix Error/assert.test regression with symbols
Jan Kratochvil [Mon, 29 Mar 2021 06:16:43 +0000 (08:16 +0200)]
[lldb] Fix Error/assert.test regression with symbols

LLDB on Linux built with symbols is showing this error.
Without symbols it still PASSes:
  lldb-test: .../lldb/source/Utility/LLDBAssert.cpp:29: void lldb_private::lldb_assert(bool, const char *, const char *, const char *, unsigned int): Assertion `false && "lldb_assert failed"' failed.

With symbols it FAILs:
  lldb-test: .../lldb/tools/lldb-test/lldb-test.cpp:1086: int opts::assert::lldb_assert(lldb_private::Debugger &): Assertion `false && "lldb-test assert"' failed.

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

3 years ago[dfsan] Ignore dfsan origin wrappers when instrumenting code
Jianzhou Zhao [Mon, 29 Mar 2021 00:14:16 +0000 (00:14 +0000)]
[dfsan] Ignore dfsan origin wrappers when instrumenting code

3 years ago[ORC][C-bindings] Fix some ORC C bindings function names and signatures.
Lang Hames [Sun, 28 Mar 2021 23:30:47 +0000 (16:30 -0700)]
[ORC][C-bindings] Fix some ORC C bindings function names and signatures.

LLVMOrcDisposeObjectLayer and LLVMOrcExecutionSessionGetJITDylibByName did not
have matching signatures between the C-API header and binding implementations.
Fixes http://llvm.org/PR49745.

Patch by Mats Larsen. Thanks Mats!

Reviewed by: lhames

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

3 years ago[RISCV] Add a RV64 mulhsu test case. NFC
Craig Topper [Sun, 28 Mar 2021 22:53:22 +0000 (15:53 -0700)]
[RISCV] Add a RV64 mulhsu test case. NFC

3 years ago[ARM] Fix the Changed value in the MVE lane interleaving pass.
David Green [Sun, 28 Mar 2021 22:47:53 +0000 (23:47 +0100)]
[ARM] Fix the Changed value in the MVE lane interleaving pass.

3 years ago[Driver] Linux.cpp: move resource directory before /usr/local/include for non-musl
Fangrui Song [Sun, 28 Mar 2021 19:44:21 +0000 (12:44 -0700)]
[Driver] Linux.cpp: move resource directory before /usr/local/include for non-musl

This follows GCC and simplifies code. /usr/local/include and TOOL_INCLUDE_DIR
should not conflict with the resource directory include so users should not
observe any difference.

3 years ago[BasicAA] Make sure types match in constant offset heuristic
Nikita Popov [Sun, 28 Mar 2021 19:20:50 +0000 (21:20 +0200)]
[BasicAA] Make sure types match in constant offset heuristic

This can only happen if offset types that are larger than the
pointer size are involved. The previous implementation did not
assert in this case because it initialized the APInts to the
width of one of the variables -- though I strongly suspect it
did not compute correct results in this case.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32621
reported by fhahn.

3 years ago[X86] Add phase ordering test for the problem D99427 is trying to solve. NFC
Craig Topper [Sun, 28 Mar 2021 19:04:53 +0000 (12:04 -0700)]
[X86] Add phase ordering test for the problem D99427 is trying to solve. NFC

3 years ago[X86] Optimize vXi8 MULHS on targets where we can't sign_extend to the next register...
Craig Topper [Sun, 28 Mar 2021 18:40:15 +0000 (11:40 -0700)]
[X86] Optimize vXi8 MULHS on targets where we can't sign_extend to the next register size.

For these cases we need to extract the upper or lower elements,
multiply them using 16-bit multiplies and repack them.

Previously we used punpcklbw/punpckhbw+psraw or pmovsxbw+pshudfd to
extract and sign extend so we could use pmullw to compute the 16-bit
product and then shift down the high bits.

We can avoid the need to sign extend if we unpack the bytes into
the high byte of each word and fill the lower byte with 0 using
pxor. This puts the sign bit of each byte into the sign bit of
each word. Since the LHS and RHS have 8 trailing zeros, the full
32-bit product of those 16-bit values will have 16 trailing zeros.
This means the 16-bit product of the original bytes is in the upper
16 bits which we can calculate using pmulhw.

Reviewed By: RKSimon

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

3 years ago[X86][update_llc_test_checks] Use a less greedy regular expression for replacing...
Craig Topper [Sun, 28 Mar 2021 18:30:49 +0000 (11:30 -0700)]
[X86][update_llc_test_checks] Use a less greedy regular expression for replacing constant pool labels in tests.

While working on D97208 I noticed that these greedy regular
expressions prevent tests from failing when (%rip) appears after
a constant pool label when it didn't before.

Reviewed By: RKSimon, pengfei

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

3 years ago[gn build] Port 7b6f760fcd19
LLVM GN Syncbot [Sun, 28 Mar 2021 18:35:33 +0000 (18:35 +0000)]
[gn build] Port 7b6f760fcd19

3 years ago[ARM] MVE vector lane interleaving
David Green [Sun, 28 Mar 2021 18:34:58 +0000 (19:34 +0100)]
[ARM] MVE vector lane interleaving

MVE does not have a single sext/zext or trunc instruction that takes the
bottom half of a vector and extends to a full width, like NEON has with
MOVL. Instead it is expected that this happens through top/bottom
instructions. So the MVE equivalent VMOVLT/B instructions take either
the even or odd elements of the input and extend them to the larger
type, producing a vector with half the number of elements each of double
the bitwidth. As there is no simple instruction for a normal extend, we
often have to expand sext/zext/trunc into a series of lane moves (or
stack loads/stores, which we do not do yet).

This pass takes vector code that starts at truncs, looks for
interconnected blobs of operations that end with sext/zext and
transforms them by adding shuffles so that the lanes are interleaved and
the MVE VMOVL/VMOVN instructions can be used. This is done pre-ISel so
that it can work across basic blocks.

This initial version of the pass just handles a limited set of
instructions, not handling constants or splats or FP, which can all come
as extensions to this base.

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

3 years ago[Driver] Suppress libstdc++/libc++ path with -nostdinc
Fangrui Song [Sun, 28 Mar 2021 18:30:27 +0000 (11:30 -0700)]
[Driver] Suppress libstdc++/libc++ path with -nostdinc

This follows GCC. Having libstdc++/libc++ include paths is not useful
anyway because libstdc++/libc++ header files cannot find features.h.

While here, suppress -stdlib++-isystem with -nostdlibinc.

3 years ago[X86] Don't define vpclmulqdq or vaes intrinsics in the headers unless avx512fintrin...
Craig Topper [Sun, 28 Mar 2021 18:25:21 +0000 (11:25 -0700)]
[X86] Don't define vpclmulqdq or vaes intrinsics in the headers unless avx512fintrin.h has been included.

The intrinsics won't compile unless avx512fintrin.h has declared
the 512 bit types.

3 years ago[RISCV] Add test case for mulhsu.
Craig Topper [Sun, 28 Mar 2021 06:11:36 +0000 (23:11 -0700)]
[RISCV] Add test case for mulhsu.

We don't yet use mulhsu, but we should.

3 years agoReapply "OpaquePtr: Turn inalloca into a type attribute"
Matt Arsenault [Sun, 28 Mar 2021 17:05:17 +0000 (13:05 -0400)]
Reapply "OpaquePtr: Turn inalloca into a type attribute"

This reverts commit 20d5c42e0ef5d252b434bcb610b04f1cb79fe771.

3 years ago[InstCombine] sink min/max intrinsics with common op after select
Sanjay Patel [Sun, 28 Mar 2021 16:23:57 +0000 (12:23 -0400)]
[InstCombine] sink min/max intrinsics with common op after select

This is another step towards parity with cmp+select min/max idioms.

See D98152.

3 years ago[InstCombine] add tests for select of min/max intrinsics; NFC
Sanjay Patel [Sun, 28 Mar 2021 14:17:05 +0000 (10:17 -0400)]
[InstCombine] add tests for select of min/max intrinsics; NFC

3 years agoRevert "OpaquePtr: Turn inalloca into a type attribute"
Nico Weber [Sun, 28 Mar 2021 17:02:52 +0000 (13:02 -0400)]
Revert "OpaquePtr: Turn inalloca into a type attribute"

This reverts commit 4fefed65637ec46c8c2edad6b07b5569ac61e9e5.
Broke check-clang everywhere.

3 years ago[RISCV][Clang] Update new overloading rules for RVV intrinsics.
Zakk Chen [Mon, 22 Mar 2021 14:51:52 +0000 (07:51 -0700)]
[RISCV][Clang] Update new overloading rules for RVV intrinsics.

RVV intrinsics has new overloading rule, please see
https://github.com/riscv/rvv-intrinsic-doc/commit/82aac7dad4c6c1c351ed5b17ca6007c395843ed7

Changed:
1. Rename `generic` to `overloaded` because the new rule is not using C11 generic.
2. Change HasGeneric to HasNoMaskedOverloaded because all masked operations
   support overloading api.
3. Add more overloaded tests due to overloading rule changed.

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

3 years ago[Orc][examples] Add missing dependency to OrcShared in LLJITWithRemoteDebugging
Stefan Gränitz [Sun, 28 Mar 2021 15:48:28 +0000 (17:48 +0200)]
[Orc][examples] Add missing dependency to OrcShared in LLJITWithRemoteDebugging

3 years ago[Orc][examples] Add LLJITWithRemoteDebugging example
Stefan Gränitz [Fri, 26 Mar 2021 17:57:47 +0000 (18:57 +0100)]
[Orc][examples] Add LLJITWithRemoteDebugging example

3 years agoAArch64/GlobalISel: Remove IR section from test
Matt Arsenault [Sat, 27 Mar 2021 14:39:27 +0000 (10:39 -0400)]
AArch64/GlobalISel: Remove IR section from test

3 years agoOpaquePtr: Turn inalloca into a type attribute
Matt Arsenault [Sat, 6 Mar 2021 18:23:57 +0000 (13:23 -0500)]
OpaquePtr: Turn inalloca into a type attribute

I think byval/sret and the others are close to being able to rip out
the code to support the missing type case. A lot of this code is
shared with inalloca, so catch this up to the others so that can
happen.

3 years ago[clang-format] Fix aligning with linebreaks
Björn Schäpers [Wed, 10 Mar 2021 21:08:07 +0000 (22:08 +0100)]
[clang-format] Fix aligning with linebreaks

Breaking a string literal or a function calls arguments with
AlignConsecutiveDeclarations or AlignConsecutiveAssignments did misalign
the continued line. E.g.:

void foo() {
  int myVar = 5;
  double x  = 3.14;
  auto str  = "Hello"
            "World";
}

or

void foo() {
  int    myVar = 5;
  double x = 3.14;
  auto   str = "Hello"
             "World";
}

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

3 years ago[LV] Mark a few more cost-model members as const (NFC).
Florian Hahn [Sun, 28 Mar 2021 13:57:45 +0000 (14:57 +0100)]
[LV] Mark a few more cost-model members as const (NFC).

3 years agoUpdate the documentation for recent changes to statement attributes.
Aaron Ballman [Sun, 28 Mar 2021 13:52:13 +0000 (09:52 -0400)]
Update the documentation for recent changes to statement attributes.

Adds more information about automated diagnostic reporting for statement
attributes and adds a bit more documentation about statement attributes
in general.

3 years ago[BasicAA] Handle gep with unknown sizes earlier (NFCI)
Nikita Popov [Sun, 28 Mar 2021 11:06:52 +0000 (13:06 +0200)]
[BasicAA] Handle gep with unknown sizes earlier (NFCI)

If the sizes of both memory locations are unknown, we can only
perform a check on the underlying objects. There's no point in
going through GEP decomposition in this case.

3 years ago[SelDag] Add isIntOrFPConstant helper function.
Florian Hahn [Sun, 28 Mar 2021 11:48:58 +0000 (12:48 +0100)]
[SelDag] Add isIntOrFPConstant helper function.

This patch adds a new isIntOrFPConstant  helper function to check if a
SDValue is a integer of FP constant. This pattern is used in various
places.

There also are places that incorrectly just check for integer constants,
e.g. D99384, so hopefully this helper will help people avoid that issue.

Reviewed By: RKSimon

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

3 years ago[clang-tidy] Simplify readability checks to not need ignoring* matchers
Stephen Kelly [Tue, 9 Mar 2021 23:06:14 +0000 (23:06 +0000)]
[clang-tidy] Simplify readability checks to not need ignoring* matchers

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

3 years ago[Driver] Simplify mips multilib path and fix comments. NFC
Fangrui Song [Sun, 28 Mar 2021 07:30:38 +0000 (00:30 -0700)]
[Driver] Simplify mips multilib path and fix comments. NFC

3 years ago[lldb] Fix capitalization in CMake status message
Jonas Devlieghere [Sun, 28 Mar 2021 04:39:01 +0000 (21:39 -0700)]
[lldb] Fix capitalization in CMake status message

s/LLDB Tests/LLDB tests/

3 years ago[RISCV] Add vfabs.v pseudo instruction.
Hsiangkai Wang [Sat, 27 Mar 2021 11:40:09 +0000 (19:40 +0800)]
[RISCV] Add vfabs.v pseudo instruction.

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

3 years ago[OCaml][Test] Fix and enable debuginfo.ml test
Vaivaswatha Nagaraj [Sun, 28 Mar 2021 00:55:39 +0000 (06:25 +0530)]
[OCaml][Test] Fix and enable debuginfo.ml test

`get_or_create_type_array` was used on a non-type MDNode.
Add interface for `get_or_create_array` and use that instead.

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

3 years ago[test] Add UNSUPPORTED: system-windows to linux-ld.c
Fangrui Song [Sat, 27 Mar 2021 23:46:30 +0000 (16:46 -0700)]
[test] Add UNSUPPORTED: system-windows to linux-ld.c

We should have a test verifying / \ for Windows but have such a long
test specifically for Linux cross compilation suffer from Windows \
is too troublesome.

3 years ago[X86] Regenerate a bunch of tests to pick up @PLT
Craig Topper [Sat, 27 Mar 2021 23:41:04 +0000 (16:41 -0700)]
[X86] Regenerate a bunch of tests to pick up @PLT

I'm prepping another patch to the same tests and this just adds
noise to my diff.

3 years ago[Driver] Remove an incorrect library path for multilib
Fangrui Song [Sat, 27 Mar 2021 23:36:21 +0000 (16:36 -0700)]
[Driver] Remove an incorrect library path for multilib

This is incorrect (adding a path with unrelated libraries) but benign in practice because previous paths take precedence.

3 years ago[Driver] Remove an unneeded multiarch library path which ends with ../../..
Fangrui Song [Sat, 27 Mar 2021 22:46:06 +0000 (15:46 -0700)]
[Driver] Remove an unneeded multiarch library path which ends with ../../..

Neither vanilla nor Debian GCC has the patch, which usually duplicates $sysroot/usr/lib.

3 years ago[RISCV] Add a pattern for (sext_inreg (mul (and X, 0xffffffff), (and Y, 0xffffffff...
Craig Topper [Sat, 27 Mar 2021 22:33:39 +0000 (15:33 -0700)]
[RISCV] Add a pattern for (sext_inreg (mul (and X, 0xffffffff), (and Y, 0xffffffff)), i32) to suppress MULW formation

We have a special pattern for
(mul (and X, 0xffffffff), (and Y, 0xffffffff)), to optimize the
ANDs to shift. But if a sext_inreg coms first, we'll form a MULW
and limit the effectiveness of the special match. So this patch
adds a larger pattern to suppress the MULW formation by emitting
a sext.w and then the same output we use for the
(mul (and X, 0xffffffff), (and Y, 0xffffffff)). This should all
get CSEd.

This is the issue I was trying to fix with D99029, but that affected
many more tests.

3 years ago[BasicAA] Refactor linear expression decomposition
Nikita Popov [Sat, 27 Mar 2021 15:23:35 +0000 (16:23 +0100)]
[BasicAA] Refactor linear expression decomposition

The current linear expression decomposition handles zext/sext by
decomposing the casted operand, and then checking NUW/NSW flags
to determine whether the extension can be distributed. This has
some disadvantages:

First, it is not possible to perform a partial decomposition. If
we have zext((x + C1) +<nuw> C2) then we will fail to decompose
the expression entirely, even though it would be safe and
profitable to decompose it to zext(x + C1) +<nuw> zext(C2)

Second, we may end up performing unnecessary decompositions,
which will later be discarded because they lack nowrap flags
necessary for extensions.

Third, correctness of the code is not entirely obvious: At a high
level, we encounter zext(x -<nuw> C) in the form of a zext on the
linear expression x + (-C) with nuw flag set. Notably, this case
must be treated as zext(x) + -zext(C) rather than zext(x) + zext(-C).
The code handles this correctly by speculatively zexting constants
to the final bitwidth, and performing additional fixup if the
actual extension turns out to be an sext. This was not immediately
obvious to me.

This patch inverts the approach: An ExtendedValue represents a
zext(sext(V)), and linear expression decomposition will try to
decompose V further, either by absorbing another sext/zext into the
ExtendedValue, or by distributing zext(sext(x op C)) over a binary
operator with appropriate nsw/nuw flags. At each step we can
determine whether distribution is legal and abort with a partial
decomposition if not. We also know which extensions we need to
apply to constants, and don't need to speculate or fixup.

3 years ago[libcxx] rearranges all concept tests
Christopher Di Bella [Mon, 22 Mar 2021 19:39:35 +0000 (19:39 +0000)]
[libcxx] rearranges all concept tests

moves tests into directories matching their stable names so that the
tests can reflect the concept name

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

3 years agoDeduplicate branches and adjust comment [NFC]
Aaron Puchert [Sat, 27 Mar 2021 21:50:22 +0000 (22:50 +0100)]
Deduplicate branches and adjust comment [NFC]

Currently we want to allow calling non-const methods even when only a
shared lock is held, because -Wthread-safety-reference is already quite
sensitive and not all code is const-correct. Even if it is, this might
require users to add std::as_const around the implicit object argument.

See D52395 for a discussion.

Fixes PR46963.

3 years ago[LV] Fix formatting from 2f9d68c3f12a.
Florian Hahn [Sat, 27 Mar 2021 21:29:53 +0000 (21:29 +0000)]
[LV] Fix formatting from 2f9d68c3f12a.