platform/upstream/llvm.git
3 years ago[runtimes] Simplify how we specify XFAIL & friends based on the triple
Louis Dionne [Fri, 18 Jun 2021 17:33:14 +0000 (13:33 -0400)]
[runtimes] Simplify how we specify XFAIL & friends based on the triple

Now that Lit supports regular expressions inside XFAIL & friends, it is
much easier to write Lit annotations based on the triple.

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

3 years ago[libc++] Provide c++03 alternative for va_copy if available in xlocale.h
jasonliu [Thu, 1 Jul 2021 17:59:47 +0000 (17:59 +0000)]
[libc++] Provide c++03 alternative for va_copy if available in xlocale.h

Summary:
If we are on c++03 mode for some reason, and __builtin_va_copy is
available, then use it instead of error out on not having va_copy
in 03 mode.

Reviewed by: ldionne

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

3 years ago[libcxx][functional][modular] splices <functional> into modular headers
Christopher Di Bella [Thu, 1 Jul 2021 13:25:35 +0000 (09:25 -0400)]
[libcxx][functional][modular] splices <functional> into modular headers

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

3 years ago[libcxx] Update optional star operator to be noexcept.
zoecarver [Thu, 1 Jul 2021 17:18:27 +0000 (10:18 -0700)]
[libcxx] Update optional star operator to be noexcept.

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

3 years ago[libc++] Migrate the additional_features parameter to the DSL
Louis Dionne [Thu, 1 Jul 2021 17:36:09 +0000 (13:36 -0400)]
[libc++] Migrate the additional_features parameter to the DSL

This is required to run the tests under any configuration that uses
additional_features using a from-scratch config. That is the case of
e.g. the Debug mode (which uses LIBCXX-DEBUG-FIXME) and the tests on
Windows.

3 years ago[gwp_asan] Improve symbolizer script
Vitaly Buka [Wed, 30 Jun 2021 21:27:53 +0000 (14:27 -0700)]
[gwp_asan] Improve symbolizer script

Show inlined functions.
Hide unhelpful DWARF related warnings.

Reviewed By: hctim

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

3 years ago[NFC][scudo] Extract MapAllocatorTest for TEST_F
Vitaly Buka [Thu, 1 Jul 2021 17:22:35 +0000 (10:22 -0700)]
[NFC][scudo] Extract MapAllocatorTest for TEST_F

3 years ago[NFC][compiler-rt] add back solaris xfail for unpoison-alternate-stack.cpp
Emily Shi [Thu, 1 Jul 2021 17:13:00 +0000 (10:13 -0700)]
[NFC][compiler-rt] add back solaris xfail for unpoison-alternate-stack.cpp

3 years ago[instcombine] Fold overflow check using overflow intrinsic to comparison
Philip Reames [Thu, 1 Jul 2021 16:17:04 +0000 (09:17 -0700)]
[instcombine] Fold overflow check using overflow intrinsic to comparison

This follows up to D104665 (which added umulo handling alongside the existing uaddo case), and generalizes for the remaining overflow intrinsics.

I went to add analogous handling to LVI, and discovered that LVI already had a more general implementation. Instead, we can port was LVI does to instcombine. (For context, LVI uses makeExactNoWrapRegion to constrain the value 'x' in blocks reached after a branch on the condition `op.with.overflow(x, C).overflow`.)

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

3 years agoFix an accepts-invalid issue with [[]] attributes in the type position in C
Aaron Ballman [Thu, 1 Jul 2021 16:39:17 +0000 (12:39 -0400)]
Fix an accepts-invalid issue with [[]] attributes in the type position in C

A user reported an issue to me via email that Clang was accepting some
code that GCC was rejecting. After investigation, it turned out to be a
general problem of us failing to properly reject attributes written in
the type position in C when they don't apply to types. The root cause
was a terminology issue -- we sometimes use "CXX11Attr" to mean [[]] in
C++11 mode and sometimes [[]] in general -- and this came back to bite
us because in this particular case, it really meant [[]] in C++ mode.

I fixed the issue by introducing a new function
AttributeCommonInfo::isStandardAttributeSyntax() to represent [[]] in
either C or C++ mode.

This fix pointed out that we've had the issue in some of our existing
tests, which have all been corrected. This resolves
https://bugs.llvm.org/show_bug.cgi?id=50954.

3 years ago[Bazel] Fixes for 266a7414d8
Geoffrey Martin-Noble [Thu, 1 Jul 2021 16:38:35 +0000 (09:38 -0700)]
[Bazel] Fixes for 266a7414d8

Adds LinalgOps dep needed for
https://github.com/llvm/llvm-project/commit/266a7414d8f26

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

3 years ago[MLIR] FlatAffineConstraints: Use Matrix objects to store the constraints
Arjun P [Thu, 1 Jul 2021 14:42:56 +0000 (20:12 +0530)]
[MLIR] FlatAffineConstraints: Use Matrix objects to store the constraints

This results in significant deduplication of code. This patch is not expected to change any functionality, it's just some simplification in preparation for future work. Also slightly simplified some code that was being touched anyway and added some unit tests for some functions that were touched.

Reviewed By: bondhugula

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

3 years ago[OpenMP][Offloading] Refined return value of `DeviceTy::getOrAllocTgtPtr`
Shilei Tian [Thu, 1 Jul 2021 16:31:45 +0000 (12:31 -0400)]
[OpenMP][Offloading] Refined return value of `DeviceTy::getOrAllocTgtPtr`

`DeviceTy::getOrAllocTgtPtr` just returns a target pointer. In addition,
two bool values (`IsNew` and `IsHostPtr`) are passed by reference to make the
change in the function available in callee.

In this patch, a struct, which contains the target pointer, two flags, and an
iterator to the map table entry corresponding to the queried host pointer, will
be returned. In addition to make the logic clearer regarding the two bool values,
this paves the way for the next patch to fix the data race in `bug49334.cpp` by
attaching an event to the map table entry (and that's why we need the iterator).

Reviewed By: grokos

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

3 years ago[mlir][sparse] move tensor expression builder into Merger utility
Aart Bik [Wed, 30 Jun 2021 21:41:10 +0000 (14:41 -0700)]
[mlir][sparse] move tensor expression builder into Merger utility

Rationale:
Follow-up on migrating lattice and tensor expression related methods into the new utility.
This also prepares the next step of generalizing the op kinds that are handled.

Reviewed By: gussmith23

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

3 years ago[OpaquePtr] Support opaque pointers in intrinsic type check
Nikita Popov [Tue, 29 Jun 2021 21:30:27 +0000 (23:30 +0200)]
[OpaquePtr] Support opaque pointers in intrinsic type check

This adds support for opaque pointers in intrinsic type checks
of IIT kind Pointer and PtrToElt.

This is less straight-forward than it might initially seem, because
we should only accept opaque pointers here in --force-opaque-pointers
mode. Otherwise, there would be more than one valid type signature
for a given intrinsic name.

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

3 years agoGlobalISel: Use LLT in call lowering callbacks
Matt Arsenault [Thu, 10 Jun 2021 21:31:30 +0000 (17:31 -0400)]
GlobalISel: Use LLT in call lowering callbacks

This preserves the memory type so the lowerings can rely on them.

3 years ago[SelectionDAG] Implement PromoteIntRes_INSERT_SUBVECTOR
Bradley Smith [Tue, 29 Jun 2021 11:40:46 +0000 (12:40 +0100)]
[SelectionDAG] Implement PromoteIntRes_INSERT_SUBVECTOR

Inserting into a smaller-than-legal scalable vector would result in an
internal compiler error. For example, inserting a <vscale x 4 x i8> into
a <vscale x 8 x i8> (both illegal vector types for SVE) would cause a
crash.

This crash was happening because there was no code to promote (legalise)
the result of an INSERT_SUBVECTOR node.

This patch implements PromoteIntRes_INSERT_SUBVECTOR, which legalises
the ISD node. This is currently done by going through memory. This is
necessary because of the requirement that the SubVec parameter of the
INSERT_SUBVECTOR node must be smaller than the Vec parameter, which
means that INSERT_SUBVECTOR cannot always have a legal result/operand
types.

Co-Authored-by: Joe Ellis <joe.ellis@arm.com>
Differential Revision: https://reviews.llvm.org/D102766

3 years ago[AMDGPU] Fix immediate sign during V_MOV_B64_PSEUDO expansion
Stanislav Mekhanoshin [Wed, 30 Jun 2021 21:48:34 +0000 (14:48 -0700)]
[AMDGPU] Fix immediate sign during V_MOV_B64_PSEUDO expansion

Creating a V_MOV_B32 with zero extended immediate source
prevented conversion to V_BFREV_B32.

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

3 years ago[ARM] Extra BFI codegen tests. NFC
David Green [Thu, 1 Jul 2021 15:56:23 +0000 (16:56 +0100)]
[ARM] Extra BFI codegen tests. NFC

3 years ago[AArch64][GlobalISel]Legalise some vector types for min/max
Irina Dobrescu [Wed, 30 Jun 2021 14:49:48 +0000 (15:49 +0100)]
[AArch64][GlobalISel]Legalise some vector types for min/max

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

3 years ago[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t.
Alexey Bataev [Thu, 1 Jul 2021 13:42:16 +0000 (06:42 -0700)]
[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t.

Need to add some conversions to suppress possible warning messages.

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

3 years ago[clangd] Unbreak mac build differently 0c96a92d8666b8
Nico Weber [Thu, 1 Jul 2021 14:49:10 +0000 (10:49 -0400)]
[clangd] Unbreak mac build differently 0c96a92d8666b8

This reverts b56e5f8a10c1 (and follow-up f6db88535cb) and instead
restores the state we had before 0c96a92d8666b8: ClangdMain.cpp
includes Features.inc before including Transport.h.

This is a bit ugly, but it matches the former state and making Transport.h
include Features.h means that xpc/ needs to be able to find the generated
Features.inc, wich is also a bit ugly.

3 years ago[LoopVectorize][X86] Regenerate conversion-cost.ll tests
Simon Pilgrim [Thu, 1 Jul 2021 14:17:48 +0000 (15:17 +0100)]
[LoopVectorize][X86] Regenerate conversion-cost.ll tests

3 years ago[CostModel][X86] Adjust fp<->int vXi32 SSE legalized costs based on llvm-mca reports.
Simon Pilgrim [Thu, 1 Jul 2021 13:16:02 +0000 (14:16 +0100)]
[CostModel][X86] Adjust fp<->int vXi32 SSE legalized costs based on llvm-mca reports.

Building on rG2a1ef8784ad9a, adjust the SSE cost tables to use the legalized types based on the worst case costs from the script in D103695.

To account for different numbers of src/dst legalized type registers we must scale the cost by maximum of the src/dst, not just use src

3 years ago[coro async] Add support for specifying which parameter is swiftself in
Arnold Schwaighofer [Wed, 30 Jun 2021 13:57:40 +0000 (06:57 -0700)]
[coro async] Add support for specifying which parameter is swiftself in
  async resume functions

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

3 years ago[AArch64] Add some more tests to CodeGen/AArch64/aarch64-load-ext.ll. NFC.
Sjoerd Meijer [Thu, 1 Jul 2021 13:44:35 +0000 (14:44 +0100)]
[AArch64] Add some more tests to CodeGen/AArch64/aarch64-load-ext.ll. NFC.

3 years ago[ARM] Transform a floating-point to fixed-point conversion to a VCVT_fix
Sam Tebbs [Mon, 21 Jun 2021 15:00:11 +0000 (16:00 +0100)]
[ARM] Transform a floating-point to fixed-point conversion to a VCVT_fix

Much like fixed-point to floating-point conversion, the converse can
also be transformed into a fixed-point VCVT. This patch transforms
multiplications of floating point numbers by 2^n into a VCVT_fix. The
exception is that a float to fixed conversion with 1 fractional bit
ends up being an FADD (FADD(x, x) emulates FMUL(x, 2)) rather than an FMUL so there is a special case for that. This patch also moves the code from https://reviews.llvm.org/D103903 into a separate function as fixed to float and float to fixed are very similar.

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

3 years ago[libc++] Fix incorrect shell expansion in macos-ci-setup
Louis Dionne [Thu, 1 Jul 2021 14:09:13 +0000 (10:09 -0400)]
[libc++] Fix incorrect shell expansion in macos-ci-setup

3 years agoRevert "[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds...
Alexey Bataev [Thu, 1 Jul 2021 13:39:53 +0000 (06:39 -0700)]
Revert "[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t."

This reverts commit 67643f46ee9fb08e32075d67715a59c840aa761b to fix
unexpected diagnostic notes.

3 years ago[NFC] Add new setDebugLocFromInst that uses the class Builder by default
David Sherwood [Fri, 18 Jun 2021 12:20:10 +0000 (13:20 +0100)]
[NFC] Add new setDebugLocFromInst that uses the class Builder by default

In lots of places we were calling setDebugLocFromInst and passing
in the same Builder member variable found in InnerLoopVectorizer.
I personally found this confusing so I've changed the interface
to take an Optional<IRBuilder<> *> and we can now pass in None
when we want to use the class member variable.

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

3 years ago[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t.
Alexey Bataev [Wed, 30 Jun 2021 12:47:19 +0000 (05:47 -0700)]
[OPENMP]Fix PR50640: OpenMP target clause implicitly scaling loop bounds to uint64_t.

Need to add some conversions to suppress possible warning messages.

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

3 years ago[flang][driver] Extend the `flang` bash script to act as a driver
Andrzej Warzynski [Thu, 1 Jul 2021 08:33:00 +0000 (09:33 +0100)]
[flang][driver] Extend the `flang` bash script to act as a driver

Until now, `f18` would:
  1. Use Flang to unparse the input files
  2. Call an external Fortran compiler to compile the unparsed source
  files (generated in step 1)

With this patch, `f18` will stop after unparsing the input source files,
i.e. step 1 above. The `flang` bash script will take care of step 2,
i.e. calling an external Fortran compiler driver to compile them. This
way:
  * the functionality of `f18` is reduced - it will only drive Flang (as
  opposed to delegating code-generation to an external tool on top of
  this)
  * we will able to switch between `f18` and `flang-new` for unparsing before
  an external Fortran compiler is called for code-generation

The updated `flang` bash script needs to specify the output file when
using the `-fdebug-unparse` action. Both `f18` and `flang-new` have been
updated accordingly.

These changes were discussed in [1] as a requirement for replacing `f18`
with `flang-new`.

[1] https://lists.llvm.org/pipermail/flang-dev/2021-April/000677.html

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

3 years ago[AArch64] Add fp16 tests for vector copysign.
Florian Hahn [Thu, 1 Jul 2021 12:10:26 +0000 (13:10 +0100)]
[AArch64] Add fp16 tests for vector copysign.

Add additional fp16 vector tests for copysign, to show improvements in
follow-up patch.

3 years ago[clang] Fix CallExpr dependence bit may not respect all its arguments.
Haojian Wu [Wed, 30 Jun 2021 08:15:59 +0000 (10:15 +0200)]
[clang] Fix CallExpr dependence bit may not respect all its arguments.

Before this patch, the dependence of CallExpr was only computed in the
constructor, the dependence bits might not reflect truth -- some arguments might
be not set (nullptr) during this time, e.g. CXXDefaultArgExpr will be set via
the setArg method in the later parsing stage, so we need to recompute the
dependence bits.

3 years ago[AArch64] Add test for min/max
Irina Dobrescu [Thu, 17 Jun 2021 11:41:23 +0000 (12:41 +0100)]
[AArch64] Add test for min/max

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

3 years ago[DebugInfo][InstrRef][2/4] Use subreg substitutions in LiveDebugValues
Jeremy Morse [Thu, 1 Jul 2021 11:34:50 +0000 (12:34 +0100)]
[DebugInfo][InstrRef][2/4] Use subreg substitutions in LiveDebugValues

Added in 47c3fe2a22cf, we sometimes need to describe a variable value
substitution with a subregister qualifier, to say that "the value is the
lower 32 bits of this 64 bit register def" for example. That then needs
support during LiveDebugValues to interpret the subregister qualifiers,
which is what this patch adds.

Whenever we encounter a DBG_INSTR_REF and find its value by using a
substitution, collect any subregister qualifiers seen. Then, accumulate the
effects of the qualifiers to work out what offset and what size should be
extracted from the defined register. Finally, for the target ValueIDNum,
extract whatever subregister is in the correct position

Currently, describing a subregister field of a larger value that has been
spilt to the stack, is unimplemented.

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

3 years ago[llvm-mca] Fix JSON output (PR50922)
Marcos Horro [Thu, 1 Jul 2021 10:49:24 +0000 (11:49 +0100)]
[llvm-mca] Fix JSON output (PR50922)

Based on the discussion in PR50922, minor changes have been done to properly
output a valid JSON.  Removed "not implemented" keys.

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

3 years ago[libomptarget][nfc] Move grid size computation
Jon Chesterfield [Thu, 1 Jul 2021 11:53:03 +0000 (12:53 +0100)]
[libomptarget][nfc] Move grid size computation

Change getLaunchVals to return the integers used for launch

Reviewed By: pdhaliwal

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

3 years ago[mlir][Linalg] Add comprehensive bufferization support for ConstantOp (13/n)
Nicolas Vasilache [Wed, 30 Jun 2021 21:18:13 +0000 (21:18 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for ConstantOp (13/n)

ConstantOp are only supported in the ModulePass because they require a GlobalCreator object that must be constructed from a ModuleOp.
If the standlaone FunctionPass encounters a ConstantOp, bufferization fails.

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

3 years ago[mlir][Linalg] Drop comprehensive-func-bufferize (12/n)
Nicolas Vasilache [Wed, 30 Jun 2021 21:10:26 +0000 (21:10 +0000)]
[mlir][Linalg] Drop comprehensive-func-bufferize (12/n)

This revision drops the comprehensive bufferization Function pass, which has issues when trying to bufferize constants.
Instead, only support the comprehensive-module-bufferize by default.

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

3 years ago[VP] Implementation of intrinsic and SDNode definitions for VP load, store, gather...
Hussain Kadhem [Thu, 1 Jul 2021 09:30:49 +0000 (11:30 +0200)]
[VP] Implementation of intrinsic and SDNode definitions for VP load, store, gather, scatter.

This patch adds intrinsic definitions and SDNodes for predicated
load/store/gather/scatter, based on the work done in D57504.

Reviewed By: simoll, craig.topper

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

3 years ago[mlir][Linalg] Add comprehensive bufferization support for linalg::InitTensor and...
Nicolas Vasilache [Tue, 29 Jun 2021 12:53:09 +0000 (12:53 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for linalg::InitTensor and tensor::CastOp (11/n)

Also add an integration test that connects all the dots end to end, including with cast to unranked tensor for external library calls.

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

3 years ago[AArch64][SVE] Add support for fixed length MSCATTER/MGATHER
Bradley Smith [Mon, 7 Jun 2021 13:34:03 +0000 (14:34 +0100)]
[AArch64][SVE] Add support for fixed length MSCATTER/MGATHER

Since gather lowering can now lower to nodes that may need expansion via
the vector legalizer, do MGATHER lowering via vector legalizer.

Additionally, as part of adding passthru support for fixed typed
gathers, fix passthru support for scalable types.

Depends on D104910

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

3 years ago[llvm][docs] Bump release number from 12 -> 13
David Spickett [Wed, 30 Jun 2021 13:26:07 +0000 (13:26 +0000)]
[llvm][docs] Bump release number from 12 -> 13

This seems to have been forgotten. The result was the title
of pages like https://llvm.org/docs/ReleaseNotes.html

Was:
<title>LLVM 13.0.0 Release Notes &#8212; LLVM 12 documentation</title>

Reviewed By: tstellar

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

3 years ago[CostModel][X86] getCastInstrCost - attempt to match custom cast/conversion before...
Simon Pilgrim [Thu, 1 Jul 2021 10:39:59 +0000 (11:39 +0100)]
[CostModel][X86] getCastInstrCost - attempt to match custom cast/conversion before legalized types.

Move the (SSE-only) generic, legalized type conversion matching after the specific,custom conversion cases, allowing us to properly provide cost overrides.

The next step will be to clean up some of the weird existing costs and then to enable AVX+ legalized costs, which will let us strip out a lot of the cost tables entries.

3 years ago[mlir][Linalg] Add support for CallOp bufferization (10/n)
Nicolas Vasilache [Tue, 29 Jun 2021 12:05:59 +0000 (12:05 +0000)]
[mlir][Linalg] Add support for CallOp bufferization (10/n)

Cross function boundary bufferization support is added.
This is enabled by cross-function boundary alias analysis, for which the bufferization process is extended: it can now modify the BufferizationAliasInfo as new ops are introduced.

A number of simplifying assumptions are made:

1. by default we bufferize to the most dynamic strided memref type, further memref::CastOp canonicalizations are expected to clean up the IR.
2. in the current implementation, the stride information is always erased at function boundaries. A subsequent pass will be required to analyze the meet of all call ops to a function and decide whether more static buffer types can be used. This will potentially clone functions when it is deemed profitable to do so (e.g. when the stride-1 dimension may vary).
3. external function always bufferize to the most dynamic strided memref version. This may require special annotations for specifying that particular operands of top-level functions have contiguous buffer layout.

An alternative to point 3. would be to support tensor layout annotations, which is currently not supported in MLIR.

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

3 years ago[mlir][async] Remove unused variable. NFC.
Benjamin Kramer [Thu, 1 Jul 2021 10:24:55 +0000 (12:24 +0200)]
[mlir][async] Remove unused variable. NFC.

3 years ago[DebugInfo][InstrRef][1/4] Support transformations that widen values
Jeremy Morse [Thu, 1 Jul 2021 09:59:22 +0000 (10:59 +0100)]
[DebugInfo][InstrRef][1/4] Support transformations that widen values

Very late in compilation, backends like X86 will perform optimisations like
this:

    $cx = MOV16rm $rax, ...
    ->
    $rcx = MOV64rm $rax, ...

Widening the load from 16 bits to 64 bits. SEeing how the lower 16 bits
remain the same, this doesn't affect execution. However, any debug
instruction reference to the defined operand now refers to a 64 bit value,
nto a 16 bit one, which might be unexpected. Elsewhere in codegen, there's
often this pattern:

    CALL64pcrel32 @foo, implicit-def $rax
    %0:gr64 = COPY $rax
    %1:gr32 = COPY %0.sub_32bit

Where we want to refer to the definition of $eax by the call, but don't
want to refer the copies (they don't define values in the way
LiveDebugValues sees it). To solve this, add a subregister field to the
existing "substitutions" facility, so that we can describe a field within
a larger value definition. I would imagine that this would be used most
often when a value is widened, and we need to refer to the original,
narrower definition.

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

3 years ago[clang] Apply P1825 as Defect Report from C++11 up to C++20.
Matheus Izvekov [Mon, 14 Jun 2021 11:23:18 +0000 (13:23 +0200)]
[clang] Apply P1825 as Defect Report from C++11 up to C++20.

This extends the effects of [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1825r0.html | P1825 ]] to all C++ standards from C++11 up to C++20.

According to Motion 23 from Cologne 2019, P1825R0 was accepted as a Defect Report, so we retroactively apply this all the way back to C++11.

Note that we also remove implicit moves from C++98 as an extension
altogether, since the expanded first overload resolution from P1825
can cause some meaning changes in C++98.
For example it can change which copy constructor is picked when both const
and non-const ones are available.

This also rips out warn_return_std_move since there are no cases where it would be worthwhile to suggest it.

This also fixes a bug with bailing into the second overload resolution
when encountering a non-rvref qualified conversion operator.
This was unnoticed until now, so two new test cases cover these.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: rsmith

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

3 years agoadded some example code for llvm::Expected<T>
Christian Kühnel [Mon, 28 Jun 2021 12:29:50 +0000 (14:29 +0200)]
added some example code for llvm::Expected<T>

Since I had some fun understanding how to properly use llvm::Expected<T> I added some code examples that I would have liked to see when learning to use it.

Reviewed By: sammccall

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

3 years ago[clang-format] PR50727 C# Invoke Lamda Expression indentation incorrect
mydeveloperday [Thu, 1 Jul 2021 09:45:59 +0000 (10:45 +0100)]
[clang-format] PR50727 C# Invoke Lamda Expression indentation incorrect

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

When processing C# Lambda expression in the indentation can goes a little wrong,
resulting the the closing } being at the wrong indentation level and meaning the remaining part of the file is
incorrectly indented.

This can be a fairly common pattern for when C# wants to peform a UI action from a thread,
and it wants to invoke that action on the main thread

Reviewed By: exv, jbcoe

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

3 years ago[PowerPC] add a testcase for byval parameter; NFC
Chen Zheng [Thu, 1 Jul 2021 09:22:42 +0000 (09:22 +0000)]
[PowerPC] add a testcase for byval parameter; NFC

3 years ago[BasicAA] Fix typo ScaleForGDC -> ScaleForGCD.
Florian Hahn [Thu, 1 Jul 2021 08:48:07 +0000 (09:48 +0100)]
[BasicAA] Fix typo ScaleForGDC -> ScaleForGCD.

3 years ago[analyzer][NFC] Inline ExprEngine::handleLVectorSplat()
Balazs Benics [Thu, 1 Jul 2021 08:54:28 +0000 (10:54 +0200)]
[analyzer][NFC] Inline ExprEngine::handleLVectorSplat()

It seems like ExprEngine::handleLVectorSplat() was used at only 2
places. It might be better to directly inline them for readability.

It seems like these cases were not covered by tests according to my
coverage measurement, so I'm adding tests as well, demonstrating that no
behavior changed.
Besides that, I'm handling CK_MatrixCast similarly to how the rest of
the unhandled casts are evaluated.

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

Reviewed by: NoQ

3 years ago[analyzer] LValueToRValueBitCasts should evaluate to an r-value
Balazs Benics [Thu, 1 Jul 2021 08:54:22 +0000 (10:54 +0200)]
[analyzer] LValueToRValueBitCasts should evaluate to an r-value

Previously `LValueToRValueBitCast`s were modeled in the same way how
a regular `BitCast` was. However, this should not produce an l-value.
Modeling bitcasts accurately is tricky, so it's probably better to
model this expression by binding a fresh conjured value.

The following code should not result in a diagnostic:
```lang=C++
  __attribute__((always_inline))
  static inline constexpr unsigned int_castf32_u32(float __A) {
    return __builtin_bit_cast(unsigned int, __A); // no-warning
  }
```

Previously, it reported
`Address of stack memory associated with local variable '__A' returned
to caller [core.StackAddressEscape]`.

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

Reviewed by: NoQ, vsavchenko

3 years ago[gn build] Port 39f64c4c8375
LLVM GN Syncbot [Thu, 1 Jul 2021 08:31:00 +0000 (08:31 +0000)]
[gn build] Port 39f64c4c8375

3 years ago[flang] Revert "PoC for Flang Driver Plugins"
Andrzej Warzynski [Thu, 1 Jul 2021 08:27:31 +0000 (08:27 +0000)]
[flang] Revert "PoC for Flang Driver Plugins"

This patch has not been reviewed and was commited by accident.

This reverts commit 788a5d4afe6407e647454a9832a7b4a27fba06bf.

3 years ago[ORC] Add wrapper-function support methods to ExecutorProcessControl.
Lang Hames [Sat, 19 Jun 2021 07:36:47 +0000 (17:36 +1000)]
[ORC] Add wrapper-function support methods to ExecutorProcessControl.

Adds support for both synchronous and asynchronous calls to wrapper functions
using SPS (Simple Packed Serialization). Also adds support for wrapping
functions on the JIT side in SPS-based wrappers that can be called from the
executor.

These new methods simplify calls between the JIT and Executor, and will be used
in upcoming ORC runtime patches to enable communication between ORC and the
runtime.

3 years ago[flang][docs] Add documentation for the new Flang driver
Andrzej Warzynski [Mon, 14 Jun 2021 14:26:58 +0000 (14:26 +0000)]
[flang][docs] Add documentation for the new Flang driver

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

3 years agoPoC for Flang Driver Plugins
Stuart Ellis [Wed, 23 Jun 2021 17:05:29 +0000 (18:05 +0100)]
PoC for Flang Driver Plugins

3 years ago[mlir][linalg][python] Update integration of OpDSL doc (NFC).
Tobias Gysi [Thu, 1 Jul 2021 06:41:52 +0000 (06:41 +0000)]
[mlir][linalg][python] Update integration of OpDSL doc (NFC).

Move the OpDSL doc to a linalg sub folder and updated the integration in the main linalg documentation.

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

3 years ago[clangd] Fix gRPC build due to missing include path
Sam McCall [Thu, 1 Jul 2021 07:33:22 +0000 (09:33 +0200)]
[clangd] Fix gRPC build due to missing include path

3 years ago[MLIR] Add argument insertion helpers for FunctionLike
Fabian Schuiki [Mon, 28 Jun 2021 11:12:36 +0000 (13:12 +0200)]
[MLIR] Add argument insertion helpers for FunctionLike

Add helpers to facilitate adding arguments and results to operations
that implement the `FunctionLike` trait. These operations already have a
convenient argument and result *erasure* mechanism, but a corresopnding
utility for insertion is missing. This introduces such a utility.

3 years ago[lldb] Fix Recognizer/assert.test with glibc-2.33.9000-31.fc35.x86_64
Jan Kratochvil [Thu, 1 Jul 2021 07:14:28 +0000 (09:14 +0200)]
[lldb] Fix Recognizer/assert.test with glibc-2.33.9000-31.fc35.x86_64

While on regular Linux system (Fedora 34 GA, not updated):

* thread #1, name = '1', stop reason = hit program assert
    frame #0: 0x00007ffff7e242a2 libc.so.6`raise + 322
    frame #1: 0x00007ffff7e0d8a4 libc.so.6`abort + 278
    frame #2: 0x00007ffff7e0d789 libc.so.6`__assert_fail_base.cold + 15
    frame #3: 0x00007ffff7e1ca16 libc.so.6`__assert_fail + 70
  * frame #4: 0x00000000004011bd 1`main at assert.c:7:3

On Fedora 35 pre-release one gets:

* thread #1, name = '1', stop reason = signal SIGABRT
  * frame #0: 0x00007ffff7e48ee3 libc.so.6`pthread_kill@GLIBC_2.2.5 + 67
    frame #1: 0x00007ffff7dfb986 libc.so.6`raise + 22
    frame #2: 0x00007ffff7de5806 libc.so.6`abort + 230
    frame #3: 0x00007ffff7de571b libc.so.6`__assert_fail_base.cold + 15
    frame #4: 0x00007ffff7df4646 libc.so.6`__assert_fail + 70
    frame #5: 0x00000000004011bd 1`main at assert.c:7:3

I did not write a testcase as one needs the specific glibc. An
artificial test would just copy the changed source.

Reviewed By: mib

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

3 years ago[NFC][PassBuilder] addVectorPasses(): clarify that 'IsLTO' is actually 'IsFullLTO'
Roman Lebedev [Thu, 1 Jul 2021 07:09:24 +0000 (10:09 +0300)]
[NFC][PassBuilder] addVectorPasses(): clarify that 'IsLTO' is actually 'IsFullLTO'

I.e. it will be `false` for thin lto.

3 years ago[NFC][Scheduler] Refactor tryCandidate to return boolean
Qiu Chaofan [Thu, 1 Jul 2021 06:31:47 +0000 (14:31 +0800)]
[NFC][Scheduler] Refactor tryCandidate to return boolean

This patch changes return type of tryCandidate from void to bool:

1. Methods in some targets already follow this convention.
2. This would help if some target wants to re-use generic code.
3. It looks more intuitive if these try-method returns the same type.

We may need to change return type of them from bool to some enum
further, to make it less confusing.

Reviewed By: foad

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

3 years agoAdd list of LWG papers accepted by WG21 during the June 2021 plenary
Corentin Jabot [Thu, 1 Jul 2021 04:26:55 +0000 (04:26 +0000)]
Add list of LWG papers accepted by WG21 during the June 2021 plenary

Reviewed By: #libc, Quuxplusone, ldionne

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

3 years agoFail gracefully if no inlining model is available to download.
Jacob Hegna [Wed, 23 Jun 2021 05:22:18 +0000 (05:22 +0000)]
Fail gracefully if no inlining model is available to download.

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

3 years ago[gn build] Port 28b01c59c93d
LLVM GN Syncbot [Thu, 1 Jul 2021 04:00:13 +0000 (04:00 +0000)]
[gn build] Port 28b01c59c93d

3 years ago[hexagon] Add {hvx,}hexagon_{protos,circ_brev...}
Brian Cain [Thu, 1 Jul 2021 03:44:27 +0000 (22:44 -0500)]
[hexagon] Add {hvx,}hexagon_{protos,circ_brev...}

Add definitions for Hexagon, Hexagon circular/bit-reverse and HVX
intrinsics.

3 years ago[Compiler-rt] Add delete for noncopyable
theidexisted [Thu, 1 Jul 2021 03:48:23 +0000 (20:48 -0700)]
[Compiler-rt] Add delete for noncopyable

Reviewed By: vitalybuka

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

3 years ago[gn build] Port 662c55442f17
LLVM GN Syncbot [Thu, 1 Jul 2021 03:45:41 +0000 (03:45 +0000)]
[gn build] Port 662c55442f17

3 years ago[GWP_ASAN] Enable ARM tests
Vitaly Buka [Wed, 30 Jun 2021 21:46:03 +0000 (14:46 -0700)]
[GWP_ASAN] Enable ARM tests

Reviewed By: hctim

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

3 years ago[scudo] GWP_ASAN runs on untagged pointers
Vitaly Buka [Wed, 30 Jun 2021 21:42:41 +0000 (14:42 -0700)]
[scudo] GWP_ASAN runs on untagged pointers

It's already covered by multiple tests, but to trigger
this path we need MTE+GWP which disabled.

Reviewed By: hctim, pcc

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

3 years ago[ORC] Rename TargetProcessControl to ExecutorProcessControl. NFC.
Lang Hames [Thu, 1 Jul 2021 01:53:18 +0000 (11:53 +1000)]
[ORC] Rename TargetProcessControl to ExecutorProcessControl. NFC.

This is a first step towards consistently using the term 'executor' for the
process that executes JIT'd code. I've opted for 'executor' as the preferred
term over 'target' as target is already heavily overloaded ("the target
machine for the executor" is much clearer than "the target machine for the
target").

3 years ago[Coroutine] Recommit Add statistics for the number of elided coroutine
Chuanqi Xu [Thu, 1 Jul 2021 02:59:57 +0000 (10:59 +0800)]
[Coroutine] Recommit Add statistics for the number of elided coroutine

Now we lack a benchmark to measure the performance change for each
commit.
Since coro elide is the main optimization in coroutine module, I wonder
it may be an estimation to count the number of elided coroutine in
private code bases.
e.g., for a certain commit, if we found that the number of elided goes
down, we could find it before the commit check-in.

Reviewed By: lxfind

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

3 years ago[llvm-objdump/mac] Print symbols at the same address deterministically
Jez Ng [Thu, 1 Jul 2021 02:38:07 +0000 (22:38 -0400)]
[llvm-objdump/mac] Print symbols at the same address deterministically

By using stable_sort.

Added a test case which previously failed when expensive checks were
enabled.

Reviewed By: MaskRay

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

3 years ago[Bazel] add missing load to submodule example
Geoffrey Martin-Noble [Thu, 1 Jul 2021 00:52:27 +0000 (17:52 -0700)]
[Bazel] add missing load to submodule example

I missed this in https://reviews.llvm.org/D105245

Reviewed By: chandlerc

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

3 years ago[clang][AArch64][SVE] Handle PRValue under VLAT <-> VLST cast
Jun Ma [Tue, 29 Jun 2021 10:04:28 +0000 (18:04 +0800)]
[clang][AArch64][SVE] Handle PRValue under VLAT <-> VLST cast

This change fixes the crash that PRValue cannot be handled by
EmitLValue.

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

3 years ago[AArch64][SVEIntrinsicOpts] Convect cntb/h/w/d to vscale intrinsic or constant.
Jun Ma [Fri, 18 Jun 2021 03:55:01 +0000 (11:55 +0800)]
[AArch64][SVEIntrinsicOpts] Convect cntb/h/w/d to vscale intrinsic or constant.

As is mentioned above

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

3 years ago[mlir][tensor] Add tensor.dim operation
Matthias Springer [Thu, 1 Jul 2021 00:58:48 +0000 (09:58 +0900)]
[mlir][tensor] Add tensor.dim operation

* Split memref.dim into two operations: memref.dim and tensor.dim. Both ops have the same builder interface and op argument names, so that they can be used with templates in patterns that apply to both tensors and memrefs (e.g., some patterns in Linalg).
* Add constant materializer to TensorDialect (needed for folding in affine.apply etc.).
* Remove some MemRefDialect dependencies, make some explicit.

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

3 years ago[AArch64] Remove unneeded ExternalSymbolSDNode code for machine constraint "S". NFC
Fangrui Song [Thu, 1 Jul 2021 00:52:55 +0000 (17:52 -0700)]
[AArch64] Remove unneeded ExternalSymbolSDNode code for machine constraint "S". NFC

ExternalSymbolSDNode is implicitly generated libcalls but with an address taking
operation we cannot reference an ExternalSymbolSDNode.

3 years agoAdd a target triple to fix failures on MS build bots.
Richard Smith [Thu, 1 Jul 2021 00:25:55 +0000 (17:25 -0700)]
Add a target triple to fix failures on MS build bots.

-ast-dump=json tries to mangle every declaration, and under the MS ABI
there are still a few things we can't mangle, which caused this test to
assert.

3 years agoRevert "[libomptarget] [amdgpu] Fix default setting of max flat workgroup size"
Dhruva Chakrabarti [Thu, 1 Jul 2021 00:08:29 +0000 (17:08 -0700)]
Revert "[libomptarget] [amdgpu] Fix default setting of max flat workgroup size"

This reverts commit 2240b41ee4f30fe938975677a0a5a2c5c26d271b.
A value of 0 for KernDescVal WG_Size implies it is unknown, so it should be
set to the default. The above change was made without this assumption.

Reviewed By: JonChesterfield

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

3 years agoReapply "[M68k][GloballSel] Formal arguments lowering in IRTranslator"
Min-Yih Hsu [Thu, 1 Jul 2021 00:12:47 +0000 (17:12 -0700)]
Reapply "[M68k][GloballSel] Formal arguments lowering in IRTranslator"

Implementation of formal arguments lowering in the IRTranslator for the
M68k backend

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

3 years agoFix test following Clang change ef227b3.
Richard Smith [Thu, 1 Jul 2021 00:11:32 +0000 (17:11 -0700)]
Fix test following Clang change ef227b3.

3 years ago[Bazel] Rework LLVM target selection
Geoffrey Martin-Noble [Mon, 28 Jun 2021 20:09:48 +0000 (13:09 -0700)]
[Bazel] Rework LLVM target selection

This patch introduces a custom rule for expanding the LLVM target
enumeration .def files. This provides a slightly cleaner API for these
rules, but is mostly to permit selects to be used when determining which
LLVM targets to build. Right now the target list is generated at Bazel
configure time, but this will allows us to add functionality to also
control which targets are built based on config settings.

Tested: Ran `bazel test --config=rbe ... @llvm-project//...`

Reviewed By: chandlerc

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

3 years ago[Bazel] Update README with examples
Geoffrey Martin-Noble [Wed, 30 Jun 2021 23:46:55 +0000 (16:46 -0700)]
[Bazel] Update README with examples

Reviewed By: chandlerc

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

3 years ago[mlir][vector] Extend vector distribution to all elementwise and contract
thomasraoux [Wed, 30 Jun 2021 23:22:31 +0000 (16:22 -0700)]
[mlir][vector] Extend vector distribution to all elementwise and contract

Uses elementwise interface to generalize canonicalization pattern and add a new
pattern for vector.contract case.

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

3 years ago[InstCombine] fold icmp ult of offset value with constant
Sanjay Patel [Wed, 30 Jun 2021 21:27:10 +0000 (17:27 -0400)]
[InstCombine] fold icmp ult of offset value with constant

This is one sibling of the fold added with c7b658aeb526 .

(X + C2) <u C --> X >s ~C2 (if C == C2 + SMIN)
I'm still not sure how to describe it best, but we're
translating 2 constants from an unsigned range comparison
to signed because that eliminates the offset (add) op.

This could be extended to handle the more general (non-constant)
pattern too:
https://alive2.llvm.org/ce/z/K-fMBf

  define i1 @src(i8 %a, i8 %c2) {
    %t = add i8 %a, %c2
    %c = add i8 %c2, 128 ; SMIN
    %ov = icmp ult i8 %t, %c
    ret i1 %ov
  }

  define i1 @tgt(i8 %a, i8 %c2) {
    %not_c2 = xor i8 %c2, -1
    %ov = icmp sgt i8 %a, %not_c2
    ret i1 %ov
  }

3 years ago[InstCombine][test] add tests for icmp ult with constant and offset; NFC
Sanjay Patel [Wed, 30 Jun 2021 21:10:54 +0000 (17:10 -0400)]
[InstCombine][test] add tests for icmp ult with constant and offset; NFC

This is the 'ult' sibling pattern for:
c7b658aeb526c3e6

3 years ago[lld-macho] Only enable `__DATA_CONST` for newer platforms
Jez Ng [Wed, 30 Jun 2021 22:55:38 +0000 (18:55 -0400)]
[lld-macho] Only enable `__DATA_CONST` for newer platforms

Matches ld64.

Reviewed By: #lld-macho, alexander-shaposhnikov

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

3 years ago[lld-macho] -section_rename should work on synthetic sections too
Jez Ng [Wed, 30 Jun 2021 22:55:36 +0000 (18:55 -0400)]
[lld-macho] -section_rename should work on synthetic sections too

Previously, we only applied the renames to
ConcatOutputSections.

Reviewed By: #lld-macho, thakis

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

3 years ago[libc][NFC] Remove few deprecated FPUtil header files and test patterns.
Siva Chandra Reddy [Wed, 30 Jun 2021 06:28:42 +0000 (06:28 +0000)]
[libc][NFC] Remove few deprecated FPUtil header files and test patterns.

Few tests have been converted to the new test patterns to facilitate
this.

3 years ago[LiveDebugValues][InstrRef][2/2] Emit entry value variable locations
Jeremy Morse [Wed, 30 Jun 2021 16:48:19 +0000 (17:48 +0100)]
[LiveDebugValues][InstrRef][2/2] Emit entry value variable locations

This patch adds support to the instruction-referencing LiveDebugValues
implementation for emitting entry values. The instruction referencing
implementations tracking by value rather than location means that we can
get around two of the issues with VarLocs. DBG_VALUE instructions that
re-assign the same value to a variable are no longer a problem, because we
can "see through" to the value being assigned. We also don't need to do
anything special during the dataflow stages: the "variable value problem"
doesn't need to know whether a value is available most of the time, and the
times it deoes need to know are always when entry values need to be
terminated.

The patch modifies the "TransferTracker" class, adding methods to identify
when a variable ias an entry value candidate, and when a machine value is
an entry value. recoverAsEntryValue tests these two things and emits an
entry-value expression if they're true. It's used when we clobber or
otherwise lose a value and can't find a replacement location for the value
it contained.

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

3 years agoGlobalISel: Use LLT in memory legality queries
Matt Arsenault [Wed, 9 Jun 2021 00:22:45 +0000 (20:22 -0400)]
GlobalISel: Use LLT in memory legality queries

This enables proper lowering of non-byte sized loads. We still aren't
faithfully preserving memory types everywhere, so the legality checks
still only consider the size.

3 years ago[libomptarget][nfc] Replace out arguments with struct return
Jon Chesterfield [Wed, 30 Jun 2021 21:40:06 +0000 (22:40 +0100)]
[libomptarget][nfc] Replace out arguments with struct return

A step towards making this function adequately self contained that it
can be tested easily. No functional change intended here, left variable
names unchanged.

Reviewed By: ronlieb

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

3 years ago[libc++] graph_header_deps.py: Detect files that include themselves.
Arthur O'Dwyer [Wed, 30 Jun 2021 21:37:43 +0000 (17:37 -0400)]
[libc++] graph_header_deps.py: Detect files that include themselves.

This wasn't happening before, which led to one slipping in.

3 years ago[Clang] allow overriding -fbasic-block-sections
Artem Belevich [Wed, 30 Jun 2021 20:12:57 +0000 (13:12 -0700)]
[Clang] allow overriding -fbasic-block-sections

We should not error out on non-x86 targets if `-fbasic-block-sections=none` is in effect.

Also, filter it out for GPU-side compilations, as we do with other options not
supported on the GPU.

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

3 years agoAdd dumping support for RequiresExpr.
Richard Smith [Wed, 30 Jun 2021 21:05:34 +0000 (14:05 -0700)]
Add dumping support for RequiresExpr.

In passing, fix an ast-print bug that inserted a spurious extra `;`
after a concept definition.