platform/upstream/llvm.git
2 years ago[flang] Add bind(C) to buitlin C_PTR
Valentin Clement [Mon, 22 Aug 2022 09:12:20 +0000 (11:12 +0200)]
[flang] Add bind(C) to buitlin C_PTR

D131585 Adds couple of semantics check for the components of BIND(C)
derived-type. This would raise an error when a component is of C_PTR
type. Add `bind(c)` to the `__builtin_c_ptr` type so the wrong error
is not triggered.

Reviewed By: peixin, jeanPerier

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

2 years ago[libc] Allow construction of const span from mutable span
Guillaume Chatelet [Mon, 22 Aug 2022 08:54:13 +0000 (08:54 +0000)]
[libc] Allow construction of const span from mutable span

2 years ago[ARM] Fix bug in also_compatible_with attribute parser
Victor Campos [Fri, 19 Aug 2022 07:46:55 +0000 (08:46 +0100)]
[ARM] Fix bug in also_compatible_with attribute parser

Check ScopedPrinter pointer before attempting to print the attribute's
parsed information.

Patch by Michael Platings and Victor Campos

Reviewed By: pratlucas

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

2 years ago[mlir] Fix bots after bytecode support was added in D131747
River Riddle [Mon, 22 Aug 2022 08:31:31 +0000 (01:31 -0700)]
[mlir] Fix bots after bytecode support was added in D131747

* Fix ambiguous Twine constructor call
* Ensure shift is 64-bit (for MSVC)
* Disable bytecode tests on s390x (we don't support big endian right now)

2 years ago[reland][NFC][libc] Use span instead of ArrayRef
Guillaume Chatelet [Mon, 22 Aug 2022 08:09:23 +0000 (08:09 +0000)]
[reland][NFC][libc] Use span instead of ArrayRef

2 years agoRevert "[NFC][libc] Use span instead of ArrayRef"
Guillaume Chatelet [Mon, 22 Aug 2022 08:14:22 +0000 (08:14 +0000)]
Revert "[NFC][libc] Use span instead of ArrayRef"

This reverts commit e7b250b8a6e2bd7e2cb85e0a90d77b1a3326814b.

2 years ago[NFC][libc] Use span instead of ArrayRef
Guillaume Chatelet [Mon, 22 Aug 2022 08:09:23 +0000 (08:09 +0000)]
[NFC][libc] Use span instead of ArrayRef

2 years ago[mlir] Add initial support for a binary serialization format
River Riddle [Fri, 12 Aug 2022 03:06:33 +0000 (20:06 -0700)]
[mlir] Add initial support for a binary serialization format

This commit adds a new bytecode serialization format for MLIR.
The actual serialization of MLIR to binary is relatively straightforward,
given the very very general structure of MLIR. The underlying basis for
this format is a variable-length encoding for integers, which gets heavily
used for nearly all aspects of the encoding (given that most of the encoding
is just indexing into lists).

The format currently does not provide support for custom attribute/type
serialization, and thus always uses an assembly format fallback. It also
doesn't provide support for resources. These will be added in followups,
the intention for this patch is to provide something that supports the
basic cases, and can be built on top of.

https://discourse.llvm.org/t/rfc-a-binary-serialization-format-for-mlir/63518

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

2 years ago[SCEV] Prove condition invariance via context, try 2
Max Kazantsev [Mon, 22 Aug 2022 06:09:20 +0000 (13:09 +0700)]
[SCEV] Prove condition invariance via context, try 2

Initial implementation had too weak requirements to positive/negative
range crossings. Not crossing zero with nuw is not enough for two reasons:

- If ArLHS has negative step, it may turn from positive to negative
  without crossing 0 boundary from left to right (and crossing right to
  left doesn't count for unsigned);
- If ArLHS crosses SINT_MAX boundary, it still turns from positive to
  negative;

In fact we require that ArLHS always stays non-negative or negative,
which an be enforced by the following set of preconditions:

- both nuw and nsw;
- positive step (looks liftable);

Because of positive step, boundary crossing is only possible from left
part to the right part. And because of no-wrap flags, it is guaranteed
to never happen.

2 years ago[libc] Add a span facility
Guillaume Chatelet [Fri, 19 Aug 2022 17:52:36 +0000 (17:52 +0000)]
[libc] Add a span facility

This is intended to replace ArrayRef.

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

2 years agoRevert "[clang-format][NFC] Fix a bug in setting type FunctionLBrace"
owenca [Mon, 22 Aug 2022 04:32:50 +0000 (21:32 -0700)]
Revert "[clang-format][NFC] Fix a bug in setting type FunctionLBrace"

This reverts commit 35f7dd601d33219fafa2c0d308e187df3e36847a.

Fixes #57200.

2 years ago[Test] And one more test for PR57247
Max Kazantsev [Mon, 22 Aug 2022 06:01:35 +0000 (13:01 +0700)]
[Test] And one more test for PR57247

2 years ago[clang] Fix warning after D116203
Vitaly Buka [Mon, 22 Aug 2022 05:39:23 +0000 (22:39 -0700)]
[clang] Fix warning after D116203

The warning was:
SemaType.cpp:9469:3: error: default label in switch
which covers all enumeration values
[-Werror,-Wcovered-switch-default]

2 years ago[LoongArch][test] Regenerate loongarch_generated_funcs.test checks
wanglei [Mon, 22 Aug 2022 05:10:29 +0000 (13:10 +0800)]
[LoongArch][test] Regenerate loongarch_generated_funcs.test checks

This patch fix test failure due to D132006.

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

2 years ago[Test] One more test for PR57247
Max Kazantsev [Mon, 22 Aug 2022 05:22:49 +0000 (12:22 +0700)]
[Test] One more test for PR57247

Show that the issue also exists with positive steps.

2 years ago[RISCV] Add zihintntl instructions
Shao-Ce SUN [Mon, 22 Aug 2022 03:53:16 +0000 (11:53 +0800)]
[RISCV] Add zihintntl instructions

Reviewed By: kito-cheng

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

2 years ago[LoongArch] Support Load and Store with 14-bit signed immediate operands
gonglingqin [Mon, 22 Aug 2022 02:58:29 +0000 (10:58 +0800)]
[LoongArch] Support Load and Store with 14-bit signed immediate operands

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

2 years ago[libcxx][NFC] utilises compiler builtins for unary transform type-traits
Christopher Di Bella [Mon, 22 Aug 2022 01:07:08 +0000 (01:07 +0000)]
[libcxx][NFC] utilises compiler builtins for unary transform type-traits

Depends on D116203

Reviewed By: #libc, philnik

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

2 years ago[clang] adds unary type transformations as compiler built-ins
Christopher Di Bella [Mon, 22 Aug 2022 00:27:10 +0000 (00:27 +0000)]
[clang] adds unary type transformations as compiler built-ins

Adds

* `__add_lvalue_reference`
* `__add_pointer`
* `__add_rvalue_reference`
* `__decay`
* `__make_signed`
* `__make_unsigned`
* `__remove_all_extents`
* `__remove_extent`
* `__remove_const`
* `__remove_volatile`
* `__remove_cv`
* `__remove_pointer`
* `__remove_reference`
* `__remove_cvref`

These are all compiler built-in equivalents of the unary type traits
found in [[meta.trans]][1]. The compiler already has all of the
information it needs to answer these transformations, so we can skip
needing to make partial specialisations in standard library
implementations (we already do this for a lot of the query traits). This
will hopefully improve compile times, as we won't need use as much
memory in such a base part of the standard library.

[1]: http://wg21.link/meta.trans

Co-authored-by: zoecarver
Reviewed By: aaron.ballman, rsmith

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

2 years ago[PowerPC][Coroutines] Add tail-call check with call information for coroutines
Ting Wang [Mon, 22 Aug 2022 02:20:40 +0000 (22:20 -0400)]
[PowerPC][Coroutines] Add tail-call check with call information for coroutines

Fixes #56679.

Reviewed By: ChuanqiXu, shchenz

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

2 years ago[AArch64][NFC] Replace setOperationAction and AddPromotedToType
wanglian [Fri, 19 Aug 2022 08:37:53 +0000 (16:37 +0800)]
[AArch64][NFC] Replace setOperationAction and AddPromotedToType
with setOperationPromotedToType.

Reviewed By: dmgreen

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

2 years ago[sanitizer] use ../runtimes path to build libcxx
Vitaly Buka [Mon, 22 Aug 2022 01:41:55 +0000 (18:41 -0700)]
[sanitizer] use ../runtimes path to build libcxx

2 years ago[clang-format] Fix BeforeHash indent of comments above PPDirective
owenca [Thu, 18 Aug 2022 05:12:07 +0000 (22:12 -0700)]
[clang-format] Fix BeforeHash indent of comments above PPDirective

Fixes #56326.

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

2 years ago[ADT] Remove `is_invocable` from `STLExtras.h`
Joe Loser [Sun, 21 Aug 2022 00:48:05 +0000 (18:48 -0600)]
[ADT] Remove `is_invocable` from `STLExtras.h`

As a follow-up of https://reviews.llvm.org/D132318, now that the callers have
been adjusted to use `std::is_invocable`, remove `llvm::is_invocable` and its
tests.

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

2 years ago[ADT] Clarify llvm::bit_cast implementation comment
Joe Loser [Sun, 21 Aug 2022 16:41:13 +0000 (10:41 -0600)]
[ADT] Clarify llvm::bit_cast implementation comment

When reviewing https://reviews.llvm.org/D132330, I noticed a few pre-existing
comments regarding the implementation of `llvm::bit_cast`. One comment is a bit
misleading since `std::bit_cast` is a C++20 standard library thing, not a
C++17 one (otherwise we could use it directly). Clarify that in the comment.

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

2 years ago[RISCV] Remove impossible TODO in RISCVRedundantCopyElimination. NFC
Craig Topper [Sun, 21 Aug 2022 20:14:31 +0000 (13:14 -0700)]
[RISCV] Remove impossible TODO in RISCVRedundantCopyElimination. NFC

If there are multiple conditional branches we shouldn't do any
optimization.

2 years ago[RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ? x : 1.
Craig Topper [Sun, 21 Aug 2022 18:46:05 +0000 (11:46 -0700)]
[RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ? x : 1.

Similar to D132211, we can optimize x <s -1 ? x : -1 -> x <s 0 ? x : -1

Also improve the unsigned case from D132211 to use x != 0 which
will give a bnez instruction which might be compressible.

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

2 years ago[RISCV] Be more strict about LUI+ADDI macrofusion pre-RA.
Craig Topper [Sun, 21 Aug 2022 17:56:24 +0000 (10:56 -0700)]
[RISCV] Be more strict about LUI+ADDI macrofusion pre-RA.

Don't macrofuse if the LUI has more than 1 user. That will likely
require the LUI to have a different destination register post-RA.
LUI+ADDI can only be fused if they write the same register.

2 years ago[ADT] Simplify llvm::bit_cast (NFC)
Kazu Hirata [Sun, 21 Aug 2022 17:39:21 +0000 (10:39 -0700)]
[ADT] Simplify llvm::bit_cast (NFC)

This patch removes macro tricks to check GCC versions.

The commit message from 19262fc5966ab569f21f3d440f8b001bca666f17
states that "is_trivially_copyable is only in GCC 5.1 and later".
Note that we now require GCC 7.1 or higher.

Since both std::is_trivially_constructible and
std::is_trivially_copyable are C++11 features, and we now require
C++17, we probably don't need to worry about the availability of the
C++11 features.

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

2 years agoRemove llvm::is_trivially_copyable (NFC)
Kazu Hirata [Sun, 21 Aug 2022 17:39:19 +0000 (10:39 -0700)]
Remove llvm::is_trivially_copyable (NFC)

This patch removes llvm::is_trivially_copyable as it seems to be dead.
Once I remove it, HAVE_STD_IS_TRIVIALLY_COPYABLE has no users, so this
patch removes the macro also.

The comment on llvm::is_trivially_copyable mentions GCC 4.9, but note
that we now require GCC 7.1 or higher.

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

2 years ago[flang][OpenMP] Parser support for Target directive and Device clause
Sesha Kalyur [Sun, 21 Aug 2022 16:53:51 +0000 (22:23 +0530)]
[flang][OpenMP] Parser support for Target directive and Device clause

This patch adds support for the device clause on `Target` directive.
Device clause was added in OpenMP specification version 4.5 to
create a device data environment for the extent of a region. On
target construct, the device expression be either be `ancestor`
(taking after the parent) or assign a new `device_num`.

Reviewed By: kiranchandramohan

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

2 years ago[CostModel][X86] Add CodeSize handling for fadd/fsub/fmul/fsqrt ops
Simon Pilgrim [Sun, 21 Aug 2022 16:42:05 +0000 (17:42 +0100)]
[CostModel][X86] Add CodeSize handling for fadd/fsub/fmul/fsqrt ops

Eventually this will be part of the cost table lookup

2 years ago[ADT] Replace `void_t` equivalent with `std::void_t`
Joe Loser [Sat, 20 Aug 2022 23:53:58 +0000 (17:53 -0600)]
[ADT] Replace `void_t` equivalent with `std::void_t`

Use `std::void_t` instead of defining our own equivalent in `STLExtras.h` now
that C++17 is available for use.

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

2 years agoRevert rG15de7aaae52ef4be9f9ff3b130804e5b5ccd29f4 "[CostModel][X86] Add CodeSize...
Simon Pilgrim [Sun, 21 Aug 2022 15:51:45 +0000 (16:51 +0100)]
Revert rG15de7aaae52ef4be9f9ff3b130804e5b5ccd29f4 "[CostModel][X86] Add CodeSize/SizeLatency handling for fadd/fsub/fmul/fsqrt ops"

This is unintentionally affecting some backend tests

2 years ago[CostModel][X86] Add CodeSize/SizeLatency handling for fadd/fsub/fmul/fsqrt ops
Simon Pilgrim [Sun, 21 Aug 2022 15:39:47 +0000 (16:39 +0100)]
[CostModel][X86] Add CodeSize/SizeLatency handling for fadd/fsub/fmul/fsqrt ops

Eventually this will be part of the cost table lookup

2 years ago[NFC][libc++][doc] Improves rst formatting.
Mark de Wever [Sun, 21 Aug 2022 15:16:14 +0000 (17:16 +0200)]
[NFC][libc++][doc] Improves rst formatting.

2 years ago[NFC][mlir][affine] Typo in Affine Analysis test
Kai Sasaki [Sun, 21 Aug 2022 14:54:44 +0000 (20:24 +0530)]
[NFC][mlir][affine] Typo in Affine Analysis test

Reviewed By: Groverkss

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

2 years ago[libc++] Fix typos in deprecation messages for experimental searchers
Joe Loser [Sat, 20 Aug 2022 23:21:13 +0000 (17:21 -0600)]
[libc++] Fix typos in deprecation messages for experimental searchers

Fix the typo in the deprecated messages for these searchers:
`s/exprerimental/experimental`.

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

2 years ago[InstCombine] reassociate bitwise logic chains based on uses
Sanjay Patel [Sun, 21 Aug 2022 13:42:14 +0000 (09:42 -0400)]
[InstCombine] reassociate bitwise logic chains based on uses

(X op Y) op Z --> (Y op Z) op X

This isn't a complete solution (see TODO tests for possible refinements),
but it shows some nice wins and doesn't seem to cause any harm. I think
the most potential danger is from conflicting with other folds and causing
an infinite loop - that's the reason for avoiding patterns with constant
operands.

Alternatively, we could try this in the reassociate pass, but we would not
immediately see all of the logic folds that instcombine provides. I also
looked at improving ValueTracking's isImpliedCondition() (and we should
still add some enhancements there), but that would not work in general for
bitwise logic reduction.

The tests that reduce completely to 0/-1 are motivated by issue #56653.

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

2 years ago[CMake] Weaken 176db3b3ab25ff8a9b2405f50ef5a8bd9304a6d5
John Ericson [Sun, 21 Aug 2022 12:57:01 +0000 (08:57 -0400)]
[CMake] Weaken 176db3b3ab25ff8a9b2405f50ef5a8bd9304a6d5

That commit (D132324) made putting libc++ in LLVM_ENABLE_RUNTIMES a hard
error, but ther are some out-of-tree CI jobs (especially docs that need
fixing).

I am thus making it a "soft error" for now, until that is resolved.

2 years ago[PhaseOrdering][X86] Regenerate vdiv.ll
Simon Pilgrim [Sun, 21 Aug 2022 12:39:55 +0000 (13:39 +0100)]
[PhaseOrdering][X86] Regenerate vdiv.ll

Noticed while cleaning up x86 cost tables for upcoming cost kind support and it affected this test

2 years ago[RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1
LiaoChunyu [Fri, 19 Aug 2022 08:14:19 +0000 (16:14 +0800)]
[RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1

if x == 1,
  x > 1 ? x : 1  return x, which is also 1.
  x > 0 ? x : 1  return 1.

Reduce the number of load 1 instructions.

Reviewed By: craig.topper

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

2 years ago[libcxxabi][cmake] Allow building without libcxx again
John Ericson [Sat, 20 Aug 2022 15:04:41 +0000 (11:04 -0400)]
[libcxxabi][cmake] Allow building without libcxx again

This allows `-DLLVM_ENABLE_RUNTIMES=libcxxabi` to work.

This functionality was removed in D125561 (among other such removals) as
dead code, because it was only available as part of the standalone build
before.

The functionality as added back as it was, except `target_include_directories` is used instead of the cruder `target_compile_options` (with an MSVC vs not MSVC conditional split). That is just wholly better.

Reviewed By: phosek, #libc_abi

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

2 years ago[RFC] Remove support for building C++ with `LLVM_ENABLE_PROJECTS`
John Ericson [Sun, 21 Aug 2022 01:47:45 +0000 (21:47 -0400)]
[RFC] Remove support for building C++ with `LLVM_ENABLE_PROJECTS`

This has been officially deprecated since D112724, meaning the
deprecation warning is present in released 14 and 15.

This makes me think that now, shortly after the 15 release is branched,
is a good time to pull the trigger.

Reviewed By: phosek

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

2 years ago[CostModel][X86] Add trunc cost kinds tests
Simon Pilgrim [Sun, 21 Aug 2022 11:33:10 +0000 (12:33 +0100)]
[CostModel][X86] Add trunc cost kinds tests

2 years ago[CostModel][X86] Split integer div/rem cost kinds tests
Simon Pilgrim [Sun, 21 Aug 2022 11:03:01 +0000 (12:03 +0100)]
[CostModel][X86] Split integer div/rem cost kinds tests

It's going to be much easier to maintain these tests (and all the check prefix combinations) if we don't mix cost kinds in the same file.

2 years ago[Orc] Improve deintialize and shutdown logic
Anubhab Ghosh [Sat, 20 Aug 2022 20:19:34 +0000 (01:49 +0530)]
[Orc] Improve deintialize and shutdown logic

When deinitializing, the allocation needs to be removed from the
allocation list of its associated reservation so that remaining
allocations can be deinitialized when releasing the reservation.

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

2 years ago[Orc] Provide correct Reservation address for slab allocations
Anubhab Ghosh [Sat, 20 Aug 2022 20:13:20 +0000 (01:43 +0530)]
[Orc] Provide correct Reservation address for slab allocations

When slab allocator is used, the MappingBase is not necessarily
the same as the original reservation base as the allocation could
be a part of the whole reservation.

In this case the original reservation address needs to be passed to
ExecutorSharedMemoryMapperService to associate the new allocation
with the original reservation.

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

2 years ago[Orc] Only unmap shared memory in controller process destructor
Anubhab Ghosh [Sat, 20 Aug 2022 20:00:15 +0000 (01:30 +0530)]
[Orc] Only unmap shared memory in controller process destructor

By the time SharedMemoryMapper destructor is called, the RPC
connection is no longer available causing the release() call to
always fail. Instead at this point only shared memory regions
can be unmapped safely.

Deinitializers are called and mapped memory is released at the
executor side by ExecutorSharedMemoryMapperService::shutdown()
instead. Memory can also be released earlier by calling release()
earlier before RPC connection is closed.

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

2 years ago[Orc] Actually save the callback
Anubhab Ghosh [Sat, 20 Aug 2022 19:49:48 +0000 (01:19 +0530)]
[Orc] Actually save the callback

The callback function was captured by reference but it lived on the
stack and was in danger of being overwritten and could cause a crash.

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

2 years ago[CostModel][X86] Split int/fp arithmetic cost kinds tests
Simon Pilgrim [Sun, 21 Aug 2022 10:49:27 +0000 (11:49 +0100)]
[CostModel][X86] Split int/fp arithmetic cost kinds tests

It's going to be much easier to maintain these tests (and all the check prefix combinations) if we don't mix cost kinds in the same file.

2 years ago[mlir][normalize-memrefs] NFC Follow-up D125854
Tung D. Le [Sat, 20 Aug 2022 02:00:28 +0000 (07:30 +0530)]
[mlir][normalize-memrefs] NFC Follow-up D125854

NFC follow-up D125854 to reflect some remaining comments in D125854

Reviewed By: bondhugula

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

2 years ago[CostModel] Add CostKind argument to getShuffleCost
Simon Pilgrim [Sun, 21 Aug 2022 09:19:21 +0000 (10:19 +0100)]
[CostModel] Add CostKind argument to getShuffleCost

Defaults to TCK_RecipThroughput - as most explicit calls were assuming TCK_RecipThroughput (vectorizers) or was just doing a before-vs-after comparison (vectorcombiner). Calls via getInstructionCost were just dropping the CostKind, so again there should be no change at this time (as getShuffleCost and its expansions don't use CostKind yet) - but it will make it easier for us to better account for size/latency shuffle costs in inline/unroll passes in the future.

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

2 years ago[C++20][Modules] Improve handing of Private Module Fragment diagnostics.
Iain Sandoe [Wed, 22 Jun 2022 08:15:53 +0000 (09:15 +0100)]
[C++20][Modules] Improve handing of Private Module Fragment diagnostics.

This adds a check for exported inline functions, that there is a definition in
the definition domain (which, in practice, can only be the module purview but
before any PMF starts) since the PMF definition domain cannot contain exports.

This is:
[dcl.inline]/7
If an inline function or variable that is attached to a named module is declared in
a definition domain, it shall be defined in that domain.

The patch also amends diagnostic output by excluding the PMF sub-module from the
set considered as sources of missing decls.  There is no point in telling the user
that the import of a PMF object is missing - since such objects are never reachable
to an importer.  We still show the definition (as unreachable), to help point out
this.

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

2 years ago[mlir][Bazel] Fix Bazel build
Anlun Xu [Sun, 21 Aug 2022 08:01:04 +0000 (01:01 -0700)]
[mlir][Bazel] Fix Bazel build

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

2 years agoRevert "Use std::is_same_v instead of std::is_same (NFC)"
Kazu Hirata [Sun, 21 Aug 2022 06:00:39 +0000 (23:00 -0700)]
Revert "Use std::is_same_v instead of std::is_same (NFC)"

This reverts commit c5da37e42d388947a40654b7011f2a820ec51601.

This patch seems to break builds with some versions of MSVC.

2 years agoUse std::is_same_v instead of std::is_same (NFC)
Kazu Hirata [Sun, 21 Aug 2022 05:36:26 +0000 (22:36 -0700)]
Use std::is_same_v instead of std::is_same (NFC)

2 years agoUse range-based for loops (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:32 +0000 (21:18 -0700)]
Use range-based for loops (NFC)

2 years agoUse llvm::drop_begin (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:30 +0000 (21:18 -0700)]
Use llvm::drop_begin (NFC)

2 years agoRemove redundant initialization of Optional (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:28 +0000 (21:18 -0700)]
Remove redundant initialization of Optional (NFC)

2 years agoUse llvm::is_contained (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:27 +0000 (21:18 -0700)]
Use llvm::is_contained (NFC)

2 years ago[Scalar] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:25 +0000 (21:18 -0700)]
[Scalar] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.

2 years agoEnsure newlines at the end of files (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:23 +0000 (21:18 -0700)]
Ensure newlines at the end of files (NFC)

2 years ago[libunwind] Fixed a number of typos
Gabriel Ravier [Sun, 21 Aug 2022 01:09:03 +0000 (18:09 -0700)]
[libunwind] Fixed a number of typos

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: #libunwind, MaskRay

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

2 years ago[mlir] Use std::is_invocable instead of llvm::is_invocable
Joe Loser [Sat, 20 Aug 2022 23:30:14 +0000 (17:30 -0600)]
[mlir] Use std::is_invocable instead of llvm::is_invocable

Now that MLIR is built with C++17, use the standard library equivalent of
`llvm::is_invocable`: `std::is_invocable`.

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

2 years ago[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)
Kazu Hirata [Sat, 20 Aug 2022 21:06:42 +0000 (14:06 -0700)]
[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)

This patch removes llvm::is_trivially_{copy/move}_constructible in
favor of std::is_trivially_{copy/move}_constructible.

The previous attempt to remove them in Dec 2020,
c8d406c93c5bb01599990201f78d8428dd29d289, broke builds with "some
versions of GCC" according to
6cd9608fb37ca2418fb44b57ec955bb5efe10689.

It's been 20 months since then, and the minimum requirement for GCC
has been updated to 7.1 from 5.1.

FWIW, I was able to build llvm with gcc 8.4.0.

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

2 years ago[JITLink] Fix LinkGraph::makeAbsolute, add unit test.
Lang Hames [Sat, 20 Aug 2022 20:32:06 +0000 (13:32 -0700)]
[JITLink] Fix LinkGraph::makeAbsolute, add unit test.

makeAbsolute was not updating the symbol address when applied to external
symbols.

This commit adds a unit test for makeAbsolute, and updates the makeExternal unit
test to check that makeExternal works correctly for absolute symbols.

2 years ago[libc++][string] Removes obsolete constexpr.
Mark de Wever [Sun, 14 Aug 2022 12:14:09 +0000 (14:14 +0200)]
[libc++][string] Removes obsolete constexpr.

Addresses the final review comment of D131421.

Reviewed By: philnik, #libc

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

2 years ago[gn build] Fix oversight in 3adda398cef7f56d0
Nico Weber [Sat, 20 Aug 2022 17:39:45 +0000 (13:39 -0400)]
[gn build] Fix oversight in 3adda398cef7f56d0

2 years ago[bolt][llvm][cmake] Use `CMAKE_INSTALL_LIBDIR` too
John Ericson [Sat, 20 Aug 2022 14:33:21 +0000 (10:33 -0400)]
[bolt][llvm][cmake] Use `CMAKE_INSTALL_LIBDIR` too

Working back towards D130586.

Bolt didn't use `LLVM_LIBDIR_SUFFIX` before, and has no in-tree reverse
dependencies, it seems easier to add.

The change in LLVM itself is to prevent some unexpected `lib64` from
cropping up due to the `CMAKE_INSTALL_LIBDIR` defaulting logic.

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

2 years ago[clang][lldb][cmake] Use new `*_INSTALL_LIBDIR_BASENAME` CPP macro
John Ericson [Sat, 20 Aug 2022 15:20:12 +0000 (11:20 -0400)]
[clang][lldb][cmake] Use new `*_INSTALL_LIBDIR_BASENAME` CPP macro

Use this instead of `*_LIBDIR_SUFFIX`, from which it is computed.

This gets us ready for D130586, in which `*_LIBDIR_SUFFIX` is
deprecated.

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

2 years ago[ADT] Simplify llvm::sort with constexpr if (NFC)
Kazu Hirata [Sat, 20 Aug 2022 16:34:36 +0000 (09:34 -0700)]
[ADT] Simplify llvm::sort with constexpr if (NFC)

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

2 years ago[ADT] Deprecate Any::hasValue
Kazu Hirata [Sat, 20 Aug 2022 16:34:35 +0000 (09:34 -0700)]
[ADT] Deprecate Any::hasValue

This patch deprecates Any::hasValue as I've migrated all known uses of
it to Any::has_value.  I'm planning to remove the deprecated method in
3 months or so.

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

2 years ago[clang] Use Any::has_value instead of Any::hasValue (NFC)
Kazu Hirata [Sat, 20 Aug 2022 15:40:18 +0000 (08:40 -0700)]
[clang] Use Any::has_value instead of Any::hasValue (NFC)

2 years ago[flang] Add semantic checks for interoperability of derived type (C1806)
Peixin Qiao [Sat, 20 Aug 2022 15:34:47 +0000 (23:34 +0800)]
[flang] Add semantic checks for interoperability of derived type (C1806)

As Fortran 2018 C1806, each component of a derived type with the BIND
attribute shall be a nonpointer, nonallocatable data component with
interoperable type.

Reviewed By: klausler

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

2 years ago[flang][OpenMP] Handle the data race for firstprivate and lastprivate
Peixin Qiao [Sat, 20 Aug 2022 15:31:13 +0000 (23:31 +0800)]
[flang][OpenMP] Handle the data race for firstprivate and lastprivate

Remove barriers for firstprivate except if the variable is also
lastprivatized. Re-arrange code and put all last-privates inside a
single scf.if.

As OpenMP Spec 5.0, to avoid the data races, concurrent updates of the
original list item must be synchronized with the read of the original
list item that occurs as a result of the firstprivate clause. Adding
barrier(s) before and/or after the worksharing region would remove the
data races, and it is the application(user)'s job. However, when
one list item is in both firstprivate and lastprivate clauses, the
standard (https://www.openmp.org/spec-html/5.0/openmpsu105.html) states
the following:
```
If a list item appears in both firstprivate and lastprivate clauses, the
update required for the lastprivate clause occurs after all
initializations for the firstprivate clause.
```

So, the synchronization should be ensured by compiler such as emiting
one barrier since the lastprivate clause follows the reads of the
original list item performed for the initialization of each of the
firstprivate list item.

Add FIXME for two special cases, sections construct and linear clause.

The data race problem for single construct will be handled later.

This implementation is based on the discussion with OpenMP committee and
clang code (clang/lib/CodeGen/CGStmtOpenMP.cpp).

Reviewed By: kiranchandramohan, NimishMishra

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

2 years ago[lldb] Use Any::has_value instead of ANy::hasValue (NFC)
Kazu Hirata [Sat, 20 Aug 2022 14:28:06 +0000 (07:28 -0700)]
[lldb] Use Any::has_value instead of ANy::hasValue (NFC)

2 years ago[ADT] Implement Any::has_value
Kazu Hirata [Sat, 20 Aug 2022 14:28:04 +0000 (07:28 -0700)]
[ADT] Implement Any::has_value

This patch implements Any::has_value for consistency with std::any in
C++17.

My plan is to deprecate Any::hasValue after migrating all of its uses
to Any::has_value.  Since I am about to do so, this patch simply
replaces hasValue with has_value in the unit test instead of adding
tests for has_value.

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

2 years ago[ADT] Simplify llvm::reverse with constexpr if (NFC)
Kazu Hirata [Sat, 20 Aug 2022 14:28:03 +0000 (07:28 -0700)]
[ADT] Simplify llvm::reverse with constexpr if (NFC)

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

2 years ago[EarlyCSE][ConstantFolding] do not constant fold atan2(+/-0.0, +/-0.0), part 2
Sanjay Patel [Sat, 20 Aug 2022 12:33:46 +0000 (08:33 -0400)]
[EarlyCSE][ConstantFolding] do not constant fold atan2(+/-0.0, +/-0.0), part 2

Follow-up to 7f1262a322c0d80f3. That patch avoided removing the
call, but it still allowed the constant-folded result. This
makes the behavior consistent with 1-arg libm folding: if the
call potentially raises an exception, then we just bail out.

It seems likely that there are other corner-cases like this,
but the tests are incomplete, so we have lived with these
discrepancies for a long time. This was untested before the
the constant folding was expanded in D127964.

2 years ago[X86] Fold PMULUDQ(X,1) -> AND(X,(1<<32)-1) 'getZeroExtendInReg'
Simon Pilgrim [Sat, 20 Aug 2022 13:58:25 +0000 (14:58 +0100)]
[X86] Fold PMULUDQ(X,1) -> AND(X,(1<<32)-1) 'getZeroExtendInReg'

Fix cases where shl/srem/urem expansion results in a mulh/mul_lohi(x,1) 'pass through' that gets lowered to pmuludq.

Fixes #56684

2 years ago[X86] Add vector test coverage of 'one-bit-diff' and/or icmp ne/eq patterns
Simon Pilgrim [Sat, 20 Aug 2022 13:13:38 +0000 (14:13 +0100)]
[X86] Add vector test coverage of 'one-bit-diff' and/or icmp ne/eq patterns

2 years ago[libc++][doc] Updates status of P2291R3.
Mark de Wever [Sat, 20 Aug 2022 12:45:17 +0000 (14:45 +0200)]
[libc++][doc] Updates status of P2291R3.

Work on the paper has started but it's blocked by PR52954.
Updating the status to avoid duplicated effort implementing this paper.

2 years agoMore llvm-docs-sphinx buildbot fixes
Tom Stellard [Sat, 20 Aug 2022 08:42:48 +0000 (08:42 +0000)]
More llvm-docs-sphinx buildbot fixes

Broken by 7225c0bd0115c947f3c081599e6268cfa027722f and
662a11bd062ac7d938569212fe1c5dc01c1a1b34.

2 years agoFix llvm-docs-sphinx buildbot after 7225c0bd0115c947f3c081599e6268cfa027722f
Tom Stellard [Sat, 20 Aug 2022 08:31:32 +0000 (01:31 -0700)]
Fix llvm-docs-sphinx buildbot after 7225c0bd0115c947f3c081599e6268cfa027722f

2 years agoHowToReleaseLLVM: Add annual release schedule template
Tom Stellard [Sat, 20 Aug 2022 08:25:11 +0000 (01:25 -0700)]
HowToReleaseLLVM: Add annual release schedule template

Reviewed By: ldionne, thieta

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

2 years agoHowToReleaseLLVM: Add some more details about website updates
Tom Stellard [Sat, 20 Aug 2022 08:22:00 +0000 (01:22 -0700)]
HowToReleaseLLVM: Add some more details about website updates

Reviewed By: thieta

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

2 years agoworkflows/llvm-project-tests: Workaround an issue with lldb builds on Windows
Tom Stellard [Sat, 20 Aug 2022 07:15:14 +0000 (00:15 -0700)]
workflows/llvm-project-tests: Workaround an issue with lldb builds on Windows

For some reason cmake started selecting a 32-bit version of python on
Windows instead of the 64-bit version when building windows.  Explicitly
setting the default python to 3.10 fixes this problem.

Reviewed By: thieta

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

2 years agoFix unused variable warnings
Kazu Hirata [Sat, 20 Aug 2022 07:12:35 +0000 (00:12 -0700)]
Fix unused variable warnings

These warnings came up with gcc-11.3.0.

2 years agoReland "[lldb] [test] Disable new CommunicationTests on Windows"
Michał Górny [Fri, 19 Aug 2022 14:22:55 +0000 (16:22 +0200)]
Reland "[lldb] [test] Disable new CommunicationTests on Windows"

This change was wrongly reverted and re-broke the Windows buildbot.

Sponsored by: The FreeBSD Foundation

2 years ago[NFC][AMDGPU] Fix typo.
Thomas [Sat, 20 Aug 2022 06:30:04 +0000 (08:30 +0200)]
[NFC][AMDGPU] Fix typo.

2 years ago[mlir][docs] Migrate away from deprecated llvm::Optional methods
Fangrui Song [Sat, 20 Aug 2022 06:29:31 +0000 (23:29 -0700)]
[mlir][docs] Migrate away from deprecated llvm::Optional methods

2 years ago[lldb] [gdb-remote] Include PID in vCont packets if multiprocess
Michał Górny [Fri, 12 Aug 2022 10:37:18 +0000 (12:37 +0200)]
[lldb] [gdb-remote] Include PID in vCont packets if multiprocess

Try to always send vCont packets and include the PID in them if running
multiprocess.  This is necessary to ensure that with the upcoming full
multiprocess support always resumes the correct process without having
to resort to the legacy Hc packets.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D131758

2 years ago(Reland) [fastalloc] Support allocating specific register class in fastalloc
Luo, Yuanke [Thu, 18 Aug 2022 01:50:55 +0000 (09:50 +0800)]
(Reland) [fastalloc] Support allocating specific register class in fastalloc

This reverts commit 853bb192c407f5d9e75a5fd55cc089151530cbd3.

2 years agoworkflows/version-check: Fix check for release candidates
Tom Stellard [Sat, 20 Aug 2022 04:51:00 +0000 (21:51 -0700)]
workflows/version-check: Fix check for release candidates

Reviewed By: thieta

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

2 years ago[lldb] Use Optional::value instead of Optional::getValue (NFC)
Kazu Hirata [Sat, 20 Aug 2022 04:40:48 +0000 (21:40 -0700)]
[lldb] Use Optional::value instead of Optional::getValue (NFC)

2 years ago[lldb] Use Optional::transform instead of Optional::map (NFC)
Kazu Hirata [Sat, 20 Aug 2022 04:40:47 +0000 (21:40 -0700)]
[lldb] Use Optional::transform instead of Optional::map (NFC)

2 years ago[msan] Bump max allocation on aarch64
Vitaly Buka [Sat, 20 Aug 2022 04:16:02 +0000 (21:16 -0700)]
[msan] Bump max allocation on aarch64

2 years ago[MC][LoongArch] Make .reloc support arbitrary relocation types
wanglei [Sat, 20 Aug 2022 04:06:45 +0000 (12:06 +0800)]
[MC][LoongArch] Make .reloc support arbitrary relocation types

Similar to D76746 (ARM), D76754 (AArch64), D77018 (RISCV)  and
llvmorg-11-init-6967-g152d14da64c (x86)

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

2 years ago[LoongArch] Add some fixups and relocations
wanglei [Sat, 20 Aug 2022 02:13:29 +0000 (10:13 +0800)]
[LoongArch] Add some fixups and relocations

This patch only add %pc_hi20/%pc_lo12/%plt relocations in order
to be able to generate gnu ld linkable relocation file for the
`hello world` IR :
```
@.str = private unnamed_addr constant [14 x i8] c"Hello world!\0A\00", align 1

define dso_local signext i32 @main() nounwind {
entry:
  %call = call signext i32 (ptr, ...) @printf(ptr noundef @.str)
  ret i32 0
}

declare dso_local signext i32 @printf(ptr noundef, ...)
```

This patch also updates some test cases due to new modifiers introduced.
New test: test/MC/LoongArch/Relocations/relocations.s

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