platform/upstream/llvm.git
2 years ago[AMDGPU][MC][GFX10] Added an alias for HW_REG_HW_ID1
Dmitry Preobrazhensky [Wed, 16 Feb 2022 16:43:19 +0000 (19:43 +0300)]
[AMDGPU][MC][GFX10] Added an alias for HW_REG_HW_ID1

Enabled HW_REG_HW_ID as an alias for HW_REG_HW_ID1. This is required for compatibility with existing code.

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

2 years ago[OpenMP] Pass AMDGPU math libraries into the linker wrapper
Joseph Huber [Tue, 15 Feb 2022 14:57:54 +0000 (09:57 -0500)]
[OpenMP] Pass AMDGPU math libraries into the linker wrapper

This patch passes in the AMDPGU math libraries to the linker wrapper.
The wrapper already handles linking OpenMP bitcode libraries via the
`--target-library` option. This should be sufficient to link in math
libraries for the accompanying architecture.

Fixes #53526.

Reviewed By: jdoerfert

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

2 years agoDarwin: introduce a global override for debug prefix map entries.
Adrian Prantl [Tue, 15 Feb 2022 16:23:16 +0000 (08:23 -0800)]
Darwin: introduce a global override for debug prefix map entries.

This patch adds a new Darwin clang driver environment variable in the
spirit of RC_DEBUG_OPTIONS, called RC_DEBUG_PREFIX_MAP, which allows a
meta build tool to add one additional -fdebug-prefix-map entry without
the knowledge of the build system.

rdar://85224675

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

2 years ago[libc++][ci] Allow updating packages and config files on macOS CI nodes
Louis Dionne [Wed, 16 Feb 2022 16:23:48 +0000 (11:23 -0500)]
[libc++][ci] Allow updating packages and config files on macOS CI nodes

2 years ago[PowerPC] Rename PPCInstrPrefix.td to PPCInstrP10.td
Lei Huang [Wed, 16 Feb 2022 15:36:04 +0000 (09:36 -0600)]
[PowerPC] Rename PPCInstrPrefix.td to PPCInstrP10.td

2 years ago[mlir][linalg] Add control to pad-slice swap pattern
Lei Zhang [Wed, 16 Feb 2022 15:28:51 +0000 (10:28 -0500)]
[mlir][linalg] Add control to pad-slice swap pattern

The pad-slice swap pattern generates `scf.if` and `tensor.generate`
to guard against zero-sized slices if it cannot prove the slice is
always non-zero. This is safe but quite conservative. It can be
unnecessary for cases where we know by problem definition such cases
does not exist, even if with dynamic shaped ops or unknown tile/slice
sizes, e.g., convolution padding size = 1 with kernel dim size = 3.

So this commit introduces a control to the pattern to specify
whether to generate the if constructs to handle such cases better,
given that once the if constructs is materialized, it's very hard
to analyze and simplify.

Reviewed By: mravishankar

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

2 years ago[mlir][MemRef] Lower memref.copy with an offset to memcpy
Benjamin Kramer [Wed, 16 Feb 2022 13:52:53 +0000 (14:52 +0100)]
[mlir][MemRef] Lower memref.copy with an offset to memcpy

memcpy can handle them as long as they're contiguous.

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

2 years ago[libc++] [test] Qualify calls to std::get(tuple). NFC.
Arthur O'Dwyer [Mon, 14 Feb 2022 03:52:25 +0000 (22:52 -0500)]
[libc++] [test] Qualify calls to std::get(tuple). NFC.

It actually *is* important (for structured bindings) that `get(tuple)`
be ADL-able; but that's not the point of this test in particular.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify calls to std::rethrow_exception. NFC.
Arthur O'Dwyer [Mon, 14 Feb 2022 03:44:23 +0000 (22:44 -0500)]
[libc++] [test] Qualify calls to std::rethrow_exception. NFC.

We shouldn't be calling `rethrow_exception` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `rethrow_exception` in particular.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify calls to std::atomic_flag_{clear,test} functions. NFCI.
Arthur O'Dwyer [Mon, 14 Feb 2022 02:53:20 +0000 (21:53 -0500)]
[libc++] [test] Qualify calls to std::atomic_flag_{clear,test} functions. NFCI.

We shouldn't be calling these functions via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
the ADL ability of these functions in particular.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify calls to std::getline. NFCI.
Arthur O'Dwyer [Mon, 14 Feb 2022 02:48:39 +0000 (21:48 -0500)]
[libc++] [test] Qualify calls to std::getline. NFCI.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify calls to iomanip functions in std/input.output/iostream.forma...
Arthur O'Dwyer [Mon, 14 Feb 2022 02:46:06 +0000 (21:46 -0500)]
[libc++] [test] Qualify calls to iomanip functions in std/input.output/iostream.format/. NFCI.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify calls to iomanip functions in std/localization/. NFCI.
Arthur O'Dwyer [Mon, 14 Feb 2022 01:36:36 +0000 (20:36 -0500)]
[libc++] [test] Qualify calls to iomanip functions in std/localization/. NFCI.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify `prev` as `std::prev` in a lot of tests. NFCI.
Arthur O'Dwyer [Mon, 14 Feb 2022 01:09:41 +0000 (20:09 -0500)]
[libc++] [test] Qualify `prev` as `std::prev` in a lot of tests. NFCI.

We shouldn't be calling `prev` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `prev` in particular.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify `next` as `std::next` in a lot of tests. NFCI.
Arthur O'Dwyer [Sun, 13 Feb 2022 19:50:33 +0000 (14:50 -0500)]
[libc++] [test] Qualify `next` as `std::next` in a lot of tests. NFCI.

We shouldn't be calling `next` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `next` in particular.

Reviewed as part of D119860.

2 years ago[libc++] [test] Qualify `move` as `std::move` in a lot of tests. NFCI.
Arthur O'Dwyer [Sun, 13 Feb 2022 19:58:27 +0000 (14:58 -0500)]
[libc++] [test] Qualify `move` as `std::move` in a lot of tests. NFCI.

We shouldn't be calling `move` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `move` in particular.

Reviewed as part of D119860.

2 years ago[libc++] LWG2148, LWG2543: Enable std::hash<Enum> in C++03 and C++11.
Arthur O'Dwyer [Tue, 15 Feb 2022 21:38:34 +0000 (16:38 -0500)]
[libc++] LWG2148, LWG2543: Enable std::hash<Enum> in C++03 and C++11.

Fixes #49601.

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

2 years ago[libc++] [test] Remove `using std::any{,_cast}` from std/utilities/any/. NFCI.
Arthur O'Dwyer [Mon, 14 Feb 2022 01:45:23 +0000 (20:45 -0500)]
[libc++] [test] Remove `using std::any{,_cast}` from std/utilities/any/. NFCI.

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

2 years ago[libc++] [test] Remove `using std::{make_,}optional` from the optional tests.
Arthur O'Dwyer [Mon, 14 Feb 2022 01:23:39 +0000 (20:23 -0500)]
[libc++] [test] Remove `using std::{make_,}optional` from the optional tests.

Drive-by remove some use of raw `new`, and expand test coverage a tiny bit.

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

2 years agoPrecommit tests from D119844, expanded with additional coverage
Philip Reames [Wed, 16 Feb 2022 15:55:35 +0000 (07:55 -0800)]
Precommit tests from D119844, expanded with additional coverage

2 years ago[clang] [test] [NFC] Eliminate some hard tabs in tests
Arthur O'Dwyer [Wed, 16 Feb 2022 15:41:44 +0000 (10:41 -0500)]
[clang] [test] [NFC] Eliminate some hard tabs in tests

"cxx2b-consteval-if.cpp" was showing up misindented.

2 years ago[BOLT] Update dynamic relocations from section relocations
Vladislav Khmelevsky [Wed, 16 Feb 2022 15:13:44 +0000 (18:13 +0300)]
[BOLT] Update dynamic relocations from section relocations

This patch changes patchELFAllocatableRelaSections from going through
old relocations sections and update the relocation offsets to emitting
the relocations stored in binary sections. This is needed in case we
would like to remove and add dynamic relocations during BOLT work and it
is used by golang support pass. Note: Currently we emit relocations in
the old sections, so the total number of them should be equal or less
of old number.

Testing: No special tests are neeeded, since this patch does not fix
anything or add new functionality (it only prepares to add). Every
PIC-compiled test binary will use this code and thus become a test.
But just in case the aarch64 dynamic relocations tests were added.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Reviewed By: maksfb

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

2 years ago[LowerMemIntrinsics] Explicitly use i8 type in memmove lowering
Nikita Popov [Wed, 16 Feb 2022 15:29:10 +0000 (16:29 +0100)]
[LowerMemIntrinsics] Explicitly use i8 type in memmove lowering

By convention, memcpy/memmove intrinsics are always used with i8
pointers (though this is not enforced), so in practice this code
was always using an i8 type. Make that explicit.

Of course, i8 is not a very profitable choice, and this code could
be more performant by picking an appropriate larger type. But that
would require additional test coverage and correctness review, and
certainly shouldn't be a decision based on the pointer element type.

2 years ago[libc++] Pass -fcxx-modules during our modules builds
Louis Dionne [Tue, 15 Feb 2022 18:10:16 +0000 (13:10 -0500)]
[libc++] Pass -fcxx-modules during our modules builds

Otherwise, AppleClang ignores -fmodules entirely, so we are not actually
testing anything.

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

2 years ago[OpenCL] Ensure atomic_init is guarded with extension
Sven van Haastregt [Wed, 16 Feb 2022 15:12:23 +0000 (15:12 +0000)]
[OpenCL] Ensure atomic_init is guarded with extension

The named and generic address space overloads for atomic_init added
by 50f8abb9f40a ("[OpenCL] Add OpenCL 3.0 atomics to
-fdeclare-opencl-builtins", 2022-02-11) were not guarded by the
corresponding extensions.

2 years ago[FPEnv][InstSimplify] Fold fsub X, -0 ==> X, when we know X is not -0
Kevin P. Neal [Mon, 14 Feb 2022 18:53:42 +0000 (13:53 -0500)]
[FPEnv][InstSimplify] Fold fsub X, -0 ==> X, when we know X is not -0

Currently the fsub optimizations in InstSimplify don't know how to fold
X - -0.0 to X when we know X is not zero and the constrained intrinsics
are used. This adds the support.

This review is split out from D107285.

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

2 years ago[libc] Improve hypotf performance with different algorithm correctly rounded to all...
Tue Ly [Tue, 25 Jan 2022 16:47:09 +0000 (11:47 -0500)]
[libc] Improve hypotf performance with different algorithm correctly rounded to all rounding modes.

Algorithm for hypotf: compute (a*a + b*b) in double precision, then use Dekker's algorithm to find the rounding error, and then correcting it after taking its square-root.

Reviewed By: sivachandra

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

2 years ago[runtimes] Deprecate FOO_SYSROOT & friends
Louis Dionne [Tue, 15 Feb 2022 13:18:38 +0000 (08:18 -0500)]
[runtimes] Deprecate FOO_SYSROOT & friends

As suggested in https://reviews.llvm.org/D112155.

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

2 years agoReland: Make lld-link work in a non-MSVC shell, add /winsysroot:
Peter Kasting [Wed, 16 Feb 2022 14:20:03 +0000 (09:20 -0500)]
Reland: Make lld-link work in a non-MSVC shell, add /winsysroot:

This relands 73e585e44d (and 0574b5fc657451), with a fix for
the failing test (by using Optional<StringRef>s instead of
making StringRef::empty() mean absence of value).

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

2 years ago[CGBuilder] Assert that CreateAddrSpaceCast does not change element type
Nikita Popov [Wed, 16 Feb 2022 13:59:42 +0000 (14:59 +0100)]
[CGBuilder] Assert that CreateAddrSpaceCast does not change element type

Address space casts in general may change the element type, but
don't allow it in the method working on Address, so we can
preserve the element type.

CreatePointerBitCastOrAddrSpaceCast() still needs to be addressed.

2 years ago[InstCombine] add test for min/max intrinsic reassociation; NFC
Sanjay Patel [Wed, 16 Feb 2022 13:26:16 +0000 (08:26 -0500)]
[InstCombine] add test for min/max intrinsic reassociation; NFC

D119851

2 years ago[DSE] Fall back to CFG scan for unreachable terminators.
Florian Hahn [Wed, 16 Feb 2022 14:06:40 +0000 (14:06 +0000)]
[DSE] Fall back to CFG scan for unreachable terminators.

Blocks with UnreachableInst terminators are considered as root nodes in
the PDT. This pessimize DSE, if there are no aliasing reads from the
potentially dead store and the block with the unreachable terminator.

If any of the root nodes of the PDF has UnreachableInst as terminator,
fall back to the CFG scan, even the common dominator of all killing
blocks does not post-dominate the block with potentially dead store.

It looks like the compile-time impact for the extra scans is negligible.
https://llvm-compile-time-tracker.com/compare.php?from=779bbbf27fe631154bdfaac7a443f198d4654688&to=ac59945f1bec1c6a7d7f5590c8c69fd9c5369c53&stat=instructions

Fixes #53800.

Reviewed By: nikic

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

2 years ago[Bazel] Update llvm-config.h to follow the typo fix.
Adrian Kuegel [Wed, 16 Feb 2022 13:55:11 +0000 (14:55 +0100)]
[Bazel] Update llvm-config.h to follow the typo fix.

2 years ago[MemCpyOpt] Fix broken check lines (NFC)
Nikita Popov [Wed, 16 Feb 2022 13:38:03 +0000 (14:38 +0100)]
[MemCpyOpt] Fix broken check lines (NFC)

These are leftovers from when there were separate MSSA/non-MSSA
check lines.

2 years agoCompiler-rt: build fp_mode.c for macho_embedded variants too.
Tim Northover [Wed, 16 Feb 2022 13:36:43 +0000 (13:36 +0000)]
Compiler-rt: build fp_mode.c for macho_embedded variants too.

It provides some functions needed by add/sub.

2 years agoFix 2 RestructuredText warnings.
Kristof Beyls [Wed, 16 Feb 2022 13:15:04 +0000 (14:15 +0100)]
Fix 2 RestructuredText warnings.

2 years ago[DAG] computeKnownBits - add ISD::AVGCEILU handling
Simon Pilgrim [Wed, 16 Feb 2022 12:26:18 +0000 (12:26 +0000)]
[DAG] computeKnownBits - add ISD::AVGCEILU handling

Expand the ISD::AVGCEILU to determine the known bits of the result.

First part of PR53622

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

2 years ago[clang-format] Add test for SpacesInLineCommentPrefix. NFC.
Marek Kurdej [Wed, 16 Feb 2022 12:54:55 +0000 (13:54 +0100)]
[clang-format] Add test for SpacesInLineCommentPrefix. NFC.

Fixes https://github.com/llvm/llvm-project/issues/52649.
This was already fixed in commit https://github.com/llvm/llvm-project/commit/e967d97a35a93c883528a9672159edff05f5addb.

2 years ago[Docs][OpenCL] Update OpenCL 3.0 status in docs.
Anastasia Stulova [Wed, 16 Feb 2022 12:05:55 +0000 (12:05 +0000)]
[Docs][OpenCL] Update OpenCL 3.0 status in docs.

Reflect the latest development in clang docs.

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

2 years ago[demangler] Reorder parseNestedName loop
Nathan Sidwell [Tue, 25 Jan 2022 20:31:01 +0000 (12:31 -0800)]
[demangler] Reorder parseNestedName loop

parseNestedName's main loop allowed parsing a grammar that was more
flexible than the actual grammar.  This refactors that to rule out
some more incorrect manglings.

1) The 'L' extension only applies to unqualified-name components, so
check it just there.

2) The 'M' suffix is, AFAICT, removed from the grammar.  Rather than
eliminate it, let's parse it after we've parsed a component.

Added some additional bad mangling tests, which are now rejected.

I don't break the 'T' and 'D[tT]' cases out of the loop, even though
they can only appear at first position, as it seems simpler to just
check there is nothing SoFar.

Reviewed By: ChuanqiXu

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

2 years ago[clang] Itanium mangler constructors
Nathan Sidwell [Fri, 11 Feb 2022 16:20:28 +0000 (08:20 -0800)]
[clang] Itanium mangler constructors

The Itanium mangler constructors use both NSDMI and explicit member
construction for default values.  This is confusing.

*) Use NSDMIs wherever possible

*) Use forwarding ctor for the nesting case with an
 llvm::raw_null_ostream (and explicitly set NullOut flag in that ctor).

*) Copy the ModuleSubstitutions.  This is a bug with no effect in the
 current mangling, but not in the newer mangling.

Reviewed By: ChuanqiXu

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

2 years ago[ELF][test] Fix build break after 20bdd3e23263
Nemanja Ivanovic [Wed, 16 Feb 2022 11:56:25 +0000 (05:56 -0600)]
[ELF][test] Fix build break after  20bdd3e23263

The added run lines build a bitcode file for x86 and an object file
for whatever the default target is that is running the test. This
causes an incompatibility between the files.
Add the triple to the llvm-mc invocation.

2 years ago[MemCpyOpt] Add tests with incorrect memcpy->byval forwarding.
Florian Hahn [Wed, 16 Feb 2022 11:35:14 +0000 (11:35 +0000)]
[MemCpyOpt] Add tests with incorrect memcpy->byval forwarding.

Add a few test cases with clobbers (writes and lifetime.end) that should
prevent memcpy->byval forwarding, but those clobbers are missed at the
moment.

2 years ago[flang] Fix `LoweringBridge::validModule`
Andrzej Warzynski [Mon, 14 Feb 2022 12:18:14 +0000 (12:18 +0000)]
[flang] Fix `LoweringBridge::validModule`

This patch updates `validModule` not to use `getModule`.  `getModule`
will dereference `module`, but that will lead to a seg-fault if `module`
is a `nullptr`.

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

2 years ago[Debugify] Mark mir-check-debugify change nothing of input
Shengchen Kan [Wed, 16 Feb 2022 04:43:08 +0000 (12:43 +0800)]
[Debugify] Mark mir-check-debugify change nothing of input

Reviewed By: pengfei

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

2 years ago[lldb] Enable TestThreadStepOut on linux
Pavel Labath [Wed, 16 Feb 2022 10:16:36 +0000 (11:16 +0100)]
[lldb] Enable TestThreadStepOut on linux

After applying the same for as in TestThreadBacktraceRepeat, the test
appears to pass reliably. The skip decorator was added many years ago,
so it's not clear whether this is what caused it to hang.

2 years ago[OpenCL] Guard atomic_double with cl_khr_int64_*
Sven van Haastregt [Wed, 16 Feb 2022 10:07:35 +0000 (10:07 +0000)]
[OpenCL] Guard atomic_double with cl_khr_int64_*

It is necessary to guard atomic_double type according to
https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#_footnotedef_54.
Platform that disable cl_khr_int64_base_atomics and
cl_khr_int64_extended_atomics will have compiling errors even if
atomic_double is not used.

Patch by Haonan Yang.

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

2 years agoAdd a case for Rust in LLDB's PDB reader
Arlo Siemsen [Wed, 16 Feb 2022 09:53:00 +0000 (09:53 +0000)]
Add a case for Rust in LLDB's PDB reader

D115300 added Rust as a new PDB language type.

This change allows LLDB to recognize the new language type.

Reviewed By: rnk

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

2 years ago[analyzer] Remove breaking RUN line in the test case
Balazs Benics [Wed, 16 Feb 2022 09:56:18 +0000 (10:56 +0100)]
[analyzer] Remove breaking RUN line in the test case

This is a followup for D118690.
I'm removing the offending RUN line, to resolve the build breakage:

https://lab.llvm.org/buildbot/#/builders/91/builds/3975/steps/8/logs/stdio

Exit Code: 1
Command Output (stderr):
--
/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/clang/test/Analysis/analyze-function-guide.cpp:58:22:
error: CHECK-EMPTY2-NOT: excluded string found in input
// CHECK-EMPTY2-NOT: Every top-level function was skipped.
                     ^
<stdin>:1:1: note: found here
Every top-level function was skipped.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

2 years agoRevert "Revert "[M68k] Adopt VarLenCodeEmitter for control instructions""
Sheng [Wed, 16 Feb 2022 09:29:22 +0000 (17:29 +0800)]
Revert "Revert "[M68k] Adopt VarLenCodeEmitter for control instructions""

This reverts commit 69a7d49de6a0368c0ba1aec4d8e2ced11c705c2f.

llvm/test/MC/M68k/Relaxations/branch.s needs disassembler support.

So I disabled it temporarily

2 years agoRevert "Revert "[analyzer] Prevent misuses of -analyze-function""
Balazs Benics [Wed, 16 Feb 2022 09:33:21 +0000 (10:33 +0100)]
Revert "Revert "[analyzer] Prevent misuses of -analyze-function""

This reverts commit 620d99b7edc64ee87b1ce209f179305e6a919006.

Let's see if removing the two offending RUN lines makes this patch pass.
Not ideal to drop tests but, it's just a debugging feature, probably not
that important.

2 years agoRevert "[M68k] Adopt VarLenCodeEmitter for control instructions"
Sheng [Wed, 16 Feb 2022 09:08:34 +0000 (17:08 +0800)]
Revert "[M68k] Adopt VarLenCodeEmitter for control instructions"

This reverts commit 9ffd498fcbd92c6843b969bfa2a475aaacc54a5b.

This patch introduce regression on MC/M68k/Relaxations/branch.s

2 years ago[libunwind] Only include cet.h if __CET__ defined
Nikita Popov [Sat, 12 Feb 2022 09:29:33 +0000 (10:29 +0100)]
[libunwind] Only include cet.h if __CET__ defined

We should not assume that the cet.h header exists just because
we're on x86 linux. Only include it if __CET__ is defined. This
makes the code more similar to what compiler-rt does in
https://github.com/llvm/llvm-project/blob/ee423d93ead39e94c2970b3cc7ef6e6faa75d10b/compiler-rt/lib/builtins/assembly.h#L17
(though that one also has a __has_include() check -- I've not found
that to be necessary).

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

2 years ago[Support] Use posix_madvise() if available
Nikita Popov [Tue, 15 Feb 2022 17:11:19 +0000 (18:11 +0100)]
[Support] Use posix_madvise() if available

This is a followup to D119695 using the suggestion by joerg. Rather
than manually declaring madvise() on __sun__, this uses
posix_madvise() if available, which does get declared properly on
Illumos.

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

2 years ago[NFC] Fix intel intrinsics test for PowerPC
Qiu Chaofan [Wed, 16 Feb 2022 08:16:30 +0000 (16:16 +0800)]
[NFC] Fix intel intrinsics test for PowerPC

These tests are dumped without optimization, which makes them too
lengthy and contain meaningless load/stores. Clean them up to prepare
for future headers update.

2 years ago[Bitstream] Remove pessimizing move
Jan Svoboda [Wed, 16 Feb 2022 07:19:06 +0000 (08:19 +0100)]
[Bitstream] Remove pessimizing move

Commit 4a794d848ce81f41c6e23a4d3d3f70c2d7d1baa4 caused build failure with -Werror -Wpessimizing-move on the clang-ppc64-aix buildbot. This patch applies Clang's suggestion to remove `std::move`.

2 years ago[RISCV] Add the passthru operand for some RVV nomask unary and nullary intrinsics.
Zakk Chen [Tue, 15 Feb 2022 03:26:38 +0000 (19:26 -0800)]
[RISCV] Add the passthru operand for some RVV nomask unary and nullary intrinsics.

The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.

My plan is to handle more complex operations in follow-up patches.

Reviewers: frasercrmck

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

2 years ago[lib][Obvious] Fix style in a few include directives.
Siva Chandra Reddy [Wed, 16 Feb 2022 05:48:10 +0000 (05:48 +0000)]
[lib][Obvious] Fix style in a few include directives.

2 years ago[ValueTracking] Checking haveNoCommonBitsSet for (x & y) and ~(x | y)
Chuanqi Xu [Tue, 25 Jan 2022 03:12:25 +0000 (11:12 +0800)]
[ValueTracking] Checking haveNoCommonBitsSet for (x & y) and ~(x | y)

This one tries to fix:
https://github.com/llvm/llvm-project/issues/53357.

Simply, this one would check (x & y) and ~(x | y) in
haveNoCommonBitsSet. Since they shouldn't have common bits (we could
traverse the case by enumerating), and we could convert this one to (x &
y) | ~(x | y) . Then the compiler could handle it in
InstCombineAndOrXor.
Further more, since ((x & y) + (~x & ~y)) would be converted to ((x & y)
+ ~(x | y)), this patch would fix it too.

https://alive2.llvm.org/ce/z/qsKzRS

Reviewed By: spatel, xbolva00, RKSimon, lebedev.ri

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

2 years ago[C++20] [Coroutines] Implement return value optimization for get_return_object
Chuanqi Xu [Mon, 10 Jan 2022 11:18:33 +0000 (19:18 +0800)]
[C++20] [Coroutines] Implement return value optimization for get_return_object

This patch tries to implement RVO for coroutine's return object got from
get_return_object.
From [dcl.fct.def.coroutine]/p7 we could know that the return value of
get_return_object is either a reference or a prvalue. So it makes sense
to do copy elision for the return value. The return object should be
constructed directly into the storage where they would otherwise be
copied/moved to.

Test Plan: folly, check-all

Reviewed By: junparser

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

2 years ago[NFC][MC] remove unused argument `MCRegisterInfo` in `MCCodeEmitter`
Shao-Ce SUN [Wed, 16 Feb 2022 05:09:59 +0000 (13:09 +0800)]
[NFC][MC] remove unused argument `MCRegisterInfo` in `MCCodeEmitter`

Reviewed By: skan

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

2 years ago[TableGen][VarLenCodeEmitterGen] Improve the error message
Sheng [Wed, 16 Feb 2022 04:56:05 +0000 (12:56 +0800)]
[TableGen][VarLenCodeEmitterGen] Improve the error message

This gives a approximate error location. Although not very
accurate, it suffices to debug.

Reviewed By: myhsu

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

2 years ago[M68k] Adopt VarLenCodeEmitter for control instructions
Sheng [Wed, 16 Feb 2022 04:54:04 +0000 (12:54 +0800)]
[M68k] Adopt VarLenCodeEmitter for control instructions

Refactor the instructions in M68kInstrControl.td to use the VarLenCodeEmitter.

This patch is tested by the existing test cases.

Reviewed By: myhsu, ricky26

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

2 years ago[M68k][VarLenCodeEmitter] Support reloc & pc-rel immediate values
Min-Yih Hsu [Fri, 17 Dec 2021 02:06:19 +0000 (10:06 +0800)]
[M68k][VarLenCodeEmitter] Support reloc & pc-rel immediate values

Supporting relocatable and pc-relative immediate values for the new code
emitter.

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

2 years ago[lldb] Don't rely on wrapping in PutRawBytes/PutBytesAsRawHex8
Jonas Devlieghere [Wed, 16 Feb 2022 04:35:52 +0000 (20:35 -0800)]
[lldb] Don't rely on wrapping in PutRawBytes/PutBytesAsRawHex8

I was looking at Stream::PutRawBytes and thought I spotted a bug because
both loops are using `i < src_len` as the loop condition despite them
iterating in opposite directions.

On closer inspection, the existing code is correct, because it relies on
well-defined unsigned integer wrapping. Correct doesn't mean readable,
so this patch changes the loop condition to compare against 0 when
decrementing i while still covering the edge case of src_len potentially
being 0 itself.

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

2 years agoRevert [SystemZ][z/OS] Fix f32 variadic argument assertion
Mubariz Afzal [Wed, 16 Feb 2022 04:25:50 +0000 (23:25 -0500)]
Revert [SystemZ][z/OS] Fix f32 variadic argument assertion

This reverts ea0676f97d734196b15da7553cd407e6a36cef2d

2 years ago[MemoryDependency] Relax the re-ordering with volatile store.
Serguei Katkov [Tue, 15 Feb 2022 08:30:58 +0000 (15:30 +0700)]
[MemoryDependency] Relax the re-ordering with volatile store.

Volatile store does not provide any special rules for reordering with
atomics. Usual must alias anaylsis is enough here.

This makes the bahavior similar to how volatile load is handled.

Reviewers: reames, nikic
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D119818

2 years agoRevert "[NFC][MC] remove unused argument `MCRegisterInfo` in `MCCodeEmitter`"
Shao-Ce SUN [Wed, 16 Feb 2022 03:57:49 +0000 (11:57 +0800)]
Revert "[NFC][MC] remove unused argument `MCRegisterInfo` in `MCCodeEmitter`"

This reverts commit fe25c06cc5bdc2ef9427309f8ec1434aad69dc7a.

2 years ago[NFC][MC] remove unused argument `MCRegisterInfo` in `MCCodeEmitter`
Shao-Ce SUN [Tue, 15 Feb 2022 15:47:36 +0000 (23:47 +0800)]
[NFC][MC] remove unused argument `MCRegisterInfo` in `MCCodeEmitter`

For ten years, it seems that `MCRegisterInfo` is not used by any target.

Reviewed By: skan

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

2 years agoRewrite much of the index page for libc
Jeff Bailey [Wed, 16 Feb 2022 03:45:57 +0000 (03:45 +0000)]
Rewrite much of the index page for libc

The prior page was the proposal doc, this one is now
more about what the project intends to do, written in the
present tense.

Reviewed By: sivachandra

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

2 years ago[MachineSink] Use SkipPHIsAndLabels for sink insertion points
Carl Ritson [Wed, 16 Feb 2022 02:56:54 +0000 (11:56 +0900)]
[MachineSink] Use SkipPHIsAndLabels for sink insertion points

For AMDGPU the insertion point for a block may not be the first
non-PHI instruction.  This happens when a block contains EXEC
mask manipulation related to control flow (converging lanes).

Use SkipPHIsAndLabels to determine the block insertion point
so that the target can skip any block prologue instructions.

Reviewed By: rampitec, ruiling

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

2 years agoImplement basic loader for Linux aarch64
Jeff Bailey [Sat, 12 Feb 2022 19:01:37 +0000 (19:01 +0000)]
Implement basic loader for Linux aarch64

This implements a basic arm64 loader for Linux, and all the currently
enabled linker tests pass.  TLS is not implemented, and functions
using it will have undefined behaviour.  Notably, the TLS test is
currently disabled on x86_64.

Much of the structure is copied from x86_64 to allow for a refactoring
of the start code between architectures.

Tested:
ninja libc_loader_tests on aarch64-linux.

Co-authored-by: Raman Tenneti <rtenneti@google.com>
Reviewed By: sivachandra

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

2 years ago[MemoryDepndency] Add a test for re-ordering with volatile load/store.
Serguei Katkov [Tue, 15 Feb 2022 08:30:58 +0000 (15:30 +0700)]
[MemoryDepndency] Add a test for re-ordering with volatile load/store.

2 years agoRevert "[NFC] Update new warning to test"
Nico Weber [Wed, 16 Feb 2022 03:23:26 +0000 (22:23 -0500)]
Revert "[NFC] Update new warning  to test"

This reverts commit 25cdf87b13eb990eb84d31211280f4b0d5d470b3.
125abb61f7ae reverted the patch.

It is incorrect to update this file when a flagless warning is added.
This test exists to make sure _all_ warnings are behind a flag.
The right fix is to put the new warning in a warning group (so that
it can be toggled with a flag), not to update the list here.

2 years ago[libc++] Remove cpp17_input_iterator.h
Nikolas Klauser [Tue, 15 Feb 2022 20:52:21 +0000 (21:52 +0100)]
[libc++] Remove cpp17_input_iterator.h

Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

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

2 years ago[mlir][Linalg] Add pattern for folding reshape by collapsing.
Mahesh Ravishankar [Mon, 7 Feb 2022 03:43:52 +0000 (03:43 +0000)]
[mlir][Linalg] Add pattern for folding reshape by collapsing.

Fusion of `linalg.generic` with
`tensor.expand_shape/tensor.collapse_shape` currently handles fusion
with reshape by expanding the dimensionality of the `linalg.generic`
operation. This helps fuse elementwise operations better since they
are fused at the highest dimensionality while keeping all indexing
maps involved projected permutations. The intent of these is to push
the reshape to the boundaries of functions.

The presence of named ops (or other ops across which the reshape
cannot be propagated) stops the propagation to the edges of the
function. At this stage, the converse patterns that fold the reshapes
with generic ops by collapsing the dimensions of the generic op can
push the reshape towards edges. In particular it helps the case where
reshapes exist in between named ops and generic ops.

`linalg.named_op` -> `tensor.expand_shape` -> `linalg.generic`

Pushing the reshape down will help fusion of `linalg.named_op` ->
`linalg.generic` using tile + fuse transformations.

This pattern is intended to replace the following patterns

1) FoldReshapeByLinearization : These patterns create indexing maps
that are not projected permutations that affect future
transformations. They are only useful for folding unit-dimensions.
2) PushReshapeByExpansion : This pattern has the same functionality
but has some restrictions
    a) It tries to avoid creating new reshapes that limits its
    applicability. The pattern added here can achieve the same
    functionality through use of the `controlFn` that allows clients
    of the pattern freedom to make this decision.
    b) It does not work for ops with indexing semantics.

These patterns will be deprecated in a future patch.

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

2 years ago[libc++] Granularize algorithm includes
Nikolas Klauser [Tue, 15 Feb 2022 17:18:08 +0000 (18:18 +0100)]
[libc++] Granularize algorithm includes

Reviewed By: Mordante, ldionne, Quuxplusone, #libc, #libc_abi

Spies: #libc_vendors, libcxx-commits, miyuki

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

2 years agoRevert "Add support for floating-point option `ffp-eval-method` and for"
Nico Weber [Wed, 16 Feb 2022 03:02:25 +0000 (22:02 -0500)]
Revert "Add support for floating-point option `ffp-eval-method` and for"

This reverts commit 4bafe65c2b2f1ce745894a509a6d80c87fb1c335.
Breaks at least Misc/warning-flags.c, see comments on
https://reviews.llvm.org/D109239

2 years ago[NFC] Update new warning to test
Chuanqi Xu [Wed, 16 Feb 2022 02:44:20 +0000 (10:44 +0800)]
[NFC] Update new warning  to test

This tries to fix the broke test introduced in
4bafe65c2b2f1ce745894a509a6.

2 years ago[FuncSpec] Save compilation time by caching uses for propagation
Bin Cheng [Tue, 15 Feb 2022 08:51:04 +0000 (16:51 +0800)]
[FuncSpec] Save compilation time by caching uses for propagation

We only need to do propagation on use instructions of the original
value, rather than the replacing const value which might have lots
of irrelavant uses.  This is done by caching uses before replacing.

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

2 years ago[RISCV] Add the passthru operand for RVV nomask binary intrinsics.
Zakk Chen [Mon, 14 Feb 2022 01:28:44 +0000 (17:28 -0800)]
[RISCV] Add the passthru operand for RVV nomask binary intrinsics.

The goal is support tail and mask policy in RVV builtins.
We focus on IR part first.
If the passthru operand is undef, we use tail agnostic, otherwise
use tail undisturbed.

Add passthru operand for VSLIDE1UP_VL and VSLIDE1DOWN_VL to support
i64 scalar in rv32.

The masked VSLIDE1 would only emit mask undisturbed policy regardless
of giving mask agnostic policy until InsertVSETVLI supports mask agnostic.

Reviewed by: craig.topper, rogfer01

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

2 years ago[lld-macho][nfc] Clean up trailing spaces and tabs
Jez Ng [Wed, 16 Feb 2022 02:28:18 +0000 (21:28 -0500)]
[lld-macho][nfc] Clean up trailing spaces and tabs

2 years agoAMDGPU: Use subtarget in class instead of querying function
Matt Arsenault [Tue, 15 Feb 2022 22:18:32 +0000 (17:18 -0500)]
AMDGPU: Use subtarget in class instead of querying function

2 years ago[lld-macho][nfc] Factor out callgraph parsing code
Jez Ng [Wed, 16 Feb 2022 02:13:41 +0000 (21:13 -0500)]
[lld-macho][nfc] Factor out callgraph parsing code

`parseSections()` is a getting a bit large unwieldy, let's factor out
logic where we can.

Other minor changes in this diff:
* `"__cg_profile"` is now a global constexpr
* We now use `checkError()` instead of `fatal()`-ing without handling
  the Error
* Check for `callGraphProfileSort` before checking the section name,
  since the boolean comparison is likely cheaper

Reviewed By: #lld-macho, lgrey, oontvoo

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

2 years ago[BOLT][DWARF] Add ability to insert new entries in to DIE
Alexander Yermolovich [Wed, 16 Feb 2022 02:06:03 +0000 (18:06 -0800)]
[BOLT][DWARF] Add ability to insert new entries in to DIE

Added ability to append new entries to DIE. This is useful to standadize DWARF4
Split Dwarf, and simplify implementation of DWARF5.
Multiple DIEs can share an abbrev. So currently limitation is that only unique
Attributes can be added.

Reviewed By: maksfb

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

2 years agoFix crash when deserializing a lambda expression in a decltype.
Richard Smith [Wed, 16 Feb 2022 01:55:35 +0000 (17:55 -0800)]
Fix crash when deserializing a lambda expression in a decltype.

2 years ago[ELF][test] Improve LTO duplicate symbol test
Fangrui Song [Wed, 16 Feb 2022 01:54:38 +0000 (17:54 -0800)]
[ELF][test] Improve LTO duplicate symbol test

2 years ago[DAGCombiner][AArch64] Enhance to fold CSNEG into CSINC instruction
zhongyunde [Wed, 16 Feb 2022 01:35:15 +0000 (09:35 +0800)]
[DAGCombiner][AArch64] Enhance to fold CSNEG into CSINC instruction

Perform the scalar expression combine in the form of:
  CSNEG(1, c, cc) + b  =>  cc  ? b+1 : b-c => CSINC(b-c, b, !cc)
  CSNEG(c, -1, cc) + b =>  cc  ? b+c : b+1 => CSINC(b+c, b, cc)

Fix https://github.com/llvm/llvm-project/issues/53071

Reviewed By: dmgreen

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

2 years ago[mlir] Expose printer flags in AsmState
Sergei Grechanik [Wed, 16 Feb 2022 01:09:08 +0000 (17:09 -0800)]
[mlir] Expose printer flags in AsmState

This change exposes printer flags in AsmState and AsmStateImpl. All functions
receiving AsmState as a parameter now use the flags from the AsmState instead of
taking an additional OpPrintingFlags parameter.

Reviewed By: rriddle

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

2 years ago[lld][WebAssembly] Don't force the export symbols assiged internal/dummy GOT entries
Sam Clegg [Tue, 15 Feb 2022 23:33:42 +0000 (15:33 -0800)]
[lld][WebAssembly] Don't force the export symbols assiged internal/dummy GOT entries

Symbols with regular GOT entries do need to be exported, but those that
are internalized (and have dymmy/internal GOT entries) need not be
exported.

This happens to fix the failures on the emscripten waterfall where extra
symbols were being exported by the linker (and then later removed by
wasm-opt).

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

2 years ago[Bitstream] Improve error propagation from ReadVBR
Jan Korous [Tue, 15 Feb 2022 02:22:18 +0000 (18:22 -0800)]
[Bitstream] Improve error propagation from ReadVBR

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

2 years ago[Bitstream] Add assert to ReadVBR and ReadVBR64
Jan Korous [Tue, 15 Feb 2022 02:21:00 +0000 (18:21 -0800)]
[Bitstream] Add assert to ReadVBR and ReadVBR64

We want to prevent UB potentially caused by left-shifting by type bit-width.

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

2 years ago[ELF] --exclude-libs: skip local symbols for ET_REL. NFC
Fangrui Song [Wed, 16 Feb 2022 01:02:55 +0000 (17:02 -0800)]
[ELF] --exclude-libs: skip local symbols for ET_REL. NFC

Beside the optimization, this will avoid accessing nullptr entries with my
planned change to parallelize initializeLocalSymbols.

2 years ago[libc++][ranges] Implement Ranges changes to `istream{,buf}_iterator`.
Konstantin Varlamov [Wed, 16 Feb 2022 00:59:16 +0000 (16:59 -0800)]
[libc++][ranges] Implement Ranges changes to `istream{,buf}_iterator`.

The changes from the One Ranges Proposal amount to adding:
- a constructor that takes a `default_sentinel_t` and is equivalent to
  the default constructor;
- an `operator==` that compares the iterator to `default_sentinel_t`.

The original proposal defined two overloads for `operator==` (different
argument order) as well as `operator!=`. This has been removed by
[P1614](https://wg21.link/p1614).

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

2 years ago[X86] Add test for interaction between pushf/popf and redzones
Reid Kleckner [Fri, 11 Feb 2022 18:58:34 +0000 (10:58 -0800)]
[X86] Add test for interaction between pushf/popf and redzones

As requested on D92695

2 years ago[libc] change ASAN condition to generator expression
Michael Jones [Mon, 14 Feb 2022 23:15:22 +0000 (15:15 -0800)]
[libc] change ASAN condition to generator expression

Previously, building LLVM-libc with GWP ASAN was conditioned on the flag
COMPILER_RT_BUILD_GWP_ASAN, which caused issues do to the default value
of the flag being set in the compiler-rt cmake, which is seperate. Now
GWP ASAN is included based on if it exists as a target, which is more
consistent.

Reviewed By: sivachandra

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

2 years ago[mlir][sparse][taco] Handle tensor copy and trivial reduction expression.
Bixia Zheng [Tue, 15 Feb 2022 18:17:51 +0000 (10:17 -0800)]
[mlir][sparse][taco] Handle tensor copy and trivial reduction expression.

Handle tensor copy, such as A[i, j] = B[i, j]. Also, handle trivial
reduction expression, such as A[i] = B[i, j].

Add unit tests.

Reviewed By: aartbik

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

2 years ago[WebAssembly] Add TLS FileCheck lines to Wasm SjLj test
Heejin Ahn [Tue, 15 Feb 2022 02:04:48 +0000 (18:04 -0800)]
[WebAssembly] Add TLS FileCheck lines to Wasm SjLj test

Reviewed By: sbc100

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

2 years ago[libc++][test] Run clang-tidy during CI
Nikolas Klauser [Tue, 15 Feb 2022 19:00:34 +0000 (20:00 +0100)]
[libc++][test] Run clang-tidy during CI

I'm trying to get libc++ to the point of being able to run clang-tidy. This is a PR to see if clang-tidy is happy with all the CI configs.

Reviewed By: Quuxplusone, ldionne, #libc

Spies: mgorny, aheejin, libcxx-commits, arichardson

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

2 years ago[SystemZ][z/OS] Fix f32 variadic argument assertion
Mubariz Afzal [Tue, 15 Feb 2022 23:11:50 +0000 (18:11 -0500)]
[SystemZ][z/OS] Fix f32 variadic argument assertion

The tablegen lines that specify the XPLINK64 calling convention for promoting an f32 vararg to an f64 are effectively overwritten by the following tablegen line which bitcast an f64 vararg to an i64 (so that it can be used in the GPRs). It becomes a bitcast from f32 to i64.

Since we don't handle a bitcast for f32s this caused an assertion.