platform/upstream/llvm.git
2 years agoRevert "[lldb] [gdb-remote] Support getting siginfo via API"
Michał Górny [Fri, 28 Jan 2022 08:18:14 +0000 (09:18 +0100)]
Revert "[lldb] [gdb-remote] Support getting siginfo via API"

This reverts commit 1a8f60f5f5b8638a3e8e7fb31ba7ae9e17a7ff2d.
The API requires further work.

2 years ago[lldb][ARM/AArch64] Update dissembler to v9.3-a
David Spickett [Thu, 27 Jan 2022 13:27:58 +0000 (13:27 +0000)]
[lldb][ARM/AArch64] Update dissembler to v9.3-a

This means sve2 is enabled by default and the v8.8 mops (memcpy
and memset acceleration instructions) and HBC (hinted conditional
branch) extensions can be disassembled.

v9.3-a is equivalent to v8.8-a except that in v9.0-a sve2 was
enabled by default so v9.3-a includes that too.

MTE remains an optional extension, only enabled for specific CPUs.

Reviewed By: omjavaid

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

2 years ago[MLIR] Remove some pointer element type accesses
Nikita Popov [Fri, 28 Jan 2022 08:41:17 +0000 (09:41 +0100)]
[MLIR] Remove some pointer element type accesses

Use the MLIR pointer element type, rather than the LLVM pointer
element type.

2 years ago[lld][ELF] Cleanup %t directory in tests, NFC
Alexander Shaposhnikov [Fri, 28 Jan 2022 08:36:38 +0000 (08:36 +0000)]
[lld][ELF] Cleanup %t directory in tests, NFC

2 years ago[OpenMPIRBuilder] Store element type in AtomicOpValue
Nikita Popov [Thu, 27 Jan 2022 13:44:19 +0000 (14:44 +0100)]
[OpenMPIRBuilder] Store element type in AtomicOpValue

With opaque pointers, we can no longer derive this from the pointer
type, so we need to explicitly provide the element type the atomic
operation should work with.

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

2 years ago[ARM] Don't look through pointer types in canTailPredicateLoop()
Nikita Popov [Thu, 27 Jan 2022 13:21:21 +0000 (14:21 +0100)]
[ARM] Don't look through pointer types in canTailPredicateLoop()

Inspecting the pointer element type here is incompatible with
opaque pointers, and doesn't seem necessary to me. I think the
intention might have been to check the type of load/store pointer
arguments, but I believe those should get checked through their
return type or value operand anyway. I don't get any test failures
if I simply drop this.

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

2 years ago[libc] Fix 64-bit Apple ARM support and header includes
Dominic Chen [Fri, 28 Jan 2022 00:40:26 +0000 (16:40 -0800)]
[libc] Fix 64-bit Apple ARM support and header includes

Summary:

Reviewers: sivachandra

Subscribers:

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

2 years ago[NFC] Add tests for ODR checking of default template argument
Chuanqi Xu [Fri, 28 Jan 2022 07:22:04 +0000 (15:22 +0800)]
[NFC] Add tests for ODR checking of default template argument

2 years ago[mlir][Bazel][cmake] Add missing dependency.
Adrian Kuegel [Fri, 28 Jan 2022 07:20:24 +0000 (08:20 +0100)]
[mlir][Bazel][cmake] Add missing dependency.

After 2c7b0685e179 this dependency is needed.

2 years ago[NVPTX] Remove fmin/fmax.NaN.f64 again
Christian Sigg [Thu, 27 Jan 2022 21:33:05 +0000 (22:33 +0100)]
[NVPTX] Remove fmin/fmax.NaN.f64 again

Added in https://reviews.llvm.org/D117204, but it does not exist.

Reviewed By: tra

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

2 years ago[LLVM][AIX] Prefer a 32-bit default target triple on AIX
David Tenty [Thu, 27 Jan 2022 16:09:27 +0000 (10:09 -0600)]
[LLVM][AIX] Prefer a 32-bit default target triple on AIX

If the user doesn't specify a default target triple, the LLVM CMake usually defaults us into the host triple. This is a problem when building Clang/LLVM on 64-bit AIX (i.e. powerpc64-ibm-aix), as the host toolchain (e.g. ar, ld, nm, dump) all expect the compiler to generate 32-bit objects by default (which both GCC and XL on the platform do) and will hard error if passed a 64-bit object without an explicit option or environment setting. This breaks downstream consumers, such as builds generated with build tools like CMake, which when they invoke clang, etc. without explicit bitmode flags also expect 32-bit mode.

This patch changes the default target selection when the host is powerpc64-ibm-aix to prefer powerpc-ibm-aix to avoid these issues. We don't update the runtimes/CMakeList.txt since the default is less meaningful as we assume runtimes will need to build for both targets anyways.

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

2 years ago[NFC] Mark the parameter const for isSame* methods in ASTContext
Chuanqi Xu [Fri, 28 Jan 2022 05:56:08 +0000 (13:56 +0800)]
[NFC] Mark the parameter const for isSame* methods in ASTContext

2 years ago[RISCV] Add Zbkb RUN lines to bswap-bitreverse.ll. NFC
Craig Topper [Fri, 28 Jan 2022 05:19:13 +0000 (21:19 -0800)]
[RISCV] Add Zbkb RUN lines to bswap-bitreverse.ll. NFC

2 years agoRevert "clang-format: [JS] sort import aliases."
Vitaly Buka [Fri, 28 Jan 2022 05:16:02 +0000 (21:16 -0800)]
Revert "clang-format: [JS] sort import aliases."

Triggers MSAN report.

This reverts commit c6d5efb5d98093c4bd7578b2ea52c9032d20dea3.

2 years ago[RISCV] Split bswap-bitreverse-ctlz-cttz-ctpop.ll into two files bswap/bitreverse...
Craig Topper [Fri, 28 Jan 2022 04:55:27 +0000 (20:55 -0800)]
[RISCV] Split bswap-bitreverse-ctlz-cttz-ctpop.ll into two files bswap/bitreverse and ctlz/cttz/ctpop. NFC

Add Zbkb command lines to the bswap/bitreverse test.

2 years ago[Test] One more test for 'ne' and-reduce pattern
Max Kazantsev [Fri, 28 Jan 2022 05:10:55 +0000 (12:10 +0700)]
[Test] One more test for 'ne' and-reduce pattern

2 years ago[WebAssembly] Nullify unnecessary setjmp invokes
Heejin Ahn [Thu, 27 Jan 2022 01:25:33 +0000 (17:25 -0800)]
[WebAssembly] Nullify unnecessary setjmp invokes

This is similar to D116619, but now it handles `invoke`s. The reason we
didn't handle `invoke`s back then was we didn't support Wasm EH + Wasm
SjLj together, and the only case SjLj transformation will see `invoke`s
is when we are using Wasm EH. (In Emscripten EH, they would have been
transformed to `call`s to invoke wrappers.)

But after D117610 we support Wasm EH + Wasm SjLj together and we can
nullify `invoke`s to `setjmp` when there is no other longjmpable calls
within the function. Actually this is very unlikely to happen in
practice, because we treat destructors as longjmpable and also treat
`__cxa_end_catch` as longjmpable even if it is not.

Reviewed By: dschuff

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

2 years ago[WebAssembly] Handle cleanuppad with no parent in Wasm SjLj
Heejin Ahn [Thu, 27 Jan 2022 07:11:14 +0000 (23:11 -0800)]
[WebAssembly] Handle cleanuppad with no parent in Wasm SjLj

Wasm SjLj converts longjmpable calls into `invoke`s that unwind to
`%catch.longjmp.dispatch` BB, from where we check if the thrown
exception is a `longjmp`. But in case a call already has a `funclet`
attribute, i.e., it is within a catch scope, we have to unwind to its
unwind destination first to preserve the scoping structure. That will
eventually unwind to `%catch.longjmp.dispatch`, because all
`catchswitch` and `cleanupret` that unwind to caller are redirected to
`%catch.dispatch.longjmp` during Wasm SjLj transformation.

But the prevous code assumed `cleanuppad`'s parent pad was always an
instruction, and didn't handle when a `cleanuppad`'s parent is `none`.
This CL handles this case, and makes the `while` loop more intuitive by
removing `FromPad` condition and explicitly inserting `break`s.

Reviewed By: dschuff

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

2 years ago[WebAssembly] Error out for setjmp within catch clause for Wasm SjLj
Heejin Ahn [Wed, 26 Jan 2022 19:02:30 +0000 (11:02 -0800)]
[WebAssembly] Error out for setjmp within catch clause for Wasm SjLj

Wasm EH, used with either of Emscripten SjLj or Wasm SjLj, does not
allow `setjmp` calls to be placed within a `catch` clause, because we
don't support jumping into a `catch` block. Emscripten EH does not have
this restriction. But I think this restriction wouldn't prevent most of
use cases. This CL errors out with a clear messsage for this case.

Reviewed By: dschuff, kripken

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

2 years ago[WebAssembly] Don't copy noreturn attr to invokes
Heejin Ahn [Wed, 26 Jan 2022 05:41:43 +0000 (21:41 -0800)]
[WebAssembly] Don't copy noreturn attr to invokes

When we create an invoke wrapper call, if the original call instruction
has a `noreturn` attribute, we shouldn't copy it, because we expect
invoke wrapper calls to return. This generated incorrect `free` call
before an invoke wrapper call that calls `__cxa_throw`, because
`__cxa_throw` has `noreturn` attribute.

Reviewed By: dschuff

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

2 years ago[WebAssembly] Treat __cxa_end_catch not longjmpable in Emscripten SjLj
Heejin Ahn [Sat, 22 Jan 2022 06:22:03 +0000 (22:22 -0800)]
[WebAssembly] Treat __cxa_end_catch not longjmpable in Emscripten SjLj

In D117610 we treated `__cxa_end_catch` longjmpable even though it was
not to make unwind destination relationships correct. But we only need
to do this in Wasm SjLj, and doing this in Emscripten SjLj does not make
the code incorrect but add unnecessary invokes. This CL treats
`__cxa_end_catch` longjmpable only in Wasm SjLj.

Reviewed By: dschuff

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

2 years ago[Test] Add 'ne' tests for and-reduce pattern folding
Max Kazantsev [Fri, 28 Jan 2022 04:47:05 +0000 (11:47 +0700)]
[Test] Add 'ne' tests for and-reduce pattern folding

2 years ago[InstCombine] Fold and-reduce idiom
Max Kazantsev [Fri, 28 Jan 2022 04:20:08 +0000 (11:20 +0700)]
[InstCombine] Fold and-reduce idiom

This patch introduces folding of and-reduce idiom and generates code
that is easier to read and which is lest costly in terms of icmp operations.
The folding is
```
  icmp eq (bitcast(icmp ne (lhs, rhs)), 0)
```
into
```
  icmp eq(bitcast(lhs), bitcast(rhs))
```

See PR53419.

Differential Revision: https://reviews.llvm.org/D118317
Reviewed By: lebedev.ri, spatel

2 years ago[lldb] Remove reproducers documentation
Jonas Devlieghere [Fri, 28 Jan 2022 03:26:17 +0000 (19:26 -0800)]
[lldb] Remove reproducers documentation

2 years agoFix tensor.extract for complex elements
Frederik Gossen [Fri, 28 Jan 2022 03:32:02 +0000 (04:32 +0100)]
Fix tensor.extract for complex elements

2 years ago[Driver] Update clang -B help message
Fangrui Song [Fri, 28 Jan 2022 03:05:10 +0000 (19:05 -0800)]
[Driver] Update clang -B help message

* After 3452a0d8c17f7166f479706b293caf6ac76ffd90 (2020-07), $prefix/$triple-$file is not searched.
* Unlike GCC, -B is not used for include paths. Seems nobody needs this behavior because there are more targeted options like --sysroot/-isystem

2 years ago[RISCV] Add support for matching vwmulsu from fixed vectors
Chenbing.Zheng [Fri, 28 Jan 2022 02:18:33 +0000 (02:18 +0000)]
[RISCV] Add support for matching vwmulsu from fixed vectors

According to riscv-v-spec-1.0, widening signed(vs2)-unsigned integer multiply
vwmulsu.vv vd, vs2, vs1, vm # vector-vector
vwmulsu.vx vd, vs2, rs1, vm # vector-scalar

It is worth noting that signed op is only for vs2.
For vwmulsu.vv, we can swap two ops, and don't care which is sign extension,
but for vwmulsu.vx signExt can not be a vector extended from scalar (rs1).
I specifically added two functions ending with _swap in the test case.

Reviewed By: craig.topper

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

2 years ago[NFC] remove unnecessary references.
Florian Mayer [Fri, 28 Jan 2022 01:42:37 +0000 (17:42 -0800)]
[NFC] remove unnecessary references.

2 years agoRevert "[OpenMP] Ensure broken assumptions print once, not thousands of times."
Ron Lieberman [Fri, 28 Jan 2022 01:41:10 +0000 (01:41 +0000)]
Revert "[OpenMP] Ensure broken assumptions print once, not thousands of times."

This reverts commit 27c799ecc9e9e3bfb8232c93fd500f45ca0cb345.

2 years ago[InstrProf] Add single byte coverage mode
Ellis Hoag [Thu, 27 Jan 2022 19:22:43 +0000 (11:22 -0800)]
[InstrProf] Add single byte coverage mode

Use the llvm flag `-pgo-function-entry-coverage` to create single byte "counters" to track functions coverage. This mode has significantly less size overhead in both code and data because
  * We mark a function as "covered" with a store instead of an increment which generally requires fewer assembly instructions
  * We use a single byte per function rather than 8 bytes per block

The trade off of course is that this mode only tells you if a function has been covered. This is useful, for example, to detect dead code.

When combined with debug info correlation [0] we are able to create an instrumented Clang binary that is only 150M (the vanilla Clang binary is 143M). That is an overhead of 7M (4.9%) compared to the default instrumentation (without value profiling) which has an overhead of 31M (21.7%).

[0] https://groups.google.com/g/llvm-dev/c/r03Z6JoN7d4

Reviewed By: kyulee

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

2 years ago[gn build] fix mac build after 0c425b43b952f4
Nico Weber [Fri, 28 Jan 2022 01:34:38 +0000 (20:34 -0500)]
[gn build] fix mac build after 0c425b43b952f4

2 years ago[lld][WebAssembly] Handle TLS symbols in older object file
Sam Clegg [Thu, 27 Jan 2022 23:47:14 +0000 (15:47 -0800)]
[lld][WebAssembly] Handle TLS symbols in older object file

In older versions of llvm (e.g. llvm 13), symbols were not individually
flagged as TLS.  In this case, the indent was to implicitly mark any
symbols defined in TLS segments as TLS.  However, we were not performing
this implicit conversion if the segment was explicitly marked as TLS

As it happens, llvm 13 was branched between the addition of the segment
flag and the addition of the symbol flag. See:

- segment flag added: https://reviews.llvm.org/D102202
- symbol flag added: https://reviews.llvm.org/D109426

Testing this is tricky because the assembler will imply the TLS status
of the symbol based on the segment its declared in, so we are forced to
use a yaml file here.

Fixes: https://github.com/emscripten-core/emscripten/issues/15891

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

2 years ago[mlir][sparse][pytaco] add PyTACO SpMM example
Aart Bik [Fri, 28 Jan 2022 00:08:54 +0000 (16:08 -0800)]
[mlir][sparse][pytaco] add PyTACO SpMM example

Also contains a few TODOs on future enhancements

Reviewed By: bixia

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

2 years ago[libc++][pstl] Implement tag dispatching mechanism for Parallel STL
Ruslan Arutyunyan [Fri, 28 Jan 2022 00:54:27 +0000 (03:54 +0300)]
[libc++][pstl] Implement tag dispatching mechanism for Parallel STL

Implement the mechanism that simplifies the execution policy/iterator
category dispatching and allows to implement customizations for
the parallel algorithms with adding custom tags

Reviewed By: rodgert, MikeDvorskiy

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

2 years ago[gn build] slighly reformat files to make sync script work
Nico Weber [Fri, 28 Jan 2022 01:09:04 +0000 (20:09 -0500)]
[gn build] slighly reformat files to make sync script work

2 years ago[msan] Copy origin of byval arguments
Vitaly Buka [Sat, 15 Jan 2022 07:45:36 +0000 (23:45 -0800)]
[msan] Copy origin of byval arguments

Depends on D117278

Reviewed By: kda, eugenis

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

2 years ago[gn build] Add support for check-asan
Arthur Eubanks [Wed, 19 Jan 2022 23:40:58 +0000 (15:40 -0800)]
[gn build] Add support for check-asan

With these changes, check-asan passes on Linux and Windows.

There are a couple libraries we need to add support for, asan_static, asan_preinit, and the shared library version of asan proper.
Since we need to build the asan proper sources twice, once with -DASAN_DYNAMIC and once without, those sources are no longer in a source_set.
Much of the check-asan target is taken from the existing check-hwasan target.

Reviewed By: thakis

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

2 years ago[OpenMP] Ensure broken assumptions print once, not thousands of times.
Joseph Huber [Thu, 27 Jan 2022 18:59:38 +0000 (13:59 -0500)]
[OpenMP] Ensure broken assumptions print once, not thousands of times.

If we have a broken assumption we want to print a message to the user.
If the assumption is broken by many threads in many teams this can
become a problem. To avoid it we use a hash that tracks if a broken
assumption has (likely) been printed and avoid printing it again. This
is not fool proof and has some caveats that might cause problems in
the future (see comment) but it should improve the situation
considerably for now.

Reviewed By: JonChesterfield

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

2 years ago[OpenMP] Only generate runtime flags with host input
Joseph Huber [Thu, 27 Jan 2022 20:50:18 +0000 (15:50 -0500)]
[OpenMP] Only generate runtime flags with host input

This patch changes the code generation of runtime flags to only occur if
a host bitcode file was passed in. This is a cheap way to determine if
we are compiling the OpenMP device runtime itself or user code. This is
needed because the global flags we generate for the device runtime e.g.
__omp_rtl_debug_kind were being generated with default values when we
compiled the runtime library. This would then invalidate the ones we
want to be able to add in when the user defines it.

Reviewed By: jdoerfert

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

2 years ago[mlir][scf] Update IfOp to have getInvocationBounds
Mogball [Thu, 27 Jan 2022 23:15:34 +0000 (23:15 +0000)]
[mlir][scf] Update IfOp to have getInvocationBounds

This allows `scf.if` to be used by Control-Flow sink.

Depends on D115088

Reviewed By: rriddle

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

2 years ago[gn build] Port bf20a09790cb
LLVM GN Syncbot [Thu, 27 Jan 2022 23:10:54 +0000 (23:10 +0000)]
[gn build] Port bf20a09790cb

2 years ago[libc++] [P1614] Implement the second half of [cmp.alg]: compare_{strong,weak,partial...
Arthur O'Dwyer [Wed, 8 Sep 2021 20:48:50 +0000 (16:48 -0400)]
[libc++] [P1614] Implement the second half of [cmp.alg]: compare_{strong,weak,partial}_fallback.

The tests for these are just copy-pasted from the tests for std::{strong,weak,partial}_order,
and then I added an extra clause in each (test_2()) to test the stuff that's not just the same
as std::*_order.

This also includes the fix for https://wg21.link/LWG3465 (which falls naturally out of the
"you must write it three times" style, but I've added test cases for it also).

There is an action item here to go back and give good diagnostics for SFINAE failures
in these CPOs. I've filed this as https://github.com/llvm/llvm-project/issues/53456 .

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

2 years ago[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in VisitArrayIn...
Arthur Eubanks [Thu, 27 Jan 2022 22:43:44 +0000 (14:43 -0800)]
[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in VisitArrayInitLoopExpr

With this we can bootstrap an `-O0 -g0` clang with `-mllvm -opaque-pointers`!

2 years ago[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in EmitCXXMembe...
Arthur Eubanks [Thu, 27 Jan 2022 22:42:37 +0000 (14:42 -0800)]
[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in EmitCXXMemberDataPointerAddress()

2 years agoRevert "[clang] Don't typo-fix an expression in a SFINAE context."
Arthur O'Dwyer [Thu, 27 Jan 2022 22:36:08 +0000 (17:36 -0500)]
Revert "[clang] Don't typo-fix an expression in a SFINAE context."

This reverts commit 9be5f4d5afd9a1b6e88a268f6ea6eb282d77d9fe.

I'm not sure if this caused
 https://lab.llvm.org/buildbot/#/builders/60/builds/6350
 https://lab.llvm.org/buildbot/#/builders/119/builds/7433
but I'm acting as if it did.

2 years agoOmit atomic_{,un}signed_lock_free if unsupported
Brian Cain [Thu, 27 Jan 2022 16:09:11 +0000 (08:09 -0800)]
Omit atomic_{,un}signed_lock_free if unsupported

On targets that have limited atomic support, e.g. ones that define
ATOMIC_*_LOCK_FREE to '1' ("sometimes lock free"), we would end up
referencing yet-undefined __libcpp_{,un}signed_lock_free.

This commit adds a guard to prevent these references for such
targets.

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

2 years ago[BOLT] Fix AARCH64 registers aliasing
Vladislav Khmelevsky [Thu, 27 Jan 2022 22:04:31 +0000 (01:04 +0300)]
[BOLT] Fix AARCH64 registers aliasing

The aarch64 platform has special registers like X0_X1_X2_X3_X4_X5_X6_X7.
Using the downwards propagation this register will become a super
register for all X0..X7 and its super registers which is not right. This
patch replaces the downwards propagation with caching all the aliases using MCRegAliasIterator.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Reviewed By: maksfb

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

2 years agounwind: fix typo for __powerpc__
Sam James [Thu, 27 Jan 2022 22:17:45 +0000 (22:17 +0000)]
unwind: fix typo for __powerpc__

Fixes: cd20e579df07517a4ddbf6eef58b96d04f6bd9a9
Signed-off-by: Sam James <sam@gentoo.org>
2 years ago[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in CreateTempAl...
Arthur Eubanks [Thu, 27 Jan 2022 22:17:58 +0000 (14:17 -0800)]
[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in CreateTempAlloca()

Specify the Address element type, which is the bitcast destination type.
(the whole bitcast won't be needed after opaque pointers)

2 years ago[SystemZ] Don't shrink 64-bit FP constants.
Jonas Paulsson [Fri, 21 Jan 2022 21:22:13 +0000 (22:22 +0100)]
[SystemZ] Don't shrink 64-bit FP constants.

Return false from ShouldShrinkFPConstant(), so that these constants are stored
in their full size on the constant pool, even if they could have been shrunk
and used with an extending load.

This is better since LD is faster than LDE, and it also enables reg/mem opcodes.

Review: Ulrich Weigand

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

2 years agoFixed typos in TestLldbGdbServer.py
Shubham Sandeep Rastogi [Thu, 27 Jan 2022 22:08:42 +0000 (14:08 -0800)]
Fixed typos in TestLldbGdbServer.py

Fixed more typos

2 years ago[SystemZ] Implement orderFrameObjects().
Jonas Paulsson [Fri, 21 Jan 2022 21:03:40 +0000 (22:03 +0100)]
[SystemZ] Implement orderFrameObjects().

By reordering the objects on the stack frame after looking at the users, a
better utilization of displacement operands will result. This means less
needed Load Address instructions for the accessing of these objects.

This is important for very large functions where otherwise small changes
could cause a lot more/less accesses go out of range.

Note: this is not yet enabled for SystemZXPLINKFrameLowering, but should be.

Review: Ulrich Weigand

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

2 years ago[libc++] Add documentation about the libc++ review group
Louis Dionne [Wed, 26 Jan 2022 20:23:04 +0000 (15:23 -0500)]
[libc++] Add documentation about the libc++ review group

This explains stuff that most contributors already know, but it's always
good to write down explicitly.

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

2 years ago[unwind] fix build with GCC on PPC32
Sam James [Thu, 27 Jan 2022 21:48:38 +0000 (21:48 +0000)]
[unwind] fix build with GCC on PPC32

Originally reported downstream in Gentoo: https://bugs.gentoo.org/832140

```
/var/tmp/portage/sys-libs/llvm-libunwind-13.0.0/work/libunwind/src/libunwind.cpp:77:3: error: #error Architecture not supported
   77 | # error Architecture not supported
      |   ^~~~~
[...]
/var/tmp/portage/sys-libs/llvm-libunwind-13.0.0/work/libunwind/src/libunwind.cpp: In function ‘int __unw_init_local(unw_cursor_t*, unw_context_t*)’:
/var/tmp/portage/sys-libs/llvm-libunwind-13.0.0/work/libunwind/src/libunwind.cpp:80:57: error: ‘REGISTER_KIND’ was not declared in this scope
   80 |   new (reinterpret_cast<UnwindCursor<LocalAddressSpace, REGISTER_KIND> *>(cursor))
      |                                                         ^~~~~~~~~~~~~
[...]
```

PPC is actually a supported architecture, but GCC (tested with 11.2.0)
on powerpc32 seems to only define: `__PPC__, _ARCH_PPC, __PPC,
__powerpc` and //not// `__ppc__`.

This instead uses `__powerpc__` which should be around on PPC32
and PPC64 (but we check it after PPC64, so it's fine).

Signed-off-by: Sam James <sam@gentoo.org>
Differential Revision: https://reviews.llvm.org/D118320

2 years agoDisable TestLldbGdbServer on Dwarf2 and clang versions below 14
Shubham Sandeep Rastogi [Thu, 27 Jan 2022 17:45:25 +0000 (09:45 -0800)]
Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

We have been noticing issues with the lldb bots on builds using versions below clang 14 and dwarf 2, so to make sure we can get clean builds for a while, we are disabling the tests for those versions

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

2 years ago[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in EmitNewArray...
Arthur Eubanks [Thu, 27 Jan 2022 21:59:02 +0000 (13:59 -0800)]
[NFC][Clang][OpaquePtr] Move away from deprecated Address constructor in EmitNewArrayInitializer()

Specify the Address element type, which is the same for all pointers in the array.

2 years ago[mlir] Set up boilerplate build for MLIR benchmarks
Saurabh Jha [Thu, 27 Jan 2022 21:35:34 +0000 (21:35 +0000)]
[mlir] Set up boilerplate build for MLIR benchmarks

This is is the start of the MLIR benchmarks. It sets up a command
line tool along with conventions to define and run benchmarks
using mlir's python bindings.

Reviewed By: aartbik

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

2 years agoRevert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"
Shubham Sandeep Rastogi [Thu, 27 Jan 2022 21:35:46 +0000 (13:35 -0800)]
Revert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"

This reverts commit cd317637708decd8faf34dd9773a8b2dec424010.

2 years ago[VectorToGPU] Fix horizontal stride calculation for N-D memref
Thomas Raoux [Thu, 27 Jan 2022 16:19:47 +0000 (08:19 -0800)]
[VectorToGPU] Fix horizontal stride calculation for N-D memref

Fix a bug in how we calculate the stride of mma load/store ops for N-D
memrefs

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

2 years ago[MLIR] Workaround for python detection problems.
Stephen Neuendorffer [Tue, 25 Jan 2022 15:53:48 +0000 (07:53 -0800)]
[MLIR] Workaround for python detection problems.

Although cmake should be platform-independent, we've observed
that some aspects of Python detection don't work on all platforms,
even with recent versions of cmake.  This appears to be due to bugs
in the python detection logic, especially when the NumPy component
is required and not located within the python installation.
As a workaround, this patch first searches for "Development" before
searching for "Development.Module", which seems to workaround the
issue.

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

2 years agoDisable TestLldbGdbServer on Dwarf2 and clang versions below 14
Shubham Sandeep Rastogi [Thu, 27 Jan 2022 17:45:25 +0000 (09:45 -0800)]
Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

We have been noticing issues with the lldb bots on builds using versions below clang 14 and dwarf 2, so to make sure we can get clean builds for a while, we are disabling the tests for those versions

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

2 years ago[compiler-rt][profile][AIX] pass extra link opts for test
David Tenty [Thu, 27 Jan 2022 03:14:19 +0000 (21:14 -0600)]
[compiler-rt][profile][AIX] pass extra link opts for test

This is a follow up to D118101, that added bexpfull to the test on instrprof-get-filename-merge-mode.c AIX, in order to get the
necessary symbols exported. But unfortunately the extra dependent symbols this exports actually cause segfaults, which is why
this isn't really recommended in the first place, so just use an actual export list.

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

2 years ago[clangd] Fix a typo , => ; in hovertest.
Haojian Wu [Thu, 27 Jan 2022 21:19:09 +0000 (22:19 +0100)]
[clangd] Fix a typo , => ; in hovertest.

I somehow missed it.

2 years ago[libc] Revert "Refactor sqrt implementations and add tests for generic sqrt implement...
Siva Chandra Reddy [Thu, 27 Jan 2022 21:06:14 +0000 (21:06 +0000)]
[libc] Revert "Refactor sqrt implementations and add tests for generic sqrt implementations."

This reverts commit 21c4c82c2026bac1f53be54923c0663d41d0a0aa.

2 years ago[libc] Revert "Guard sqrt_80_bit_long_double.h header to not be included with aarch64."
Siva Chandra Reddy [Thu, 27 Jan 2022 21:05:22 +0000 (21:05 +0000)]
[libc] Revert "Guard sqrt_80_bit_long_double.h header to not be included with aarch64."

This reverts commit 4a979c42564e622fdf283ae8d0b7a59ebe567533.

2 years ago[InstrProf][NFC] Refactor Profile kind into a bitset enum.
Snehasish Kumar [Tue, 7 Dec 2021 23:30:14 +0000 (15:30 -0800)]
[InstrProf][NFC] Refactor Profile kind into a bitset enum.

This change refactors the ProfileKind enum into a bitset enum to
represent the different attributes a profile can have. This change
simplifies the logic in the instrprof writer when multiple profiles are
merged together. In the future we plan on introducing a new memory
profile section which will extend the enum by one additional entry.
Without this change when accounting for memory profiles will have to be
maintained separately and will make the logic more complex.

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

2 years ago[OpenMP][NFCI] Pipe the IdentTy object through more new RT functions
Johannes Doerfert [Thu, 27 Jan 2022 20:36:36 +0000 (15:36 -0500)]
[OpenMP][NFCI] Pipe the IdentTy object through more new RT functions

IdentTy objects are useful for debugging and profiling so we want to
keep them around in more places, especially those that have a large
impact on performance, e.g., everything related to state.

Reviewed By: tianshilei1992

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

2 years ago[libc] Add POSIX close, fsync, open, read and write functions.
Siva Chandra Reddy [Tue, 25 Jan 2022 21:08:37 +0000 (21:08 +0000)]
[libc] Add POSIX close, fsync, open, read and write functions.

They are implemented as simple syscall wrappers. The file creation
macros have been put in a header file as a temporary solution until we
have a cleaner approach to listing platform relevant macros.

Reviewed By: abrachet

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

2 years ago[clangd] Enable hover on character literal.
Haojian Wu [Thu, 20 Jan 2022 08:30:16 +0000 (09:30 +0100)]
[clangd] Enable hover on character literal.

In the initial hover expression patch (https://reviews.llvm.org/D72500), we
disabled all literals.

There is some value on running hover on character literals (e.g. see the
int value of the char).

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

2 years ago[clangd] Fix a selection tree crash for unmatched-bracket code.
Haojian Wu [Thu, 27 Jan 2022 07:43:31 +0000 (08:43 +0100)]
[clangd] Fix a selection tree crash for unmatched-bracket code.

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

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

2 years ago[RISCV] Use std::map::count != 0 instead of std::map::count == 1. NFC
Craig Topper [Thu, 27 Jan 2022 20:12:45 +0000 (12:12 -0800)]
[RISCV] Use std::map::count != 0 instead of std::map::count == 1. NFC

Maps always return 0 or 1 for count. Comparing to 0 can create
simpler compiled code.

Someday we'll get to use std::map::contains.

2 years agoRuntime for Interop directive
Sri Hari Krishna Narayanan [Thu, 27 Jan 2022 20:15:25 +0000 (15:15 -0500)]
Runtime for Interop directive

This implements the runtime portion of the interop directive.
It expects the frontend and IRBuilder portions to be in place
for proper execution. It currently works only for GPUs
and has several TODOs that should be addressed going forward.

Reviewed By: RaviNarayanaswamy

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

2 years ago[BOLT][DWARF] Fix gdb index section
Alexander Yermolovich [Thu, 27 Jan 2022 20:03:01 +0000 (12:03 -0800)]
[BOLT][DWARF] Fix gdb index section

Since we now re-write .debug_info the DWARF CU Offsets can change.
Just like for .debug_aranges the GDB Index will need to be updated.

Reviewed By: Amir, maksfb

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

2 years agoRemove "awaiting-review" labels from closed issues.
Anton Korobeynikov [Thu, 27 Jan 2022 20:06:15 +0000 (23:06 +0300)]
Remove "awaiting-review" labels from closed issues.

Fixes #53451

2 years agoOMPIRBuilder for Interop directive
Sri Hari Krishna Narayanan [Thu, 27 Jan 2022 19:53:00 +0000 (14:53 -0500)]
OMPIRBuilder for Interop directive

Implements the OMPIRBuilder portion for the
Interop directive.

Reviewed By: jdoerfert

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

2 years ago[RISCV] Prefer vmslt.vx v0, v8, zero over vmsle.vi v0, v8, -1.
Craig Topper [Thu, 27 Jan 2022 19:47:53 +0000 (11:47 -0800)]
[RISCV] Prefer vmslt.vx v0, v8, zero over vmsle.vi v0, v8, -1.

At least when starting from a vmslt.vx intrinsic or ISD::SETLT. We
don't handle the case where the user used vmsle.vx intrinsic with -1.

2 years ago[tosa][mlir] Add dynamic shape support for remaining ops
natashaknk [Thu, 27 Jan 2022 19:25:26 +0000 (11:25 -0800)]
[tosa][mlir] Add dynamic shape support for remaining ops

Added support for concat, tile, pad, argmax and table ops

Reviewed By: rsuderman

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

2 years ago[libc++] [ranges] ref_view and empty_view are borrowed ranges. Normalize borrowed_ran...
Arthur O'Dwyer [Tue, 25 Jan 2022 17:12:47 +0000 (12:12 -0500)]
[libc++] [ranges] ref_view and empty_view are borrowed ranges. Normalize borrowed_range tests.

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

2 years ago[libc++] Fix a typo in reverse_iterator::operator=.
Arthur O'Dwyer [Wed, 19 Jan 2022 12:29:05 +0000 (07:29 -0500)]
[libc++] Fix a typo in reverse_iterator::operator=.

We should be checking `is_assignable<It&, ...>`.
`is_assignable<It, ...>` checks for an rvalue left-hand side, which
is basically never assignable-to.
Found while looking into https://cplusplus.github.io/LWG/issue3435 .

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

2 years ago[clang] Don't typo-fix an expression in a SFINAE context.
Arthur O'Dwyer [Tue, 18 Jan 2022 12:25:17 +0000 (07:25 -0500)]
[clang] Don't typo-fix an expression in a SFINAE context.

If this is a SFINAE context, then continuing to look up names
(in particular, to treat a non-function as a function, and then
do ADL) might too-eagerly complete a type that it's not safe to
complete right now. We should just say "okay, that's a substitution
failure" and not do any more work than absolutely required.

Fixes #52970.

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

2 years ago[ARM][AArch64] Introduce qrdmlah and qrdmlsh intrinsics
David Green [Thu, 27 Jan 2022 19:19:46 +0000 (19:19 +0000)]
[ARM][AArch64] Introduce qrdmlah and qrdmlsh intrinsics

Since it's introduction, the qrdmlah has been represented as a qrdmulh
and a sadd_sat. This doesn't produce the same result for all input
values though. This patch fixes that by introducing a qrdmlah (and
qrdmlsh) intrinsic specifically for the vqrdmlah and sqrdmlah
instructions. The old test cases will now produce a qrdmulh and sqadd,
as expected.

Fixes #53120 and #50905 and #51761.

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

2 years agoTrivial update for debug location in LIT test.
Malhar Jajoo [Thu, 27 Jan 2022 19:07:47 +0000 (19:07 +0000)]
Trivial update for debug location in LIT test.

This just updates debug location of a loop in a LIT test to point
to the correct source line.

2 years ago[ARM][AArch64] Cleanup and autogenerate v8.1a vqdrmlah tests. NFC
David Green [Thu, 27 Jan 2022 18:43:06 +0000 (18:43 +0000)]
[ARM][AArch64] Cleanup and autogenerate v8.1a vqdrmlah tests. NFC

2 years ago[ConstraintElimination] Use constraints with 0 or 1 coefficients.
Florian Hahn [Thu, 27 Jan 2022 18:41:33 +0000 (18:41 +0000)]
[ConstraintElimination] Use constraints with 0 or 1 coefficients.

isConditionImplied is able to correctly handle 0 or 1 coefficients, so
let it handle those cases, rather than skipping them.

2 years ago[flang] Expand the semantics test for co_sum
Damian Rouson [Thu, 9 Dec 2021 22:23:20 +0000 (14:23 -0800)]
[flang] Expand the semantics test for co_sum

Increase the coverage of standard-conforming and non-conforming
co_sum calls.

Reviewed By: ktras

2 years ago[libc] Guard sqrt_80_bit_long_double.h header to not be included with aarch64.
Tue Ly [Thu, 27 Jan 2022 17:12:38 +0000 (12:12 -0500)]
[libc] Guard sqrt_80_bit_long_double.h header to not be included with aarch64.

Guard sqrt_80_bit_long_double.h header to not be included with aarch64.

Reviewed By: sivachandra

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

2 years ago[X86] Fold MOVMSK(CONCAT(X,Y)) -> MOVMSK(AND/OR(X,Y)) for all_of/any_of patterns
Simon Pilgrim [Thu, 27 Jan 2022 17:58:29 +0000 (17:58 +0000)]
[X86] Fold MOVMSK(CONCAT(X,Y)) -> MOVMSK(AND/OR(X,Y)) for all_of/any_of patterns

Makes it easier for later folds and avoids unnecessary 256-bit ops (especially on AVX1-only targets where we miss a lot of integer instructions)

2 years ago[test] Use -passes syntax in SROA test cases
Bjorn Pettersson [Wed, 26 Jan 2022 17:15:53 +0000 (18:15 +0100)]
[test] Use -passes syntax in SROA test cases

Another step to move away from the legacy PM syntax when specifying
passes in opt.

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

2 years ago[NewPM] Add debugify and check-debugify to the PassRegistry
Bjorn Pettersson [Thu, 27 Jan 2022 15:09:24 +0000 (16:09 +0100)]
[NewPM] Add debugify and check-debugify to the PassRegistry

Adding -debugify and -check-debugify in the PassRegistry will make
sure the passes are listed properly by -print-pipeline-passes as
well as -print-passes.

It also allows removal of the custom pipeline parsing callback that
has been used in the NewPMDriver.

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

2 years ago[AMDGPU] SILoadStoreOptimizer: reject AGPR DS_WRITE sooner
Jay Foad [Thu, 27 Jan 2022 14:27:39 +0000 (14:27 +0000)]
[AMDGPU] SILoadStoreOptimizer: reject AGPR DS_WRITE sooner

Rejecting AGPR DS_WRITE instructions before adding them to any mergeable
list seems cleaner than adding them to the list and rejecting them
later.

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

2 years ago[AMDGPU] SILoadStoreOptimizer: use separate lists for AGPR instructions
Jay Foad [Thu, 27 Jan 2022 14:48:08 +0000 (14:48 +0000)]
[AMDGPU] SILoadStoreOptimizer: use separate lists for AGPR instructions

Using separate lists for AGPR and non-AGPR instructions seems like a
cleaner solution than putting them all in the same list and then later
refusing to merge instructions of different AGPR-ness.

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

2 years ago[AMDGPU] SILoadStoreOptimizer: tweak API of CombineInfo::setMI. NFC.
Jay Foad [Thu, 27 Jan 2022 14:39:42 +0000 (14:39 +0000)]
[AMDGPU] SILoadStoreOptimizer: tweak API of CombineInfo::setMI. NFC.

Change CombineInfo::setMI to take a reference to the
SILoadStoreOptimizer instance, for easy access to common fields like
TII and STM.

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

2 years ago[InstrProf][Correlate] Verify debug info with llvm-profdata show
Ellis Hoag [Wed, 26 Jan 2022 17:59:57 +0000 (09:59 -0800)]
[InstrProf][Correlate] Verify debug info with llvm-profdata show

Use the `llvm-profdata show` command to verify debug info for profile correlation using the `--debug-info` option.

Reviewed By: kyulee

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

2 years ago[lldb/test] Disable test_launch_scripted_process_stack_frames on x86_64
Med Ismail Bennani [Thu, 27 Jan 2022 17:39:55 +0000 (18:39 +0100)]
[lldb/test] Disable test_launch_scripted_process_stack_frames on x86_64

There seems to be an issue on x86_64 when launching a ScriptdProcess.
This disables temporarely the test that causes the bot to timeout until
I finish investigating the issue.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[libc][NFC] Move the POSIX write function to the default build on linux.
Siva Chandra Reddy [Thu, 27 Jan 2022 17:11:06 +0000 (17:11 +0000)]
[libc][NFC] Move the POSIX write function to the default build on linux.

2 years ago[RISCV] Use const reference when looping over Exts in RISCVISAInfo.
Craig Topper [Thu, 27 Jan 2022 08:17:33 +0000 (00:17 -0800)]
[RISCV] Use const reference when looping over Exts in RISCVISAInfo.

Exts is a map of keyed by std::string with a extension info as
a value. Making copies of this wouldn't be cheap.

We had a mix of references and copies. This makes everything
consistently use a const reference to make it clear we aren't
modifying it.

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

2 years ago[ConstraintElimination] Add additional GEP arithmetic tests.
Florian Hahn [Thu, 27 Jan 2022 17:15:43 +0000 (17:15 +0000)]
[ConstraintElimination] Add additional GEP arithmetic tests.

2 years ago[libc][NFC] Let var args be treated as a named type in the spec.
Siva Chandra Reddy [Thu, 27 Jan 2022 16:59:08 +0000 (16:59 +0000)]
[libc][NFC] Let var args be treated as a named type in the spec.

The type names in the spec are just sugar used by the header generator to
generate the function prototype. Giving the VarArgType a name of "..."
allows the header generator to treat and generate the "type name" for var
arg parameters similar to how it does for any other type.

2 years ago[clang-format] Fix AllowShortFunctionsOnASingleLine: InlineOnly with wrapping after...
Marek Kurdej [Thu, 27 Jan 2022 16:54:58 +0000 (17:54 +0100)]
[clang-format] Fix AllowShortFunctionsOnASingleLine: InlineOnly with wrapping after record.

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

Initially, I had a quick and dirty approach, but it led to a myriad of special cases handling comments (that may add unwrapped lines).
So I added TT_RecordLBrace type annotations and it seems like a much nicer solution.
I think that in the future it will allow us to clean up some convoluted code that detects records.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

2 years ago[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.
Tue Ly [Tue, 25 Jan 2022 20:11:15 +0000 (15:11 -0500)]
[libc] Refactor sqrt implementations and add tests for generic sqrt implementations.

Refactor sqrt implementations:
- Move architecture specific instructions from `src/math/<arch>` to `src/__support/FPUtil/<arch>` folder.
- Move generic implementation of `sqrt` to `src/__support/FPUtil/generic` folder and add it as a header library.
- Use `src/__support/FPUtil/sqrt.h` for architecture/generic selections.
- Add unit tests for generic implementation of `sqrt`.

Reviewed By: sivachandra

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