platform/upstream/llvm.git
3 years ago[clang-tidy] Simplify delete null ptr check
Stephen Kelly [Tue, 29 Dec 2020 13:44:18 +0000 (13:44 +0000)]
[clang-tidy] Simplify delete null ptr check

Because it no longer relies on finding implicit casts, this check now
works on templates which are not instantiated in the translation unit.

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

3 years agoFollow up of rGdea4a63e6359, which committed a slightly different version than
Sjoerd Meijer [Wed, 17 Feb 2021 10:00:05 +0000 (10:00 +0000)]
Follow up of rGdea4a63e6359, which committed a slightly different version than
intended.

3 years ago[Driver] Support -gdwarf64 for assembly files
Igor Kudrin [Fri, 12 Feb 2021 13:41:39 +0000 (20:41 +0700)]
[Driver] Support -gdwarf64 for assembly files

The option was added in D90507 for C/C++ source files. This patch adds
support for assembly files.

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

3 years ago[DebugInfo] Keep the DWARF64 flag in the module metadata
Igor Kudrin [Fri, 12 Feb 2021 07:28:22 +0000 (14:28 +0700)]
[DebugInfo] Keep the DWARF64 flag in the module metadata

This allows the option to affect the LTO output. Module::Max helps to
generate debug info for all modules in the same format.

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

3 years ago[clangd] Bind outgoing calls through LSPBinder too. NFC
Sam McCall [Mon, 15 Feb 2021 09:41:38 +0000 (10:41 +0100)]
[clangd] Bind outgoing calls through LSPBinder too. NFC

The redundancy around work-done-progress is annoying but ok for now.

There's a weirdness with context lifetimes around outgoing method calls, which
I've preserved to keep this NFC. We should probably fix it though.

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

3 years ago[LSR] Cleanup of getPreferredAddresingMode. NFC.
Sjoerd Meijer [Tue, 16 Feb 2021 13:14:59 +0000 (13:14 +0000)]
[LSR] Cleanup of getPreferredAddresingMode. NFC.

This is a follow up D96600 and cleans up most calls to
getPreferredAddresingMode. I.e., we really don't need to query the same things
again and again, but get the preferred addressing mode once for each loop. So
this should be a lot friendlier for compile times, especially if we start
implementing getPreferredAddresingMode.

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

3 years ago[ADT] Add SFINAE guards to unique_function constructor.
Sam McCall [Tue, 16 Feb 2021 16:58:34 +0000 (17:58 +0100)]
[ADT] Add SFINAE guards to unique_function constructor.

We can't construct a working unique_function from an object that's not callable
with the right types, so don't allow deduction to succeed.
This avoids some ambiguous conversion cases, e.g. allowing to overload
on different unique_function types, and to conversion operators to
unique_function.

std::function and the any_invocable proposal have these.
This was added to llvm::function_ref in D88901 and followups

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

3 years ago[mlir][Shape] Mark BroadcastOp as not having side effects
Benjamin Kramer [Tue, 16 Feb 2021 17:29:19 +0000 (18:29 +0100)]
[mlir][Shape] Mark BroadcastOp as not having side effects

This allows it to be dead code eliminated when unused.

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

3 years ago[OpenCL] Create VoidPtrTy with generic AS in C++ for OpenCL mode
Anton Zabaznov [Fri, 12 Feb 2021 12:53:02 +0000 (15:53 +0300)]
[OpenCL] Create VoidPtrTy with generic AS in C++ for OpenCL mode

This change affects 'SemaOpenCLCXX/newdelete.cl' test,
thus the patch contains adjustments in types validation of
operators new and delete

Reviewed By: Anastasia

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

3 years ago[MachineSink] Add a loop sink limit
Sjoerd Meijer [Tue, 16 Feb 2021 14:43:44 +0000 (14:43 +0000)]
[MachineSink] Add a loop sink limit

To make sure compile-times don't regress, add an option to restrict the number
of instructions considered for sinking as alias analysis can be expensive and
for the same reason also skip large blocks.

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

3 years ago[sanitizers] Pass CMAKE_C_FLAGS into TSan buildgo script
Joachim Protze [Wed, 17 Feb 2021 08:14:23 +0000 (09:14 +0100)]
[sanitizers] Pass CMAKE_C_FLAGS into TSan buildgo script

When compiling with ccache, compiler commands get split into smaller steps
and clang's default -Wunused-command-line-argument complains about unused
include directory arguments. In combination -Werror, compilation aborts.

This patch passes the CMAKE_C_FLAGS into the build script. Configuring with
-DCMAKE_C_FLAGS=-Wno-unused-command-line-argument allows successful testing.

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

3 years ago[clang][Frontend] Fix a crash in DiagnosticRenderer.
Balázs Kéri [Tue, 16 Feb 2021 14:52:44 +0000 (15:52 +0100)]
[clang][Frontend] Fix a crash in DiagnosticRenderer.

Displaying the problem range could crash if the begin and end of a
range is in different files or macros. After the change such range
is displayed only as the beginning location.

There is a bug for this problem:
https://bugs.llvm.org/show_bug.cgi?id=46540

Reviewed By: steakhal

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

3 years ago[OpenMP] Fix a warning on an unused variable
Kazu Hirata [Wed, 17 Feb 2021 07:46:21 +0000 (23:46 -0800)]
[OpenMP] Fix a warning on an unused variable

3 years ago[vim] Highlight most common MIR syntax not in LLVM IR
Cassie Jones [Wed, 17 Feb 2021 07:38:53 +0000 (02:38 -0500)]
[vim] Highlight most common MIR syntax not in LLVM IR

This adds highlighting for MIR instruction opcodes, physical registers,
and MIR types.

Reviewed By: dblaikie

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

3 years ago[vim] Add initial syntax definition for .mir files
Cassie Jones [Wed, 17 Feb 2021 07:38:08 +0000 (02:38 -0500)]
[vim] Add initial syntax definition for .mir files

This initial definition handles the yaml container and the embedding of
the inner IRs. As a stopgap, this reuses the LLVM IR syntax highlighting
for the MIR function bodies--even though it's not technically correct,
it produces decent highlighting for a first pass.

Reviewed By: dblaikie

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

3 years agotsan: don't leave unmapped hole in non-app memory
Dmitry Vyukov [Mon, 15 Feb 2021 10:25:48 +0000 (11:25 +0100)]
tsan: don't leave unmapped hole in non-app memory

If an app mmaps lots of memory, a user mmap may end up
in the tsan region for traces. Shadow for this range
overlaps with shadow for other user regions.
This causes havok: from false positives to crashes.
Don't leave unmapped holes in the traces region.

Reviewed-in: https://reviews.llvm.org/D96697

3 years ago[SampleFDO] Fix MSVC "namespace uses itself" warning (NFC)
Yang Fan [Wed, 17 Feb 2021 07:26:07 +0000 (15:26 +0800)]
[SampleFDO] Fix MSVC "namespace uses itself" warning (NFC)

MSVC warning:
```
SampleProfileLoaderBaseImpl.h(41): warning C4515: 'llvm': namespace uses itself
```

3 years ago[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Wed, 17 Feb 2021 07:23:08 +0000 (23:23 -0800)]
[CodeGen] Use range-based for loops (NFC)

3 years ago[llvm] Fix header guards (NFC)
Kazu Hirata [Wed, 17 Feb 2021 07:23:07 +0000 (23:23 -0800)]
[llvm] Fix header guards (NFC)

Identified with llvm-header-guard.

3 years ago[SCEV] Use ListSeparator (NFC)
Kazu Hirata [Wed, 17 Feb 2021 07:23:05 +0000 (23:23 -0800)]
[SCEV] Use ListSeparator (NFC)

3 years ago[lld] Silence compiler warnings by removing always true/false comparisons
Mikael Holmen [Tue, 16 Feb 2021 14:16:41 +0000 (15:16 +0100)]
[lld] Silence compiler warnings by removing always true/false comparisons

type is an uint8_t so
 type >= 0
is always true and
 type < 0
is always false.

3 years ago[mlgo] Fetch models from path / URL
Mircea Trofin [Fri, 12 Feb 2021 06:17:59 +0000 (22:17 -0800)]
[mlgo] Fetch models from path / URL

Allow custom location for pre-trained models used when AOT-compiling
policies.

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

3 years ago[RISCV] Spilling for RISC-V V extension. (2nd version)
Hsiangkai Wang [Fri, 8 Jan 2021 06:42:59 +0000 (14:42 +0800)]
[RISCV] Spilling for RISC-V V extension. (2nd version)

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

3 years ago[RISCV] Frame handling for RISC-V V extension.
Hsiangkai Wang [Fri, 8 Jan 2021 02:18:26 +0000 (10:18 +0800)]
[RISCV] Frame handling for RISC-V V extension.

This patch proposes how to deal with RISC-V vector frame objects. The
layout of RISC-V vector frame will look like

|---------------------------------|
| scalar callee-saved registers   |
|---------------------------------|
| scalar local variables          |
|---------------------------------|
| scalar outgoing arguments       |
|---------------------------------|
| RVV local variables &&          |
| RVV outgoing arguments          |
|---------------------------------| <- end of frame (sp)

If there is realignment or variable length array in the stack, we will use
frame pointer to access fixed objects and stack pointer to access
non-fixed objects.

|---------------------------------| <- frame pointer (fp)
| scalar callee-saved registers   |
|---------------------------------|
| scalar local variables          |
|---------------------------------|
| ///// realignment /////         |
|---------------------------------|
| scalar outgoing arguments       |
|---------------------------------|
| RVV local variables &&          |
| RVV outgoing arguments          |
|---------------------------------| <- end of frame (sp)

If there are both realignment and variable length array in the stack, we
will use frame pointer to access fixed objects and base pointer to access
non-fixed objects.

|---------------------------------| <- frame pointer (fp)
| scalar callee-saved registers   |
|---------------------------------|
| scalar local variables          |
|---------------------------------|
| ///// realignment /////         |
|---------------------------------| <- base pointer (bp)
| RVV local variables &&          |
| RVV outgoing arguments          |
|---------------------------------|
| /////////////////////////////// |
| variable length array           |
| /////////////////////////////// |
|---------------------------------| <- end of frame (sp)
| scalar outgoing arguments       |
|---------------------------------|

In this version, we do not save the addresses of RVV objects in the
stack. We access them directly through the polynomial expression
(a x VLENB + b). We do not reserve frame pointer when there is any RVV
object in the stack. So, we also access the scalar frame objects through the
polynomial expression (a x VLENB + b) if the access across RVV stack
area.

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

3 years agoFix gcc build after de3a485d9 due to a gcc bug: https://gcc.gnu.org/bugzilla/show_bug...
Douglas Yung [Wed, 17 Feb 2021 05:54:10 +0000 (21:54 -0800)]
Fix gcc build after de3a485d9 due to a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598

This should fix gcc based builders such as http://lab.llvm.org:8011/#/builders/76/builds/1683

3 years ago[flang][fir][NFC] Move ComplexType to TableGen type definition
Valentin Clement [Wed, 17 Feb 2021 02:52:26 +0000 (21:52 -0500)]
[flang][fir][NFC] Move ComplexType to TableGen type definition

This patch is a follow up of D96422 and move ComplexType to
TableGen.

Reviewed By: schweitz

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

3 years ago[flang][fir][NFC] Move BoxProcType to TableGen type definition
Valentin Clement [Wed, 17 Feb 2021 02:26:55 +0000 (21:26 -0500)]
[flang][fir][NFC] Move BoxProcType to TableGen type definition

This patch is a follow up of D96422 and move BoxProcType to TableGen.

Reviewed By: schweitz, mehdi_amini

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

3 years ago[flang][fir][NFC] Move CharacterType and BoxCharType to TableGen type definition
Valentin Clement [Wed, 17 Feb 2021 02:15:06 +0000 (21:15 -0500)]
[flang][fir][NFC] Move CharacterType and BoxCharType to TableGen type definition

This patch is a follow up of D96422 and move CharacterType and BoxCharType to
TableGen.

Reviewed By: schweitz

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

3 years ago[llvm-libtool] Emit warnings for files without symbols
Alexander Shaposhnikov [Thu, 11 Feb 2021 21:46:49 +0000 (13:46 -0800)]
[llvm-libtool] Emit warnings for files without symbols

1. Emit warnings for files without symbols.
2. Add -no_warning_for_no_symbols.

Test plan: make check-all

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

3 years ago[AMDGPU] Correct rmw atomics s_waitcnt generation
Tony Tye [Tue, 16 Feb 2021 03:22:34 +0000 (03:22 +0000)]
[AMDGPU] Correct rmw atomics s_waitcnt generation

The AMD GPU SIMemoryLegalizer was using the ordering address space
rather than the instruction address space when determining the
s_waitcnt to generate to ensure that a read-modify-write atomic has
completed. This resulted in additional unnecessary counters being
waited on.

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

3 years ago[gn build] Port 6fd5ccff72ee
LLVM GN Syncbot [Wed, 17 Feb 2021 00:53:56 +0000 (00:53 +0000)]
[gn build] Port 6fd5ccff72ee

3 years ago[SampleFDO] Reapply: Refactor SampleProfile.cpp
Rong Xu [Tue, 16 Feb 2021 22:44:09 +0000 (14:44 -0800)]
[SampleFDO] Reapply: Refactor SampleProfile.cpp

Reapply patch after fixing buildbot failure.
Refactor SampleProfile.cpp to use the core code in CodeGen.
The main changes are:
(1) Move SampleProfileLoaderBaseImpl class to a header file.
(2) Split SampleCoverageTracker to a head file and a cpp file.
(3) Move the common codes (common options and callsiteIsHot())
to the common cpp file.

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

3 years agoBasic block sections should enable function sections implicitly.
Sriraman Tallam [Tue, 16 Feb 2021 23:26:41 +0000 (15:26 -0800)]
Basic block sections should enable function sections implicitly.

Basic block sections enables function sections implicitly, this is not needed
and is inefficient with "=list" option.

We had basic block sections enable function sections implicitly in clang. This
is particularly inefficient with "=list" option as it places functions that do
not have any basic block sections in separate sections. This causes unnecessary
object file overhead for large applications.

This patch disables this implicit behavior. It only creates function sections
for those functions that require basic block sections.

Further, there was an inconistent behavior with llc as llc was not turning on
function sections by default. This patch makes llc and clang consistent and
tests are added to check the new behavior.

This is the first of two patches and this adds functionality in LLVM to
create a new section for the entry block if function sections is not
enabled.

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

3 years ago[mlir][python] Add python binding for AffineMapAttribute.
Stella Laurenzo [Tue, 16 Feb 2021 21:53:42 +0000 (13:53 -0800)]
[mlir][python] Add python binding for AffineMapAttribute.

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

3 years ago[OPENMP50]Allow overlapping mapping in target constructs.
Alexey Bataev [Thu, 11 Feb 2021 13:10:54 +0000 (05:10 -0800)]
[OPENMP50]Allow overlapping mapping in target constructs.

OpenMP 5.0 removed a lot of restriction for overlapped mapped items
comparing to OpenMP 4.5. Patch restricts the checks for overlapped data
mappings only for OpenMP 4.5 and less and reorders mapping of the
arguments so, that present and alloc mappings are processed first and
then all others.

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

3 years ago[flang] Detect circularly defined procedures
Peter Steinfeld [Fri, 12 Feb 2021 21:28:58 +0000 (13:28 -0800)]
[flang] Detect circularly defined procedures

It's possible to define a procedure that has a procedure dummy argument which
names the procedure that contains it.  This was causing the compiler to fall
into an infinite loop when characterizing a call to the procedure.

Following a suggestion from Peter, I fixed this be maintaining a set of
procedure symbols that had already been seen while characterizing a procedure.
This required passing a new parameter to the functions that characterized a
Procedure, a DummyArgument, and a DummyProcedure.

I also added several tests that will crash the compiler without this change.

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

3 years ago[lld][ELF] Support for zero flag section groups
Petr Hosek [Fri, 12 Feb 2021 22:26:31 +0000 (14:26 -0800)]
[lld][ELF] Support for zero flag section groups

This change introduces support for zero flag ELF section groups to lld.
lld already supports COMDAT sections, which in ELF are a special type of
ELF section groups. These are generally useful to enable linker GC where
you want a group of sections to always travel together, that is to be
either retained or discarded as a whole, but without the COMDAT
semantics. Other ELF linkers already support zero flag ELF section
groups and this change helps us reach feature parity.

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

3 years ago[C++20] [P1825] More implicit moves
Yang Fan [Tue, 16 Feb 2021 21:09:26 +0000 (16:09 -0500)]
[C++20] [P1825] More implicit moves

Implement all of P1825R0:

- implicitly movable entity can be an rvalue reference to non-volatile
    automatic object.
- operand of throw-expression can be a function or catch-clause parameter
    (support for function parameter has already been implemented).
- in the first overload resolution, the selected function no need to be
    a constructor.
- in the first overload resolution, the first parameter of the selected
    function no need to be an rvalue reference to the object's type.

This patch also removes the diagnostic `-Wreturn-std-move-in-c++11`.

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

3 years ago[MC][ELF] Support for zero flag section groups
Petr Hosek [Mon, 1 Feb 2021 06:42:35 +0000 (22:42 -0800)]
[MC][ELF] Support for zero flag section groups

This change introduces support for zero flag ELF section groups to LLVM.
LLVM already supports COMDAT sections, which in ELF are a special type
of ELF section groups. These are generally useful to enable linker GC
where you want a group of sections to always travel together, that is to
be either retained or discarded as a whole, but without the COMDAT
semantics. Other ELF assemblers already support zero flag ELF section
groups and this change helps us reach feature parity.

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

3 years ago[gn build] Port c761fe77bdca
LLVM GN Syncbot [Tue, 16 Feb 2021 22:13:03 +0000 (22:13 +0000)]
[gn build] Port c761fe77bdca

3 years agoRevert "[SampleFDO][NFC] Refactor SampleProfile.cpp"
Mehdi Amini [Tue, 16 Feb 2021 22:10:51 +0000 (22:10 +0000)]
Revert "[SampleFDO][NFC] Refactor SampleProfile.cpp"

This reverts commit 310b35304cdf5a230c042904655583c5532d3e91.
The build is broken with -DBUILD_SHARED_LIBS=ON :

lib/ProfileData/CMakeFiles/LLVMProfileData.dir/SampleProfileLoaderBaseUtil.cpp.o: In function `llvm::sampleprofutil::callsiteIsHot(llvm::sampleprof::FunctionSamples const*, llvm::ProfileSummaryInfo*, bool)':
SampleProfileLoaderBaseUtil.cpp:(.text._ZN4llvm14sampleprofutil13callsiteIsHotEPKNS_10sampleprof15FunctionSamplesEPNS_18ProfileSummaryInfoEb+0x1a): undefined reference to `llvm::ProfileSummaryInfo::isColdCount(unsigned long) const'
SampleProfileLoaderBaseUtil.cpp:(.text._ZN4llvm14sampleprofutil13callsiteIsHotEPKNS_10sampleprof15FunctionSamplesEPNS_18ProfileSummaryInfoEb+0x28): undefined reference to `llvm::ProfileSummaryInfo::isHotCount(unsigned long) const'
...

3 years agoEffectively revert ba2aa5f49ebb since the object isn't destroyed polymorphically
David Blaikie [Tue, 16 Feb 2021 21:45:25 +0000 (13:45 -0800)]
Effectively revert ba2aa5f49ebb since the object isn't destroyed polymorphically

3 years ago[mlir][Linalg] Add utility method to reshape ops to express output shape in terms...
MaheshRavishankar [Tue, 16 Feb 2021 21:15:55 +0000 (13:15 -0800)]
[mlir][Linalg] Add utility method to reshape ops to express output shape in terms of input shape.

Resolving the dim of outputs of a tensor_reshape op in terms of its
input shape allows the op to be eliminated when its used only in its
dims. The init_tensor -> tensor_reshape canonicalization can be
simplified to use the dims of the output of the tensor_reshape which
gets canonicalized away later making the tensor_reshape dead.

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

3 years ago[llvm-dwp] Join dwo paths correctly when DWOPath is absolute
Simonas Kazlauskas [Tue, 16 Feb 2021 21:35:32 +0000 (13:35 -0800)]
[llvm-dwp] Join dwo paths correctly when DWOPath is absolute

When the `DWOPath` is absolute, we want to use `DWOPath` as is, without prepending any other
components to the path. The `sys::path::append` does not join, but rather unconditionally appends
the paths, so something like `sys::path::append("/tmp", "/tmp/banana")` will result in
`/tmp/tmp/banana` rather than the desired `/tmp/banana`.

This then causes `llvm-dwp` to fail in a following situation:

```
$ clang -gsplit-dwarf /tmp/banana/test.c -c -o /tmp/outdir/foo.o
$ clang outdir/foo.o -o outdir/hm
$ llvm-dwarfdump outdir/hm | grep -C2 foo.dwo
                  DW_AT_comp_dir    ("/tmp")
                  DW_AT_GNU_pubnames  (true)
                  DW_AT_GNU_dwo_name    ("/tmp/outdir/foo.dwo")
                                DW_AT_GNU_dwo_id    (0xde4d396f3bf0e257)
                  DW_AT_low_pc  (0x0000000000401100)
$ strace -o trace llvm-dwp -e outdir/hm -o outdir/hm.dwp
error: No such file or directory
$ cat trace | grep foo.dwo
openat(AT_FDCWD, "/tmp/tmp/outdir/foo.dwo", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
```

Reviewed By: dblaikie

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

3 years agoFix -Wnon-virtual-dtor by making the ctor protected
David Blaikie [Tue, 16 Feb 2021 21:13:21 +0000 (13:13 -0800)]
Fix -Wnon-virtual-dtor by making the ctor protected

3 years ago[OpenMP][FIX] Avoid use of stack allocations in asynchronous calls
Johannes Doerfert [Sun, 14 Feb 2021 18:25:56 +0000 (12:25 -0600)]
[OpenMP][FIX] Avoid use of stack allocations in asynchronous calls

As reported by Guilherme Valarini [0], we used to pass stack allocations
to calls that can nowadays be asynchronous. This is arguably a problem
and it will inevitably result in UB. To remedy the situation we
allocate the locations as part of the AsyncInfoTy object. The lifetime
of that object matches what we need for now. If the synchronization is
not tied to the AsyncInfoTy object anymore we might need to have a
different buffer construct in global space.

This should be back-ported to LLVM 12 but needs slight modifications as
it is based on refactoring patches we do not need to backport.

[0] https://lists.llvm.org/pipermail/openmp-dev/2021-February/003867.html

Reviewed By: JonChesterfield

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

3 years ago[OpenMP] Unify omptarget API and usage wrt. `__tgt_async_info`
Johannes Doerfert [Wed, 10 Feb 2021 17:06:00 +0000 (11:06 -0600)]
[OpenMP] Unify omptarget API and usage wrt. `__tgt_async_info`

This patch unifies our libomptarget API in two ways:
  - always pass a `__tgt_async_info` object, the Queue member decides if
    it is in use or not.
  - (almost) always synchronize in the interface layer and not in the
    omptarget layer.

A side effect is that we now put all constructor and static initializer
kernels in a stream too, if the device utilizes `__tgt_async_info`.

The patch contains a TODO which can be addressed as we add support for
asynchronous malloc and free in the plugin API. This is the only
`synchronizeAsyncInfo` left in the omptarget layer.

Site note: On a V100 system the GridMini performance for small sizes
more than doubled.

Reviewed By: tianshilei1992

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

3 years ago[OpenMP] Move synchronization into `__tgt_async_info`
Johannes Doerfert [Wed, 10 Feb 2021 17:06:00 +0000 (11:06 -0600)]
[OpenMP] Move synchronization into `__tgt_async_info`

The AsyncInfo should be passed everywhere and it should offer a way to
ensure synchronization, given a libomptarget Device.

This replaces D96431.

Reviewed By: tianshilei1992

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

3 years ago[OpenMP][NFC] Unify `target` API with other by passing a `__tgt_async_info` pointer
Johannes Doerfert [Wed, 10 Feb 2021 16:57:24 +0000 (10:57 -0600)]
[OpenMP][NFC] Unify `target` API with other by passing a `__tgt_async_info` pointer

Reviewed By: tianshilei1992

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

3 years ago[OpenMP][NFC] Pass a DeviceTy, not the device number to `target`
Johannes Doerfert [Wed, 10 Feb 2021 16:50:09 +0000 (10:50 -0600)]
[OpenMP][NFC] Pass a DeviceTy, not the device number to `target`

This unifies the API of `target` relative to `targetUpdateData` and
such.

Reviewed By: tianshilei1992, grokos

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

3 years ago[OpenMP][NFC] Clang format the libomptarget plugins
Johannes Doerfert [Wed, 10 Feb 2021 20:16:18 +0000 (14:16 -0600)]
[OpenMP][NFC] Clang format the libomptarget plugins

Reviewed By: tianshilei1992

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

3 years ago[OpenMP][NFC] Eliminate sign comparison warning via explicit casts
Johannes Doerfert [Wed, 10 Feb 2021 20:14:22 +0000 (14:14 -0600)]
[OpenMP][NFC] Eliminate sign comparison warning via explicit casts

Reviewed By: tianshilei1992

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

3 years ago[OpenMP][NFC] Clang format libomptarget code (src & include)
Johannes Doerfert [Wed, 10 Feb 2021 17:45:39 +0000 (11:45 -0600)]
[OpenMP][NFC] Clang format libomptarget code (src & include)

The struct and enum alignments are kept by disabling clang-format for
that code region.

Reviewed By: tianshilei1992, JonChesterfield, grokos

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

3 years ago[NFC][PPC] Refactor TOC representation to allow several entries for the same symbol
Victor Huang [Tue, 16 Feb 2021 21:29:07 +0000 (21:29 +0000)]
[NFC][PPC] Refactor TOC representation to allow several entries for the same symbol

We currently represent TOC entries by an MCSymbol. This is not enough in some situations.
For example, when accessing an initialized TLS variable v on AIX using the general dynamic
model, we need to generate the two following entries for v:

.tc .v[TC],v@m
.tc v[TC],v

One is for the region handle (with the @m relocation), the other is for the variable offset.
This refactoring allows storing several entries for the same symbol with different VariantKind
in the TOC. If the VariantKind is not specified, we default to VK_None.

The AIX TLS implementation using this refactoring to generate the two entries will be posted
in a subsequent patch.

Patched By: bsaleil
Reviewed By: sfertile

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

3 years ago[lldb] [Process/FreeBSD] Ensure that errors are always handled
Michał Górny [Thu, 11 Feb 2021 23:51:42 +0000 (00:51 +0100)]
[lldb] [Process/FreeBSD] Ensure that errors are always handled

Ensure that the llvm::Error instances are always considered handled
by replacing LLDB_LOG with LLDB_LOG_ERROR.

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

3 years ago[SampleFDO] Provide a virtual desructor for SampleProfileLoaderBaseImpl
Kazu Hirata [Tue, 16 Feb 2021 21:17:33 +0000 (13:17 -0800)]
[SampleFDO] Provide a virtual desructor for SampleProfileLoaderBaseImpl

This patch fixes a warning:

  llvm-project/llvm/include/llvm/ProfileData/SampleProfileLoaderBaseImpl.h:69:7:
  error: 'llvm::SampleProfileLoaderBaseImpl' has virtual functions but
  non-virtual destructor [-Werror,-Wnon-virtual-dtor]

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

3 years agoseparate AffineMapAccessInterface from AffineRead/WriteOpInterface
Adam Straw [Tue, 16 Feb 2021 21:03:03 +0000 (13:03 -0800)]
separate AffineMapAccessInterface from AffineRead/WriteOpInterface

Separating the AffineMapAccessInterface from AffineRead/WriteOp interface so that dialects which extend Affine capabilities (e.g. PlaidML PXA = parallel extensions for Affine) can utilize relevant passes (e.g. MemRef normalization).

Reviewed By: bondhugula

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

3 years agoRevert "[DAG] Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle...
Sterling Augustine [Tue, 16 Feb 2021 20:37:19 +0000 (12:37 -0800)]
Revert "[DAG] Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d)))"

This reverts commit 5dfba562dd247f731528448ee83785b099f93629.

That commit causes an assertion failure with the following repro:

typedef long b __attribute__((__vector_size__(16)));
b *d;
b e;
b __attribute__((__always_inline__)) c(b h, b i) {
  return (__attribute__((__vector_size__(8 * sizeof(short)))) short)h + i;
}
j() {
  b k, l, m, n, o[6], p, q;
  m = d[5];
  b r = m;
  b s = f(r, 8);
  q = s;
  l = d[1];
  p = l;
  t(q);
  n = c(m, l);
  o[1] = c(s, f(p, 8));
  k = __builtin_shufflevector(n, o[1], 0, 2);
  e = __builtin_ia32_psrlwi128(k, j);
}

./bin/clang -cc1 -triple x86_64-grtev4-linux-gnu -emit-obj -O1 -std=c99 test.c

3 years ago[doc] Use cmake's -S option to simplify the build instructions
Ebrahim Byagowi [Tue, 16 Feb 2021 20:36:56 +0000 (14:36 -0600)]
[doc] Use cmake's -S option to simplify the build instructions

Now that llvm's minimum version is 3.13.4 anyway and `-S` is
introduced in the same version[1], let's use this little
time saving option to simplify the build instructions.

[1]: https://cgold.readthedocs.io/en/latest/glossary/-S.html

Authored-By: Ebrahim Byagowi <ebrahim@gnu.org>
Differential-Revision: https://reviews.llvm.org/D95049

3 years agoFix flang after D76342
Valentin Clement [Tue, 16 Feb 2021 20:37:46 +0000 (15:37 -0500)]
Fix flang after D76342

Fix Flang build after addition of a new OpenMP clauses for a clang patch (D76342).
Flang is using TableGen to generation the declaration of clause checks and the new clause
was missing a definiton.

Reviewed By: klausler

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

3 years ago[lldb] Delete superfluous semicolon
Pavel Labath [Tue, 16 Feb 2021 20:04:23 +0000 (21:04 +0100)]
[lldb] Delete superfluous semicolon

3 years ago[lldb] Remove some nanosleep preprocessor magic
Pavel Labath [Tue, 16 Feb 2021 19:55:40 +0000 (20:55 +0100)]
[lldb] Remove some nanosleep preprocessor magic

It's obsolete, as we use (portable) std::this_thread::sleep_for now.

3 years ago[RISCV] Add isel patterns for fixed vector fmsub/fnmadd/fnmsub.
Craig Topper [Tue, 16 Feb 2021 20:03:27 +0000 (12:03 -0800)]
[RISCV] Add isel patterns for fixed vector fmsub/fnmadd/fnmsub.

3 years ago[mlir] Fix memref_cast + subview folder when reducing rank
Thomas Raoux [Tue, 16 Feb 2021 19:03:58 +0000 (11:03 -0800)]
[mlir] Fix memref_cast + subview folder when reducing rank

When the destination of the subview has a lower rank than its source we need to
fix the result type of the new subview op.

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

3 years ago[clangd] Fix windows buildbots after ecea7218fb9b994b26471e9877851cdb51a5f1d4
Kadir Cetinkaya [Tue, 16 Feb 2021 19:57:00 +0000 (20:57 +0100)]
[clangd] Fix windows buildbots after ecea7218fb9b994b26471e9877851cdb51a5f1d4

3 years ago[gn build] Port ecea7218fb9b
LLVM GN Syncbot [Tue, 16 Feb 2021 19:23:52 +0000 (19:23 +0000)]
[gn build] Port ecea7218fb9b

3 years ago[gn build] Port 310b35304cdf
LLVM GN Syncbot [Tue, 16 Feb 2021 19:23:52 +0000 (19:23 +0000)]
[gn build] Port 310b35304cdf

3 years ago[FileCollector] Fix that the file system case-sensitivity check was inverted
Raphael Isemann [Tue, 16 Feb 2021 19:19:25 +0000 (20:19 +0100)]
[FileCollector] Fix that the file system case-sensitivity check was inverted

real_path returns an `std::error_code` which evaluates to `true` in case an
error happens and `false` if not. This code was checking the inverse, so
case-insensitive file systems ended up being detected as case sensitive.

Tested using an LLDB reproducer test as we anyway need a real file system and
also some matching logic to detect whether the respective file system is
case-sensitive (which the test is doing via some Python checks that we can't
really emulate with the usual FileCheck logic).

Fixes rdar://67003004

Reviewed By: JDevlieghere

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

3 years ago[clangd] Treat paths case-insensitively depending on the platform
Kadir Cetinkaya [Mon, 15 Feb 2021 08:00:49 +0000 (09:00 +0100)]
[clangd] Treat paths case-insensitively depending on the platform

Path{Match,Exclude} and MountPoint were checking paths case-sensitively
on all platforms, as with other features, this was causing problems on
windows. Since users can have capital drive letters on config files, but
editors might lower-case them.

This patch addresses that issue by:
- Creating regexes with case-insensitive matching on those platforms.
- Introducing a new pathIsAncestor helper, which performs checks in a
  case-correct manner where needed.

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

3 years ago[RISCV] Add add/sub saturation tests that exist on ARM/AArch64/X86
Craig Topper [Tue, 16 Feb 2021 18:32:06 +0000 (10:32 -0800)]
[RISCV] Add add/sub saturation tests that exist on ARM/AArch64/X86

There have been some recent changes to the type legalization for
some of these intrinsics so I thought it would be good to have
coverage.

3 years ago[SampleFDO][NFC] Refactor SampleProfile.cpp
Rong Xu [Tue, 16 Feb 2021 18:53:38 +0000 (10:53 -0800)]
[SampleFDO][NFC] Refactor SampleProfile.cpp

Refactor SampleProfile.cpp to use the core code in CodeGen.
The main changes are:
(1) Move SampleProfileLoaderBaseImpl class to a header file.
(2) Split SampleCoverageTracker to a head file and a cpp file.
(3) Move the common codes (common options and callsiteIsHot())
to the common cpp file.

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

3 years agolibunwind: Don't attempt to authenticate a null return address.
Peter Collingbourne [Fri, 12 Feb 2021 00:16:51 +0000 (16:16 -0800)]
libunwind: Don't attempt to authenticate a null return address.

Null return addresses can appear at the bottom of the stack (i.e. the
frame corresponding to the entry point). Authenticating these addresses
will set the error code in the address, which will lead to a segfault
in the sigreturn trampoline detection code. Fix this problem by not
authenticating null addresses.

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

3 years agoRevert "[AArch64][GlobalISel] Fold constants into G_GLOBAL_VALUE"
Jessica Paquette [Tue, 16 Feb 2021 18:50:12 +0000 (10:50 -0800)]
Revert "[AArch64][GlobalISel] Fold constants into G_GLOBAL_VALUE"

This reverts commit 61b4702a408834228c1c139b0e9af98616774db4.

We were seeing some test failures in SPECINT2006 due to this change. Reverting
to investigate.

3 years ago[SystemZ][ZOS] Prefer -nostdlib++ as opposed to -nodefaultlibs when building c++...
Zbigniew Sarbinowski [Tue, 16 Feb 2021 18:02:22 +0000 (18:02 +0000)]
[SystemZ][ZOS] Prefer -nostdlib++ as opposed to -nodefaultlibs when building c++ libraries

Let's use -nostdlib++ rather than -nodefaultlibs when building libc++/libc++abi/libunwind libraries. The default is -nostdlib++ if supported by a build compiler like it is the case with clang, otherwise -nodefaultlibs is used as before.

This change is needed to avoid additional changes at the link step and not to increase the maintenance costs. If clang with -nodefaultlibs is used all the libraries which are removed but required would have to be manually added in. This set of libraries are unique and will send out.

The propose change will allow to make the link step simple for other platforms as well.

Reviewed By: #libc, #libc_abi, ldionne

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

3 years ago[OpenMP] Implement '#pragma omp tile', by Michael Kruse (@Meinersbur).
Michael Kruse [Fri, 12 Feb 2021 19:26:59 +0000 (11:26 -0800)]
[OpenMP] Implement '#pragma omp tile', by Michael Kruse (@Meinersbur).

The tile directive is in OpenMP's Technical Report 8 and foreseeably will be part of the upcoming OpenMP 5.1 standard.

This implementation is based on an AST transformation providing a de-sugared loop nest. This makes it simple to forward the de-sugared transformation to loop associated directives taking the tiled loops. In contrast to other loop associated directives, the OMPTileDirective does not use CapturedStmts. Letting loop associated directives consume loops from different capture context would be difficult.

A significant amount of code generation logic is taking place in the Sema class. Eventually, I would prefer if these would move into the CodeGen component such that we could make use of the OpenMPIRBuilder, together with flang. Only expressions converting between the language's iteration variable and the logical iteration space need to take place in the semantic analyzer: Getting the of iterations (e.g. the overload resolution of `std::distance`) and converting the logical iteration number to the iteration variable (e.g. overload resolution of `iteration + .omp.iv`). In clang, only CXXForRangeStmt is also represented by its de-sugared components. However, OpenMP loop are not defined as syntatic sugar. Starting with an AST-based approach allows us to gradually move generated AST statements into CodeGen, instead all at once.

I would also like to refactor `checkOpenMPLoop` into its functionalities in a follow-up. In this patch it is used twice. Once for checking proper nesting and emitting diagnostics, and additionally for deriving the logical iteration space per-loop (instead of for the loop nest).

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

3 years ago[mlir] Simplify ModuleTranslation for LLVM IR
Alex Zinenko [Tue, 16 Feb 2021 16:36:45 +0000 (17:36 +0100)]
[mlir] Simplify ModuleTranslation for LLVM IR

A series of preceding patches changed the mechanism for translating MLIR to
LLVM IR to use dialect interface with delayed registration. It is no longer
necessary for specific dialects to derive from ModuleTranslation. Remove all
virtual methods from ModuleTranslation and factor out the entry point to be a
free function.

Also perform some cleanups in ModuleTranslation internals.

Depends On D96774

Reviewed By: nicolasvasilache

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

3 years ago[DAG] PromoteIntRes_ADDSUBSHLSAT - promote ISD::UADDSAT as clamped add
Simon Pilgrim [Tue, 16 Feb 2021 17:37:32 +0000 (17:37 +0000)]
[DAG] PromoteIntRes_ADDSUBSHLSAT - promote ISD::UADDSAT as clamped add

Similar to D96622, we're better off just promoting uaddsat(x,y) -> umin(add(x,y),c) instead of trying to perform a shifted uaddsat.

I initially tried to just use shifted promotion in cases where we didn't have a legal/custom umin - but we don't appear to have any targets that have uaddsat but not umin, so imo we're better off always using the umin and avoid an untested shifted uaddsat code path.

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

3 years ago[RISCV] Add support for fixed vector mask logic operations.
Craig Topper [Tue, 16 Feb 2021 17:26:22 +0000 (09:26 -0800)]
[RISCV] Add support for fixed vector mask logic operations.

Reviewed By: frasercrmck

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

3 years ago[SelectionDAG][AArch64] Restrict matchUnaryPredicate to only handle SPLAT_VECTOR...
Craig Topper [Tue, 16 Feb 2021 17:22:44 +0000 (09:22 -0800)]
[SelectionDAG][AArch64] Restrict matchUnaryPredicate to only handle SPLAT_VECTOR for scalable vectors.

fde24661718c7812a20a10e518cd853e8e060107 added support for
scalable vectors to matchUnaryPredicate by handling SPLAT_VECTOR in
addition to BUILD_VECTOR. This was used to enabled UDIV/SDIV/UREM/SREM
by constant expansion in BuildUDIV/BuildSDIV in TargetLowering.cpp

The caller there expects to call getBuildVector from the match factors.
This leads to a crash right now if there is a SPLAT_VECTOR of
fixed vectors since the number of vectors won't match the number
of elements.

To fix this, this patch updates the callers to check the opcode
instead of whether the type is fixed or scalable. This assumes
that only 3 opcodes are handled by matchUnaryPredicate so
I've added an assertion to the final else to check that opcode.

Reviewed By: RKSimon

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

3 years ago[mlir] tighten LLVM dialect verifiers to generate valid LLVM IR
Alex Zinenko [Tue, 16 Feb 2021 16:36:20 +0000 (17:36 +0100)]
[mlir] tighten LLVM dialect verifiers to generate valid LLVM IR

Verification of the LLVM IR produced when translating various MLIR dialects was
only active when calling the translation programmatically. This has led to
several cases of invalid LLVM IR being generated that could not be caught with
textual mlir-translate tests. Add verifiers for these cases and fix the tests
in preparation for enforcing the validation of LLVM IR.

Reviewed By: nicolasvasilache

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

3 years ago[AArch64] Convert CMP/SELECT sign patterns to OR & ASR.
Florian Hahn [Tue, 16 Feb 2021 17:12:30 +0000 (17:12 +0000)]
[AArch64] Convert CMP/SELECT sign patterns to OR & ASR.

ICMP & SELECT patterns extracting the sign of a value can be simplified
to OR & ASR (see  https://alive2.llvm.org/ce/z/Xx4iZ0).

This does not save any instructions in IR, but it is profitable on
AArch64, because we need at least 2 extra instructions to materialize 1
and -1 for the SELECT.

The improvements result in ~5% speedups on loops of the form

    static int sign_of(int x) {
      if (x < 0) return -1;
      return 1;
    }

    void foo(const int *x, int *res, int cnt) {
      for (int i=0;i<cnt;i++)
        res[i] = sign_of(x[i]);
    }

Reviewed By: dmgreen

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

3 years ago[libc][NFC] Make few maths functions buildable outside of LLVM libc build.
Siva Chandra Reddy [Tue, 16 Feb 2021 06:58:21 +0000 (22:58 -0800)]
[libc][NFC] Make few maths functions buildable outside of LLVM libc build.

Few math functions manipulate errno. They assumed that LLVM libc's errno
is available. However, that might not be the case when these functions
are used in a libc which does not use LLVM libc's errno. This change
switches such uses of LLVM libc's errno to the normal public errno macro.
This does not affect LLVM libc's build because the include order ensures
we get LLVM libc's errno. Also, the header check rule ensures we are only
including LLVM libc's errno.h.

3 years ago[analyzer] Fix a warning
Kazu Hirata [Tue, 16 Feb 2021 17:12:07 +0000 (09:12 -0800)]
[analyzer] Fix a warning

This patch fixes a warning from -Wcovered-switch-default.  The switch
statement in question handles all the enum values.

3 years ago[mlir] add verifiers for NVVM and ROCDL kernel attributes
Alex Zinenko [Tue, 16 Feb 2021 17:05:47 +0000 (18:05 +0100)]
[mlir] add verifiers for NVVM and ROCDL kernel attributes

Make sure they can only be attached to LLVM functions as a result of converting
GPU functions to the LLVM Dialect.

3 years ago[coro async] Don't promote allocas to the frame or rewrite swifterror if there are...
Arnold Schwaighofer [Fri, 12 Feb 2021 18:27:31 +0000 (10:27 -0800)]
[coro async] Don't promote allocas to the frame or rewrite  swifterror if there are no suspend points

Also don't call function to update the call graph if there are no
clones. The function will fail.

rdar://74277860

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

3 years ago[flang][fir] Add fir-opt tool
clementval [Tue, 16 Feb 2021 16:48:20 +0000 (11:48 -0500)]
[flang][fir] Add fir-opt tool

This patch introduce the fir-opt tool. Similar to mlir-opt for FIR.
It will be used in following patches to test fir opt and round-trip.

Reviewed By: schweitz, mehdi_amini

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

3 years ago[ARM] Use rGPR for writeback vldrs
David Green [Tue, 16 Feb 2021 16:44:47 +0000 (16:44 +0000)]
[ARM] Use rGPR for writeback vldrs

From what I can tell, a writeback is unpredictable with LR for both
loads and stores. This changes the operand from a gprnopc to a rGPR in
both cases (which I believe is essentially a NFC due to the tied-def
already being a rGPR.)

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

3 years agoAMDGPU: Remove kills following clusters of memory instruction
Matt Arsenault [Sun, 14 Feb 2021 14:54:25 +0000 (09:54 -0500)]
AMDGPU: Remove kills following clusters of memory instruction

In a future commit, soft clauses will be hinted with kill instructions
rather than forced together with bundles. Look for kills that look
like this, and erase them. I'm not sure if the check for specific uses
is worthwhile, or if it would be better to just unconditionally erase
kills.

This reduces test churn in a future patch.

3 years ago[DAG] Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d)))
Simon Pilgrim [Tue, 16 Feb 2021 15:24:23 +0000 (15:24 +0000)]
[DAG] Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d)))

Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d))) -> bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d))

Attempt to fold from a shuffle of a pair of binops to a binop of shuffles, as long as one/both of the binop sources are also shuffles that can be merged with the outer shuffle. This should guarantee that we remove one binop without introducing any additional shuffles.

Technically there's potential for a merged shuffle's lowering to be poorer than the original shuffle, but it could also be better, and I'm not seeing any regressions as long as we keep the 'don't merge splats' rule already present in MergeInnerShuffle.

This expands and generalizes an existing X86 combine and attempts to merge either of each binop's sources (with an on-the-fly commutation of the shuffle mask) - we couldn't do that in the x86 version as it had to stay in a form that DAGCombine's MergeInnerShuffle would still recognise.

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

3 years agoAMDGPU: Fix debug info handling in post-RA bundler
Matt Arsenault [Sun, 14 Feb 2021 15:46:10 +0000 (10:46 -0500)]
AMDGPU: Fix debug info handling in post-RA bundler

This was allowing debug instructions to break the bundling, which
would change scheduling behavior. Bundle debug info / kills inside
the bundle. This seems to work OK, although the asm printer doesn't
understand these in a bundle. This implicitly expects the memory
legalizer to unbundle. It would probably be slightly nicer to move
these after.

Rewrite the loop to be clearer and make sure we don't end a bundle on
a meta instruction, only allow them in between other valid bundle
instructions.

3 years agoReduce the number of attributes attached to each function
serge-sans-paille [Wed, 10 Feb 2021 08:42:50 +0000 (09:42 +0100)]
Reduce the number of attributes attached to each function

This takes advantage of the implicit default behavior to reduce the number of
attributes, which in turns reduces compilation time. I've observed -3% in
instruction count when compiling sqlite3 amalgamation with -O0

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

3 years ago[mlir][vector] Add missing support for contract of integer lowering.
Thomas Raoux [Wed, 10 Feb 2021 23:57:02 +0000 (15:57 -0800)]
[mlir][vector] Add missing support for contract of integer lowering.

Some of the lowering of vector.contract didn't support integer case. Since
reduction of integer cannot accumulate we always break up the reduction op, it
should be merged by a separate canonicalization if possible.

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

3 years ago[mlir] Add canonicalization for tensor_cast + tensor_to_memref
Thomas Raoux [Tue, 16 Feb 2021 05:10:07 +0000 (21:10 -0800)]
[mlir] Add canonicalization for tensor_cast + tensor_to_memref

This helps bufferization passes by removing tensor_cast operations.

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

3 years ago[mlir][vector] Move splitting transfer ops into a separate entry point
Lei Zhang [Tue, 16 Feb 2021 15:00:32 +0000 (10:00 -0500)]
[mlir][vector] Move splitting transfer ops into a separate entry point

These patterns unrolls transfer read/write ops if the vector consumers/
producers are extract/insert slices op. Transfer ops can map to hardware
load/store functionalities, where the vector size matters for bandwidth
considerations. So these patterns should be collected separately, instead
of being generic canonicalization patterns.

Reviewed By: nicolasvasilache

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

3 years ago[libc++] Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set
Colin Finck [Tue, 16 Feb 2021 15:03:04 +0000 (10:03 -0500)]
[libc++] Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set

This allows building libc++ against winpthreads from mingw-w64 to support
operating systems older than Windows 7. The remaining libc++ code already
supports `WIN32` with `LIBCXX_HAS_PTHREAD_API`.

Note that there is also the older "pthreads-win32". However, that support
library implements `pthread_t` as a struct, which violates the libc++
assumption that `pthread_t` is always a scalar and can be compared,
ordered, and set to zero.

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

3 years ago[mlir][vector] Add support for unrolling vector.fma
Lei Zhang [Tue, 16 Feb 2021 14:56:01 +0000 (09:56 -0500)]
[mlir][vector] Add support for unrolling vector.fma

Reviewed By: nicolasvasilache

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

3 years ago[lldb/test] Test lldb-server named pipe functionality on windows
Pavel Labath [Mon, 8 Feb 2021 09:28:42 +0000 (10:28 +0100)]
[lldb/test] Test lldb-server named pipe functionality on windows

lldb-server can use a named pipe to communicate the port number it is
listening on. This windows bits of this are already implemented, but we
did not have a test for that, most likely because python does not have
native pipe functionality.

This patch implements the windows bits necessary to test this. I'm using
the ctypes package to call the native APIs directly to avoid a
dependency to non-standard python packages. This introduces some amount
of boilerplate, but our named pipe use case is fairly limited, so we
should not end up needing to wrap large chunks of windows APIs.

Surprisingly to changes to lldb-server were needed to make the test
pass.

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

3 years ago[clangd] Give modules access to filesystem, scheduler, and index.
Sam McCall [Mon, 15 Feb 2021 19:26:48 +0000 (20:26 +0100)]
[clangd] Give modules access to filesystem, scheduler, and index.

This finally makes it possible to implement useful modules.

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

3 years ago[gn build] Port 40cc63ea6eec
LLVM GN Syncbot [Tue, 16 Feb 2021 14:23:58 +0000 (14:23 +0000)]
[gn build] Port 40cc63ea6eec

3 years ago[clangd] Modules can have a public API. NFC
Sam McCall [Mon, 15 Feb 2021 20:43:11 +0000 (21:43 +0100)]
[clangd] Modules can have a public API. NFC

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