platform/upstream/llvm.git
2 years agoFix typo in file name; NFC
Aaron Ballman [Thu, 24 Feb 2022 20:41:25 +0000 (15:41 -0500)]
Fix typo in file name; NFC

2 years agoAdd -Wno-strict-prototypes to C tests; NFC
Aaron Ballman [Thu, 24 Feb 2022 20:30:30 +0000 (15:30 -0500)]
Add -Wno-strict-prototypes to C tests; NFC

This patch adds -Wno-strict-prototypes to all of the test cases that
use functions without prototypes, but not as the primary concern of the
test. e.g., attributes testing whether they can/cannot be applied to a
function without a prototype, etc.

This is done in preparation for enabling -Wstrict-prototypes by
default.

2 years agoUse functions with prototypes when appropriate; NFC
Aaron Ballman [Thu, 24 Feb 2022 20:27:07 +0000 (15:27 -0500)]
Use functions with prototypes when appropriate; NFC

A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the final batch of tests being updated to add prototypes,
hopefully.

2 years ago[flang] Simple array assignment lowering
Valentin Clement [Thu, 24 Feb 2022 20:09:40 +0000 (21:09 +0100)]
[flang] Simple array assignment lowering

This patch handles lowering of simple array assignment.

```
a(:) = 10
```

or

```
a(1) = 1
```

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld, schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[AMDGPU] Divergence-driven instruction selection for bitreverse
Jay Foad [Mon, 14 Feb 2022 09:51:56 +0000 (09:51 +0000)]
[AMDGPU] Divergence-driven instruction selection for bitreverse

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

2 years ago[ELF] Simplify --fortran-common. NFC
Fangrui Song [Thu, 24 Feb 2022 20:21:40 +0000 (12:21 -0800)]
[ELF] Simplify --fortran-common. NFC

2 years ago[ELF] De-template Symbol::resolveLazy. NFC
Fangrui Song [Thu, 24 Feb 2022 20:20:05 +0000 (12:20 -0800)]
[ELF] De-template Symbol::resolveLazy. NFC

2 years ago[flang] add semantics tests for sync team
Damian Rouson [Fri, 12 Nov 2021 00:24:01 +0000 (16:24 -0800)]
[flang] add semantics tests for sync team

Test a range of acceptable forms of SYNC TEAM statements,
including combinations with and without the stat-variable
and errmsg-variable present.  Also test that several invalid
forms of SYNC TEAM call generate the correct error messages.

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

2 years agoRevert "[OPENMP]Fix PR50347: Mapping of global scope deep object fails."
Alexey Bataev [Thu, 24 Feb 2022 20:04:39 +0000 (12:04 -0800)]
Revert "[OPENMP]Fix PR50347: Mapping of global scope deep object fails."

This reverts commit 638938117aeae5518d6cacd066ffd9830ef4fc9a. Need to
fix reported fail https://lab.llvm.org/buildbot/#/builders/193/builds/7496

2 years ago[OPENMP]Fix PR50347: Mapping of global scope deep object fails.
Alexey Bataev [Thu, 1 Jul 2021 11:16:56 +0000 (04:16 -0700)]
[OPENMP]Fix PR50347: Mapping of global scope deep object fails.

Changed the we handle llvm::Constants in sizes arrays. ConstExprs and
GlobalValues cannot be used as initializers, need to put them at the
runtime, otherwise there wight be the compilation errors.

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

2 years ago[CMake][WinMsvc] Replace MSVC_BASE/WINSDK_BASE with LLVM_WINSYSROOT
Yuanfang Chen [Thu, 24 Feb 2022 19:46:37 +0000 (11:46 -0800)]
[CMake][WinMsvc] Replace MSVC_BASE/WINSDK_BASE with LLVM_WINSYSROOT

- Using LLVM_WINSYSROOT would pick up DIA SDK path automatically,
  otherwise llvm-pdbutil has no DIA support.
- Add MSVC_VER to specify VC tools version.
- Make MSVC_VER/WINSDK_VER optional. If not specified, use the highest
  version number like the driver does.

Reviewed By: thakis

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

2 years ago[DAG] Attempt to fold bswap(shl(x,c)) -> zext(bswap(trunc(shl(x,c-bw/2))))
Simon Pilgrim [Thu, 24 Feb 2022 19:18:37 +0000 (19:18 +0000)]
[DAG] Attempt to fold bswap(shl(x,c)) -> zext(bswap(trunc(shl(x,c-bw/2))))

If the shl is at least half the bitwidth (i.e. the lower half of the bswap source is zero), then we can reduce the shift and perform the bswap at half the bitwidth and just zero extend.

Based off PR51391 + PR53867

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

2 years ago[AArch64] Regenerate dp1.ll test, NFC
David Green [Thu, 24 Feb 2022 19:33:45 +0000 (19:33 +0000)]
[AArch64] Regenerate dp1.ll test, NFC

The old check lines were not showing enough congtext to show issues.
Regenerate the test with theua auto-check lines to be clearer.

2 years ago[ELF] Set config->exportDynamic to true if config->shared. NFC
Fangrui Song [Thu, 24 Feb 2022 19:31:58 +0000 (11:31 -0800)]
[ELF] Set config->exportDynamic to true if config->shared. NFC

2 years ago[AMDGPU] Extend SILoadStoreOptimizer to handle global stores
Stanislav Mekhanoshin [Tue, 22 Feb 2022 20:26:41 +0000 (12:26 -0800)]
[AMDGPU] Extend SILoadStoreOptimizer to handle global stores

TODO: merge flat load/stores.
TODO: merge flat with global promoting to flat.

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

2 years ago[flang] add semantics test for sync memory
Damian Rouson [Fri, 12 Nov 2021 00:22:38 +0000 (16:22 -0800)]
[flang] add semantics test for sync memory

Test a range of acceptable forms of SYNC MEMORY statements,
including combinations with and without the stat-variable
and errmsg-variable present.  Also test that several invalid
forms of SYNC MEMORY call generate the correct error messages.

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

2 years ago[AArch64] Async unwind - Always place the first LDP at the end when ReverseCSRRestore...
Momchil Velikov [Thu, 24 Feb 2022 18:36:37 +0000 (18:36 +0000)]
[AArch64] Async unwind - Always place the first LDP at the end when ReverseCSRRestoreSeq is true

This patch is in preparation for the async unwind CFI.

Put the first `LDP` the end, so that the load-store optimizer can run
and merge the `LDP` and the `ADD` into a post-index `LDP`.

Do this always and as early as at the time of the initial creation of
the CSR restore instructions, even if that `LDP` is not guaranteed to
be mergeable with a subsequent `SP` increment.

This greatly simplifies the CFI generation for prologue, as otherwise
we have to take extra steps to ensure reordering does not cross CFI
instructions.

Reviewed By: danielkiss

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

2 years ago[AMDGPU] Fix combined MMO in load-store merge
Stanislav Mekhanoshin [Wed, 23 Feb 2022 00:33:06 +0000 (16:33 -0800)]
[AMDGPU] Fix combined MMO in load-store merge

Loads and stores can be out of order in the SILoadStoreOptimizer.
When combining MachineMemOperands of two instructions operands are
sent in the IR order into the combineKnownAdjacentMMOs. At the
moment it picks the first operand and just replaces its offset and
size. This essentially loses alignment information and may generally
result in an incorrect base pointer to be used.

Use a base pointer in memory addresses order instead and only adjust
size.

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

2 years ago[X86] Introduce x86-cmov-converter-force-all
Amir Ayupov [Wed, 16 Feb 2022 01:27:31 +0000 (17:27 -0800)]
[X86] Introduce x86-cmov-converter-force-all

Introduce an option to expand all CMOV groups into hammocks, matching GCC's
`-fno-if-conversion2` flag. The motivation is to leave CMOV conversion
opportunities to a binary optimizer that can make the decision based on branch
misprediction rate (available e.g. in Intel's LBR).

Reviewed By: MaskRay, skan

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

2 years ago[tblgen] Compress CompositeSequences to 1/8th of its size. NFCI.
Benjamin Kramer [Thu, 24 Feb 2022 18:30:50 +0000 (19:30 +0100)]
[tblgen] Compress CompositeSequences to 1/8th of its size. NFCI.

2 years ago[RISCV] Add Zbb RUN lines to neg-abs.ll.
Craig Topper [Thu, 24 Feb 2022 18:15:07 +0000 (10:15 -0800)]
[RISCV] Add Zbb RUN lines to neg-abs.ll.

2 years ago[AArch64] Async unwind - helper functions to decide on CFI emission
Momchil Velikov [Thu, 24 Feb 2022 17:36:19 +0000 (17:36 +0000)]
[AArch64] Async unwind - helper functions to decide on CFI emission

Reviewed By: efriedma

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

2 years ago[analyzer] Just use default capture after 7fd60ee6e0a87957a718297a4a42d9881fc561e3
Fangrui Song [Thu, 24 Feb 2022 18:06:11 +0000 (10:06 -0800)]
[analyzer] Just use default capture after 7fd60ee6e0a87957a718297a4a42d9881fc561e3

2 years ago[mlir][memref] Add transformation to do loop multi-buffering
Thomas Raoux [Wed, 16 Feb 2022 07:49:32 +0000 (23:49 -0800)]
[mlir][memref] Add transformation to do loop multi-buffering

This transformation is useful to break dependency between consecutive loop
iterations by increasing the size of a temporary buffer. This is usually
combined with heavy software pipelining.

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

2 years ago[RISCV] Update some tests to use floating point ABI where it makes sense.
Craig Topper [Thu, 24 Feb 2022 17:23:14 +0000 (09:23 -0800)]
[RISCV] Update some tests to use floating point ABI where it makes sense.

Trying to reduce the diffs from D118333 for cases where it makes
more sense to use an FP ABI.

Reviewed By: asb, kito-cheng

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

2 years ago[AArch64] Async unwind - do not schedule frame setup/destroy
Momchil Velikov [Thu, 24 Feb 2022 16:08:14 +0000 (16:08 +0000)]
[AArch64] Async unwind  - do not schedule frame setup/destroy

The PostRA scheduler can reorder non-CFI instructions in a way that
makes the unwind info not instruction precise.

Reviewed By: efriedma

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

2 years ago[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X).
Craig Topper [Thu, 24 Feb 2022 17:18:48 +0000 (09:18 -0800)]
[RISCV] Fold (sext_inreg (fmv_x_anyexth X), i16) -> (fmv_x_signexth X).

Add a new ISD opcode to represent the sign extending behavior of
vmv.x.h. Keep the previous anyext opcode to allow the existing
(fmv_x_anyexth (fmv_h_x X)) combine to keep working without needing
to generate a sign extend.

For fmv.x.w we are able to match the sext_inreg in an isel pattern,
but a 16-bit sext_inreg is lowered to a shift pair before isel. This
seemed like a larger match than we should do in isel.

Reviewed By: asb

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

2 years ago[flang] Lower allocatable assignment for scalar
Valentin Clement [Thu, 24 Feb 2022 17:11:41 +0000 (18:11 +0100)]
[flang] Lower allocatable assignment for scalar

Add lowering for simple assignement on allocatable
scalars.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D120483

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[clang][dataflow] Update StructValue child when assigning a value
Stanislav Gatev [Wed, 23 Feb 2022 15:39:26 +0000 (15:39 +0000)]
[clang][dataflow] Update StructValue child when assigning a value

When assigning a value to a storage location of a struct member we
need to also update the value in the corresponding `StructValue`.

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D120414

2 years ago[clang-tidy] Remove opencl-c.h inclusion from tests
Sven van Haastregt [Thu, 24 Feb 2022 16:28:52 +0000 (16:28 +0000)]
[clang-tidy] Remove opencl-c.h inclusion from tests

After D120254 some clang-tidy tests started failing on release builds.

clang-tidy has been using the `-fdeclare-opencl-builtins` functionality
since this became the default in clang, so there is no need to include
`opencl-c.h`.

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

2 years ago[SDAG] remove shift that is redundant with part of funnel shift
Sanjay Patel [Thu, 24 Feb 2022 16:09:57 +0000 (11:09 -0500)]
[SDAG] remove shift that is redundant with part of funnel shift

This is the SDAG translation of D120253 :
https://alive2.llvm.org/ce/z/qHpmNn

The SDAG nodes can have different operand types than the result value.
We can see an example of that with AArch64 - the funnel shift amount
is an i64 rather than i32.

We may need to make that match even more flexible to handle
post-legalization nodes, but I have not stepped into that yet.

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

2 years ago[flang] Handle allocatable dummy arguments
Valentin Clement [Thu, 24 Feb 2022 16:16:02 +0000 (17:16 +0100)]
[flang] Handle allocatable dummy arguments

This patch handles allocatable dummy argument lowering
in function and subroutines.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years agoDisable Mailgun click tracking
Anton Korobeynikov [Thu, 24 Feb 2022 16:03:21 +0000 (19:03 +0300)]
Disable Mailgun click tracking

2 years agoRemove useless RUN lines in the middle of the file and pipe to FileCheck; NFC
Aaron Ballman [Thu, 24 Feb 2022 16:00:40 +0000 (11:00 -0500)]
Remove useless RUN lines in the middle of the file and pipe to FileCheck; NFC

2 years ago[OpenMP] Make section variable external to prevent collisions
Joseph Huber [Thu, 24 Feb 2022 15:24:39 +0000 (10:24 -0500)]
[OpenMP] Make section variable external to prevent collisions

Summary:
We use a section to embed offloading code into the host for later
linking. This is normally unique to the translation unit as it is thrown
away during linking. However, if the user performs a relocatable link
the sections will be merged and we won't be able to access the files
stored inside. This patch changes the section variables to have external
linkage and a name defined by the section name, so if two sections are
combined during linking we get an error.

2 years ago[InstCombine] try harder to preserve 'nsz' in fneg-of-select transform
Sanjay Patel [Thu, 24 Feb 2022 15:20:18 +0000 (10:20 -0500)]
[InstCombine] try harder to preserve 'nsz' in fneg-of-select transform

The corner case where 'nsz' needs to be removed is very narrow
as discussed here:
https://reviews.llvm.org/rG3cdd05e519dd

If the select condition is not undef, there's no problem with
propagating 'nsz':
https://alive2.llvm.org/ce/z/4GWJdq

2 years ago[InstCombine] add test for fneg of select with FMF; NFC
Sanjay Patel [Thu, 24 Feb 2022 15:19:23 +0000 (10:19 -0500)]
[InstCombine] add test for fneg of select with FMF; NFC

2 years ago[MIRParser] Diagnose too large align values in MachineMemOperands
Jay Foad [Wed, 23 Feb 2022 11:35:55 +0000 (11:35 +0000)]
[MIRParser] Diagnose too large align values in MachineMemOperands

When parsing MachineMemOperands, MIRParser treated the "align" keyword
the same as "basealign". Really "basealign" should specify the
alignment of the MachinePointerInfo base value, and "align" should
specify the alignment of that base value plus the offset.

This worked OK when the specified alignment was no larger than the
alignment of the offset, but in cases like this it just caused
confusion:

    STW killed %18, 4, %stack.1.ap2.i.i :: (store (s32) into %stack.1.ap2.i.i + 4, align 8)

MIRPrinter would never have printed this, with an offset of 4 but an
align of 8, so it must have been written by hand. MIRParser would
interpret "align 8" as "basealign 8", but I think it is better to give
an error and force the user to write "basealign 8" if that is what they
really meant.

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

Change-Id: I7eeeefc55c2df3554ba8d89f8809a2f45ada32d8

2 years ago[mlir][emitc] Add a variable op
Marius Brehler [Thu, 17 Feb 2022 09:57:09 +0000 (09:57 +0000)]
[mlir][emitc] Add a variable op

This adds a variable op, emitted as C/C++ locale variable, which can be
used if the `emitc.constant` op is not sufficient.

As an example, the canonicalization pass would transform
```mlir
%0 = "emitc.constant"() {value = 0 : i32} : () -> i32
%1 = "emitc.constant"() {value = 0 : i32} : () -> i32
%2 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32>
%3 = emitc.apply "&"(%1) : (i32) -> !emitc.ptr<i32>
emitc.call "write"(%2, %3) : (!emitc.ptr<i32>, !emitc.ptr<i32>) -> ()
```
into
```mlir
%0 = "emitc.constant"() {value = 0 : i32} : () -> i32
%1 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32>
%2 = emitc.apply "&"(%0) : (i32) -> !emitc.ptr<i32>
emitc.call "write"(%1, %2) : (!emitc.ptr<i32>, !emitc.ptr<i32>) -> ()
```
resulting in pointer aliasing, as %1 and %2 point to the same address.
In such a case, the `emitc.variable` operation can be used instead.

Reviewed By: jpienaar

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

2 years ago[clang] Warn on unqualified calls to std::move and std::forward
Corentin Jabot [Thu, 24 Feb 2022 15:00:44 +0000 (07:00 -0800)]
[clang] Warn on unqualified calls to std::move and std::forward

This adds a diagnostic when an unqualified call is resolved
to std::move or std::forward.

This follows some C++ committee discussions where some
people where concerns that this might be an usual anti pattern
particularly britle worth warning about - both because move
is a common name and because these functions accept any values.

This warns inconditionnally of whether the current context is in
std:: or not, as implementations probably want to always qualify
these calls too, to avoid triggering adl accidentally.

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

2 years ago[OpenCL] Handle TypeExtensions in OpenCLBuiltinFileEmitter
Sven van Haastregt [Thu, 24 Feb 2022 15:17:24 +0000 (15:17 +0000)]
[OpenCL] Handle TypeExtensions in OpenCLBuiltinFileEmitter

Until now, any types that had TypeExtensions attached to them were not
guarded with those extensions.  Extend the OpenCLBuiltinFileEmitter
such that all required extensions are emitted for the types of a
builtin function.

The `clang-tblgen -gen-clang-opencl-builtin-tests` emitter will now
produce e.g.:

  #if defined(cl_khr_fp16) && defined(cl_khr_fp64)
  half8 test11802_convert_half8_rtp(double8 arg1) {
    return convert_half8_rtp(arg1);
  }
  #endif // TypeExtension

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

2 years ago[AArch64] Simplify and extend tests added in 0c5ea01b20623e40.
Florian Hahn [Thu, 24 Feb 2022 14:51:43 +0000 (14:51 +0000)]
[AArch64] Simplify and extend tests added in 0c5ea01b20623e40.

2 years ago[X86] LowerRotate - enable v8i16 ROTL/ROTR on all pre-SSE41 targets
Simon Pilgrim [Thu, 24 Feb 2022 14:14:08 +0000 (14:14 +0000)]
[X86] LowerRotate - enable v8i16 ROTL/ROTR on all pre-SSE41 targets

We're still better off expanding this once we have PMOVZX

2 years ago[X86] SimplifyDemandedVectorEltsForTargetNode - add X86ISD::ANDNP handling
Simon Pilgrim [Thu, 24 Feb 2022 13:51:51 +0000 (13:51 +0000)]
[X86] SimplifyDemandedVectorEltsForTargetNode - add X86ISD::ANDNP handling

2 years ago[mlir][OpenMP][NFC] Remove unused binary operator enum
Shraiysh Vaishay [Thu, 24 Feb 2022 13:30:40 +0000 (19:00 +0530)]
[mlir][OpenMP][NFC] Remove unused binary operator enum

This patch removes binary operator enum which was introduced with `omp.atomic.update`. Now the update operation handles update in a region so this is no longer required.

Reviewed By: kiranchandramohan

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

2 years ago[Symbolizer] Move ctor/dtor into .cpp file
Benjamin Kramer [Thu, 24 Feb 2022 13:19:19 +0000 (14:19 +0100)]
[Symbolizer] Move ctor/dtor into .cpp file

On some standard library configurations these have a dependency on the
complete type of SymbolizableModule. They also do a lot of
copying/freeing so no point in inlining them.

2 years ago[mlir] Document creation of Python bindings for a dialect
Alex Zinenko [Tue, 11 Jan 2022 10:56:21 +0000 (11:56 +0100)]
[mlir] Document creation of Python bindings for a dialect

Documentation exists about the details of the API but is missing a
description of the overall structure per dialect.

Reviewed By: shabalin

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

2 years ago[mlir][linalg] Cast back to the original type after making linalg.generic outputs...
Benjamin Kramer [Thu, 24 Feb 2022 12:34:04 +0000 (13:34 +0100)]
[mlir][linalg] Cast back to the original type after making linalg.generic outputs more static

This codepath was entirely untested.

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

2 years ago[NFC][SROA] Update tests for D113520
Roman Lebedev [Thu, 24 Feb 2022 05:47:14 +0000 (08:47 +0300)]
[NFC][SROA] Update tests for D113520

2 years agoCleanup includes: ProfileData
serge-sans-paille [Wed, 23 Feb 2022 21:18:20 +0000 (22:18 +0100)]
Cleanup includes: ProfileData

Estimation of the impact on preprocessor output:

before: 1067349756
after: 1065940348

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120434

2 years agoCleanup include: DebugInfo/Symbolize
serge-sans-paille [Wed, 23 Feb 2022 21:16:39 +0000 (22:16 +0100)]
Cleanup include: DebugInfo/Symbolize

Estimation of the impact on preprocessor output
after: 1067349756
before:1067487786

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120433

2 years ago[AMDGPU] Fix permissions on test files
Jay Foad [Thu, 24 Feb 2022 12:17:34 +0000 (12:17 +0000)]
[AMDGPU] Fix permissions on test files

2 years ago[AArch64] Add vector select test showing redundant operations.
Florian Hahn [Thu, 24 Feb 2022 12:12:21 +0000 (12:12 +0000)]
[AArch64] Add vector select test showing redundant operations.

The tests show sub-optimal lowering of extend/cmp/select chains starting
with v16i8 vectors.

2 years ago[NFC][RISCV] Reuse ISD::NodeType in float extension
Shao-Ce SUN [Thu, 24 Feb 2022 03:14:43 +0000 (11:14 +0800)]
[NFC][RISCV] Reuse ISD::NodeType in float extension

Reviewed By: asb

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

2 years ago[OpenCL] opencl-c.h: remove arg names for image builtins
Sven van Haastregt [Thu, 24 Feb 2022 11:52:32 +0000 (11:52 +0000)]
[OpenCL] opencl-c.h: remove arg names for image builtins

This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the identifiers "image",
"image_array", "coord", "sampler", "sample", "gradientX", "gradientY",
"lod", and "color".

Continues the direction set out in D119560.

2 years ago[lldb] Fix macos build for D120425
Pavel Labath [Thu, 24 Feb 2022 11:47:17 +0000 (12:47 +0100)]
[lldb] Fix macos build for D120425

2 years ago[mlir][LLVM] Allow scalable vectors in ShuffleVectorOp
Javier Setoain [Thu, 27 Jan 2022 13:36:16 +0000 (13:36 +0000)]
[mlir][LLVM] Allow scalable vectors in ShuffleVectorOp

The current implementation of ShuffleVectorOp assumes all vectors are
scalable. LLVM IR allows shufflevector operations on scalable vectors,
and the current translation between LLVM Dialect and LLVM IR does the
rigth thing when the shuffle mask is all zeroes. This is required to
do a splat operation on a scalable vector, but it doesn't make sense
for scalable vectors outside of that operation, i.e.: with non-all zero
masks.

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

2 years ago[X86] LowerShiftByScalarVariable - use getSplatSourceVector for vXi8 shift expansion
Simon Pilgrim [Thu, 24 Feb 2022 11:12:52 +0000 (11:12 +0000)]
[X86] LowerShiftByScalarVariable - use getSplatSourceVector for vXi8 shift expansion

Using getSplatValue causes poor codegen due to not always being able to remove the EXTRACT_VECTOR_ELT created inside getSplatValue.

The vXi16 shifts/rotates are still showing occasional regressions but vXi8 is a definite improvement.

2 years agoRevert "[RISCV] add the MC layer support of Zfinx extension"
Nikita Popov [Thu, 24 Feb 2022 11:12:05 +0000 (12:12 +0100)]
Revert "[RISCV] add the MC layer support of Zfinx extension"

This reverts commit 7798ecca9c3db42241169d31fea4fb820ed01830.

As reported in https://reviews.llvm.org/D93298#3331641 and
following, this causes assertion failures with inline assembly.

2 years ago[NFC][clang] Simplify `isOneOf` function
Shao-Ce SUN [Thu, 20 Jan 2022 02:58:26 +0000 (10:58 +0800)]
[NFC][clang] Simplify `isOneOf` function

Reviewed By: tmatheson

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

2 years ago[lldb] One more fix for the MonitorChildProcess patch (D120425)
Pavel Labath [Thu, 24 Feb 2022 11:05:42 +0000 (12:05 +0100)]
[lldb] One more fix for the MonitorChildProcess patch (D120425)

2 years ago[mlir][linalg][bufferize] Always bufferize in-place with "out" operands by default
Matthias Springer [Thu, 24 Feb 2022 10:48:40 +0000 (19:48 +0900)]
[mlir][linalg][bufferize] Always bufferize in-place with "out" operands by default

In D115022, we introduced an optimization where OpResults of a `linalg.generic` may bufferize in-place with an "in" OpOperand if the corresponding "out" OpOperand is not used in the computation.

This optimization can lead to unexpected behavior if the newly chosen OpOperand is in the same alias set as another OpOperand (that is used in the computation). In that case, the newly chosen OpOperand must bufferize out-of-place. This can be confusing to users, as always choosing the "out" OpOperand (regardless of whether it is used) would be expected when having the notion of "destination-passing style" in mind.

With this change, we go back to always bufferizing in-place with "out" OpOperands by default, but letting users override the behavior with a bufferization option.

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

2 years ago[lldb] Fix windows build for D120425
Pavel Labath [Thu, 24 Feb 2022 10:50:54 +0000 (11:50 +0100)]
[lldb] Fix windows build for D120425

2 years ago[flang][docs] Update the top "doc" page
Andrzej Warzynski [Thu, 17 Feb 2022 16:53:57 +0000 (16:53 +0000)]
[flang][docs] Update the top "doc" page

* Added a note about "Classic Flang"
* sorted entries in ToC

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

2 years ago[lldb/host] Remove monitor_signals argument from process monitoring functions
Pavel Labath [Tue, 22 Feb 2022 16:45:35 +0000 (17:45 +0100)]
[lldb/host] Remove monitor_signals argument from process monitoring functions

All current callers set the argument to false. monitor_signals=true used
to be used in the Process plugins (which needed to know when the
debugged process gets a signal), but this implementation has several
serious issues, which means that individual process plugins now
orchestrate the monitoring of debugged processes themselves.

This allows us to simplify the implementation (no need to play with
process groups), and the interface (we only catch fatal events, so the
callback is always called just once).

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

2 years ago[Sema] Silence unused variable warning in Release builds. NFC.
Benjamin Kramer [Thu, 24 Feb 2022 09:58:32 +0000 (10:58 +0100)]
[Sema] Silence unused variable warning in Release builds. NFC.

2 years ago[mlir][python] Support more types in IntegerAttr.value
rkayaith [Thu, 24 Feb 2022 09:21:40 +0000 (10:21 +0100)]
[mlir][python] Support more types in IntegerAttr.value

Previously only accessing values for `index` and signless int types
would work; signed and unsigned ints would hit an assert in
`IntegerAttr::getInt`. This exposes `IntegerAttr::get{S,U}Int` to the C
API and calls the appropriate function from the python bindings.

Reviewed By: ftynse

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

2 years ago[clang-format] Avoid inserting space after C++ casts.
Marek Kurdej [Tue, 22 Feb 2022 21:32:03 +0000 (22:32 +0100)]
[clang-format] Avoid inserting space after C++ casts.

Fixes https://github.com/llvm/llvm-project/issues/53876.

This is a solution for standard C++ casts: const_cast, dynamic_cast, reinterpret_cast, static_cast.

A general approach handling all possible casts is not possible without semantic information.
Consider the code:
```
static_cast<T>(*function_pointer_variable)(arguments);
```
vs.
```
some_return_type<T> (*function_pointer_variable)(parameters);
// Later used as:
function_pointer_variable = &some_function;
return function_pointer_variable(args);
```
In the latter case, it's not a cast but a variable declaration of a pointer to function.
Without knowing what `some_return_type<T>` is (and clang-format does not know it), it's hard to distinguish between the two cases. Theoretically, one could check whether "parameters" are types (not a cast) and "arguments" are value/expressions (a cast), but that might be inefficient (needs lots of lookahead).

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[sancov][sanitizer-common] Correct sanitizer coverage point
Xiaodong Liu [Thu, 24 Feb 2022 09:14:24 +0000 (17:14 +0800)]
[sancov][sanitizer-common] Correct sanitizer coverage point

Sanitizer coverage point should be the previous instruction PC of the
caller and the offset to the previous instruction might be different
on each CPU architecture.

Reviewed By: MaskRay

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

2 years ago[clang-format] Fix QualifierOrder breaking the code with requires clause.
Marek Kurdej [Mon, 21 Feb 2022 13:17:58 +0000 (14:17 +0100)]
[clang-format] Fix QualifierOrder breaking the code with requires clause.

Fixes https://github.com/llvm/llvm-project/issues/53962.

Given the config:
```
BasedOnStyle: LLVM
QualifierAlignment: Custom
QualifierOrder: ['constexpr', 'type']
```

The code:
```
template <typename F>
  requires std::invocable<F>
constexpr constructor();
```
was incorrectly formatted to:
```
template <typename F>
  requires
constexpr std::invocable<F> constructor();
```
because we considered `std::invocable<F> constexpr` as a type, not recognising the requires clause.

This patch avoids moving the qualifier across the boundary of the requires clause (checking `ClosesRequiresClause`).

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years ago[AArch64][AsmParser] Arch directives should set implied features.
Sander de Smalen [Thu, 24 Feb 2022 08:46:15 +0000 (08:46 +0000)]
[AArch64][AsmParser] Arch directives should set implied features.

When assembling for example an SVE instruction with the `.arch +sve2` directive,
+sve should be implied by setting +sve2, similar to what would happen if
one would pass the mattr=+sve2 flag on the command-line.

The AsmParser doesn't set the implied features, meaning that the SVE
instruction does not assemble. This patch fixes that.

Note that the same does not hold when disabling a feature. For example,
+nosve2 does not imply +nosve.

Reviewed By: c-rhodes

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

2 years ago[clang-format] Do not insert space after new/delete keywords in C function declarations
Luis Penagos [Thu, 24 Feb 2022 08:48:24 +0000 (09:48 +0100)]
[clang-format] Do not insert space after new/delete keywords in C function declarations

Fixes https://github.com/llvm/llvm-project/issues/46915.

Reviewed By: curdeius, HazardyKnusperkeks

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

2 years ago[libc++] Remove <chrono> include from <future>
Nikolas Klauser [Wed, 23 Feb 2022 22:07:07 +0000 (23:07 +0100)]
[libc++] Remove <chrono> include from <future>

Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

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

2 years ago[C++20][Modules][3/8] Initial handling for module partitions.
Iain Sandoe [Sun, 7 Feb 2021 01:00:33 +0000 (01:00 +0000)]
[C++20][Modules][3/8] Initial handling for module partitions.

This implements the parsing and recognition of module partition CMIs
and removes the FIXMEs in the parser.

Module partitions are recognised in the base computation of visibility,
however additional amendments to visibility follow in subsequent patches.

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

2 years ago[RISCV] Add schedule class for Zbm and Zbe extension
lian wang [Tue, 15 Feb 2022 06:17:33 +0000 (06:17 +0000)]
[RISCV] Add schedule class for Zbm and Zbe extension

Reviewed By: craig.topper

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

2 years ago[RISCV][NFC] Remove useless intrinsic function declare in test of Zbp extension
lian wang [Thu, 24 Feb 2022 01:57:10 +0000 (01:57 +0000)]
[RISCV][NFC] Remove useless intrinsic function declare in test of Zbp extension

Reviewed By: benshi001

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

2 years ago[libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple platforms
Martin Storsjö [Tue, 22 Feb 2022 10:28:08 +0000 (12:28 +0200)]
[libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple platforms

This fixes issue #45084 (https://llvm.org/PR45739).

Remove unnecessary trailing spaces after the "RUB" international
currency symbol (and after the plain number in some parts of the
put_long_double test).

Both of these test files are
`XFAIL: netbsd || linux || LIBCXX-WINDOWS-FIXME`, and then have some of
their test cases commented out when `__APPLE__`. This patch comments-in
those test cases and adjusts them all to work on Apple, while leaving the
test `XFAIL`ed on NetBSD, Linux, and Windows.

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

2 years ago[analyzer] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off builds
Fangrui Song [Thu, 24 Feb 2022 08:13:13 +0000 (00:13 -0800)]
[analyzer] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off builds

2 years ago[InstCombine] Canonicalize SPF to min/max intrinsics
Nikita Popov [Mon, 14 Feb 2022 16:18:07 +0000 (17:18 +0100)]
[InstCombine] Canonicalize SPF to min/max intrinsics

Now that integer min/max intrinsics have good support in both
InstCombine and other passes, start canonicalizing SPF min/max
to intrinsic min/max.

Once this sticks, we can stop matching SPF min/max in various
places, and can remove hacks we have for preventing infinite loops
and breaking of SPF canonicalization.

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

2 years agoRevert "[InstCombine] Remove one-use limitation from X-Y==0 fold"
Nikita Popov [Thu, 24 Feb 2022 07:50:40 +0000 (08:50 +0100)]
Revert "[InstCombine] Remove one-use limitation from X-Y==0 fold"

This reverts commit 65dc78d63ee2eb20fbed54401091f08a685ef8c1.

This caused a major code-size regression on tramp3d-v4, revert
until I can investigate.

2 years ago[mlir][SCF] Apply suggested ClangTidy fixes.
Adrian Kuegel [Thu, 24 Feb 2022 07:22:13 +0000 (08:22 +0100)]
[mlir][SCF] Apply suggested ClangTidy fixes.

2 years ago[BOLT] Support PC-relative relocations with addends
Maksim Panchenko [Thu, 24 Feb 2022 06:54:42 +0000 (22:54 -0800)]
[BOLT] Support PC-relative relocations with addends

PC-relative memory operand could reference a different object from
the one located at the target address, e.g. when a negative offset
is used. Check relocations for the real referenced object.

Reviewed By: rafauler

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

2 years ago[Driver][RISCV] Add missing rv64 test case
eopXD [Tue, 22 Feb 2022 03:20:02 +0000 (19:20 -0800)]
[Driver][RISCV] Add missing rv64 test case

Add missing test case. Thanks @rogfer01 for spotting this out.

Reviewed By: asb

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

2 years ago[RISCV] Add more tests for vcpop and vfirst with VL=0
Chenbing.Zheng [Thu, 24 Feb 2022 05:23:25 +0000 (05:23 +0000)]
[RISCV] Add more tests for vcpop and vfirst with VL=0

Reviewed By: craig.topper

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

2 years ago[RISCV][NFC] Add helper function isVectorConfigInstr to reduce Repeated code.
Chenbing.Zheng [Thu, 24 Feb 2022 03:49:58 +0000 (03:49 +0000)]
[RISCV][NFC] Add helper function isVectorConfigInstr to reduce Repeated code.

Reviewed By: craig.topper

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

2 years ago[ELF] Symbols.h: remove #include "InputFiles.h"
Fangrui Song [Thu, 24 Feb 2022 05:36:45 +0000 (21:36 -0800)]
[ELF] Symbols.h: remove #include "InputFiles.h"

2 years ago[ELF] Move isUsedInRegularObj assignment from ctor to call sites. NFC
Fangrui Song [Thu, 24 Feb 2022 05:32:50 +0000 (21:32 -0800)]
[ELF] Move isUsedInRegularObj assignment from ctor to call sites. NFC

This removes the tricky
`isUsedInRegularObj(!file || file->kind() == InputFile::ObjKind)`
and the copy from `Symbol::mergeProperties`.

2 years ago[RISCV] Use SelectionDAG::getFreeze to simplify some code. NFC
Craig Topper [Thu, 24 Feb 2022 05:12:54 +0000 (21:12 -0800)]
[RISCV] Use SelectionDAG::getFreeze to simplify some code. NFC

2 years ago[ELF][test] Avoid race on a.out
Fangrui Song [Thu, 24 Feb 2022 04:48:49 +0000 (20:48 -0800)]
[ELF][test] Avoid race on a.out

2 years ago[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC
Fangrui Song [Thu, 24 Feb 2022 04:44:34 +0000 (20:44 -0800)]
[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC

2 years ago[BOLT][NFC] Report errors from RewriteInstance `discoverStorage` and `run`
Amir Ayupov [Thu, 24 Feb 2022 03:30:30 +0000 (19:30 -0800)]
[BOLT][NFC] Report errors from RewriteInstance `discoverStorage` and `run`

Further improve error handling in BOLT by reporting `RewriteInstance` errors in
a library and fuzzer-friendly way instead of exiting.

Follow-up to D119658

Reviewed By: rafauler

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

2 years ago[ELF] Move TLS mismatch error from Symbol::replace to postParse
Fangrui Song [Thu, 24 Feb 2022 04:34:48 +0000 (20:34 -0800)]
[ELF] Move TLS mismatch error from Symbol::replace to postParse

* detect `def_tls.o undef_nontls.o` violation
* place error checking code (checking duplicate symbol) together
* allow `--defsym tls1=tls2 def_tls.o`

As a degraded error checking, `--defsym tls1=42` violation will not be detected.

2 years ago[flang] Do not print format tabs
V Donaldson [Thu, 24 Feb 2022 00:31:07 +0000 (16:31 -0800)]
[flang] Do not print format tabs

As an extension, tabs are accepted in a format, but should be skipped,
not printed.

2 years ago[HIP] Support `-fgpu-default-stream`
Yaxun (Sam) Liu [Tue, 22 Feb 2022 01:16:04 +0000 (20:16 -0500)]
[HIP] Support `-fgpu-default-stream`

Introduce -fgpu-default-stream={legacy|per-thread} option to
support per-thread default stream for HIP runtime.

When -fgpu-default-stream=per-thread, HIP kernels are
launched through hipLaunchKernel_spt instead of
hipLaunchKernel. Also HIP_API_PER_THREAD_DEFAULT_STREAM=1
is defined by the preprocessor to enable other per-thread stream
API's.

Reviewed by: Artem Belevich

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

2 years ago[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC
Fangrui Song [Thu, 24 Feb 2022 03:18:24 +0000 (19:18 -0800)]
[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC

2 years ago[mlir][sparse][taco] Add support for float32.
Bixia Zheng [Tue, 22 Feb 2022 22:04:30 +0000 (14:04 -0800)]
[mlir][sparse][taco] Add support for float32.

Previously, we only support float64. We now support float32 and float64. When
constructing a tensor without providing a data type, the default is float32.

Fix the tests to data type consistency. All PyTACO application tests now use
float32 to match the default data type of TACO. Other tests may use float32 or
float64.

Reviewed By: aartbik

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

2 years ago[ELF] Remove SharedSymbol::getFile. NFC
Fangrui Song [Thu, 24 Feb 2022 01:57:52 +0000 (17:57 -0800)]
[ELF] Remove SharedSymbol::getFile. NFC

Symbol.h depends on InputFiles.h. This change moves us toward dropping the
weird dependency.

The call sites will become slightly uglier (`cast<SharedFile>(s->file)`), but
the compromise is acceptable.

2 years ago[ScalarEvolution] Control flag for nonstrict inequalities in finite loops
Mircea Trofin [Thu, 24 Feb 2022 01:45:32 +0000 (17:45 -0800)]
[ScalarEvolution] Control flag for nonstrict inequalities in finite loops

D118090 causes a pretty significant (19%) regression in some Eigen
benchmarks. Investigating is a bit time consuming as the compilation
unit where this occurs is large. Rather than revert, this patch adds a
flag controlling that behavior (enabled by default).

2 years ago[mlir][sparse][linalg] add linalg rewriting specific to sparse tensors
Aart Bik [Thu, 24 Feb 2022 00:22:42 +0000 (16:22 -0800)]
[mlir][sparse][linalg] add linalg rewriting specific to sparse tensors

Now that sparse tensor types are first-class citizens and the sparse compiler
is taking shape, it is time to make sure other compiler optimizations compose
well with sparse tensors. Mostly, this should be completely transparent (i.e.,
dense and sparse take the same path). However, in some cases, optimizations
only make sense in the context of sparse tensors. This is a first example of
such an optimization, where fusing a sampled elt-wise multiplication only makes
sense when the resulting kernel has a potential lower asymptotic complexity due
to the sparsity.

As an extreme example, running SDDMM with 1024x1024 matrices and a sparse
sampling matrix with only two elements runs in 463.55ms in the unfused
case but just 0.032ms in the fused case, with a speedup of 14485x that
is only possible in the exciting world of sparse computations!

Reviewed By: mravishankar

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

2 years ago[lldb/test] Fix TestProgressReporting.py race issue with the event listener
Med Ismail Bennani [Thu, 24 Feb 2022 00:42:53 +0000 (16:42 -0800)]
[lldb/test] Fix TestProgressReporting.py race issue with the event listener

This patch is a follow-up of D120100 to address some feedbacks from
@labath.

This should mainly fix the race issue with the even listener by moving
the listener setup to the main thread.

This also changes the SBDebugger::GetProgressFromEvent SWIG binding
arguments to be output only, so the user don't have to provide them.

Finally, this updates the test to check it the out arguments are returned
in a tuple and re-enables the test on all platforms.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>