platform/upstream/llvm.git
3 years ago[mlir][Python] Allow PassManager to interop with the capsule APIs.
Stella Laurenzo [Wed, 11 Nov 2020 04:59:18 +0000 (20:59 -0800)]
[mlir][Python] Allow PassManager to interop with the capsule APIs.

* Used in npcomp to cast Python objects via the C-API.

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

3 years ago[intel-pt][trace] Implement a "get supported trace type" packet
Walter Erquinigo [Thu, 29 Oct 2020 19:44:13 +0000 (12:44 -0700)]
[intel-pt][trace] Implement a "get supported trace type" packet

Depends on D89283.

The goal of this packet (jTraceGetSupportedType) is to be able to query the gdb-server for the tracing technology that can work for the current debuggeer, which can make the user experience simpler but allowing the user to simply type

  thread trace start

to start tracing the current thread without even telling the debugger to use "intel-pt", for example. Similarly, `thread trace start [args...]` would accept args beloging to the working trace type.

Also, if the user typed

  help thread trace start

We could directly show the help information of the trace type that is supported for the target, or mention instead that no tracing is supported, if that's the case.

I added some simple tests, besides, when I ran this on my machine with intel-pt support, I got

  $ process plugin packet send "jTraceSupportedType"
    packet: jTraceSupportedType
  response: {"description":"Intel Processor Trace","pluginName":"intel-pt"}

On a machine without intel-pt support, I got

  $ process plugin packet send "jTraceSupportedType"
    packet: jTraceSupportedType
  response: E00;

Reviewed By: clayborg, labath

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

3 years ago[llvm-objcopy][ELF] Try fixing non-determinism of Segment::firstSection
Fangrui Song [Wed, 11 Nov 2020 18:20:30 +0000 (10:20 -0800)]
[llvm-objcopy][ELF] Try fixing non-determinism of Segment::firstSection

3 years ago[MachO] Allow the LC_IDENT load command
Vedant Kumar [Wed, 11 Nov 2020 00:54:22 +0000 (16:54 -0800)]
[MachO] Allow the LC_IDENT load command

xnu coredumps include an LC_IDENT load command. It's helpful to be able
to just ignore these. IIUC an interested client can grab the identifier
using the MachOObjectFile::load_commands() API.

The status quo is that llvm bails out when it finds an LC_IDENT because
the command is obsolete (see isLoadCommandObsolete).

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

3 years ago[BasicAA] Add test for incorrect BatchAA result (NFC)
Nikita Popov [Wed, 11 Nov 2020 17:37:06 +0000 (18:37 +0100)]
[BasicAA] Add test for incorrect BatchAA result (NFC)

BatchAA produces an incorrect result, because a result based on
a temporary phi noalias assumption is cached.

3 years ago[Driver] hip-toolchain-device-only.hip - remove unused check prefix
Simon Pilgrim [Wed, 11 Nov 2020 17:29:56 +0000 (17:29 +0000)]
[Driver] hip-toolchain-device-only.hip - remove unused check prefix

Just use default CHECK

3 years ago[mlir][Python] Add Windows DLL loader to get python extensions working there.
Stella Laurenzo [Fri, 6 Nov 2020 17:48:20 +0000 (09:48 -0800)]
[mlir][Python] Add Windows DLL loader to get python extensions working there.

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

3 years ago[RISCV] Remove traces of Glue from RISCVISD::SELECT_CC
Craig Topper [Wed, 11 Nov 2020 17:30:48 +0000 (09:30 -0800)]
[RISCV] Remove traces of Glue from RISCVISD::SELECT_CC

We were creating RISCVISD::SELECT_CC nodes with Glue output that was never being used, and the tablegen SDNode had the SDNPInGlue flag instead of the SDNPOutGlue flag.

Since we don't seem to need the Glue just get rid of it from both places.

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

3 years ago[AArch64][GlobalISel] Select arith extended add/sub in manual selection code
Jessica Paquette [Tue, 10 Nov 2020 22:12:19 +0000 (14:12 -0800)]
[AArch64][GlobalISel] Select arith extended add/sub in manual selection code

The manual selection code for add/sub was not checking if it was possible to
fold in shifts + extends (the *rx opcode variants).

As a result, we could never select things like

```
cmp x1, w0, uxtw #2
```

Because we don't import any patterns for compares.

This adds support for the arithmetic shifted register forms and updates tests
for instructions selected using `emitADD`, `emitADDS`, and `emitSUBS`.

This is a 0.1% geomean code size improvement on SPECINT2000 at -Os.

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

3 years ago[llvm-objcopy] --only-keep-debug: place zero-size segment according to its parent...
Fangrui Song [Wed, 11 Nov 2020 17:21:10 +0000 (09:21 -0800)]
[llvm-objcopy] --only-keep-debug: place zero-size segment according to its parent segment

Alternative to D74755. sectionWithinSegment() treats an empty section as having
a size of 1. Due to the rule, an empty .tdata will not be attributed to an
empty PT_TLS. (The empty p_align=64 PT_TLS is for Android Bionic's TCB
compatibility (ELF-TLS). See https://reviews.llvm.org/D62055#1507426)

Currently --only-keep-debug will not layout a segment with no section
(layoutSegmentsForOnlyKeepDebug()), thus p_offset of PT_TLS can go past the end
of the file. The strange p_offset can trigger validation errors for subsequent
tools, e.g. llvm-objcopy errors when reading back the separate debug file
(readProgramHeaders()).

This patch places such an empty segment according to its parent segment.  This
special cases works for the empty PT_TLS used in Android. For a non-empty
segment, it should have at least one non-empty section and will be handled by
the normal code. Note, p_memsz PT_LOAD is rejected by both Linux and FreeBSD.

Reviewed By: jhenderson

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

3 years ago[AArch64][GlobalISel] Select negative arithmetic immediates in manual selector
Jessica Paquette [Tue, 10 Nov 2020 00:04:16 +0000 (16:04 -0800)]
[AArch64][GlobalISel] Select negative arithmetic immediates in manual selector

Previously, we only handled negative arithmetic immediates in the imported
selector code.

Since we don't import code for, say, compares, we were missing opportunities
for things like

```
%cst:gpr(s64) = G_CONSTANT i64 -10
%cmp:gpr(s32) = G_ICMP intpred(eq), %reg0(s64), %cst
->
%adds = ADDSXri %reg0, 10, 0, implicit-def $nzcv
%cmp = CSINCWr $wzr, $wzr, 1, implicit $nzcv
```

Instead, we would have to materialize the constant and emit a SUBS.

This adds support for selection like above for SUB, SUBS, ADD, and ADDS.

This is a 0.1% geomean code size improvement on SPECINT2000 at -Os.

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

3 years ago[AMDGPU] Separate out real exp instructions by subtarget. NFC.
Jay Foad [Wed, 11 Nov 2020 10:35:57 +0000 (10:35 +0000)]
[AMDGPU] Separate out real exp instructions by subtarget. NFC.

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

3 years ago[AMDGPU] Split exp instructions out into their own tablegen file. NFC.
Jay Foad [Wed, 11 Nov 2020 10:04:22 +0000 (10:04 +0000)]
[AMDGPU] Split exp instructions out into their own tablegen file. NFC.

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

3 years ago[NFC][AMDGPU] Clean up some lit test prefixes
Scott Linder [Mon, 9 Nov 2020 18:39:55 +0000 (18:39 +0000)]
[NFC][AMDGPU] Clean up some lit test prefixes

Replace some instances of "ALL" with "GCN" where it applies. Committed
as obvious.

3 years agoRevert "[ThreadPlan] Add a test for `thread step-in -r`, NFC"
Stella Stamenova [Wed, 11 Nov 2020 17:09:43 +0000 (09:09 -0800)]
Revert "[ThreadPlan] Add a test for `thread step-in -r`, NFC"

This reverts commit ae3640e386ccfbe0e984cc8c4b0399006ed835c7.

The new test is failing on the Windows LLDB buildbot.

3 years ago[AMDGPU] Make use of SIInstrInfo::isEXP. NFC.
Jay Foad [Wed, 11 Nov 2020 16:46:05 +0000 (16:46 +0000)]
[AMDGPU] Make use of SIInstrInfo::isEXP. NFC.

3 years ago[AsmParser] Add source location to all errors related to .cfi directives
Alex Richardson [Wed, 11 Nov 2020 14:27:01 +0000 (14:27 +0000)]
[AsmParser] Add source location to all errors related to .cfi directives

I was trying to add .cfi_ annotations to assembly code in the FreeBSD
kernel and changed a macro that then resulted in incorrectly nested
directives. However, clang's diagnostics said the error was happening at
<unknown>:0. This addresses one of the TODOs added in D51695.

Reviewed By: MaskRay

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

3 years ago[clang] ns_error_domain attribute also supports CFString typed variables
Alex Lorenz [Wed, 11 Nov 2020 16:49:58 +0000 (08:49 -0800)]
[clang] ns_error_domain attribute also supports CFString typed variables

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

3 years ago[CodeGenCXX] Remove unused check prefixes
Simon Pilgrim [Wed, 11 Nov 2020 16:19:53 +0000 (16:19 +0000)]
[CodeGenCXX] Remove unused check prefixes

3 years ago[CodeGenOpenCL] Fix check prefix typo on convergent.cl test
Simon Pilgrim [Wed, 11 Nov 2020 15:43:00 +0000 (15:43 +0000)]
[CodeGenOpenCL] Fix check prefix typo on convergent.cl test

Noticed while fixing unused prefix warnings - there isn't actually any diff in the loop unrolled ir between old/new pass managers any more, so the broken checks were superfluous

3 years ago[CodeGenObjC] Remove unused check prefixes
Simon Pilgrim [Wed, 11 Nov 2020 15:24:21 +0000 (15:24 +0000)]
[CodeGenObjC] Remove unused check prefixes

3 years ago[CodeGenCUDA] Fix check prefix typo on device-stub.cu tests
Simon Pilgrim [Wed, 11 Nov 2020 15:10:24 +0000 (15:10 +0000)]
[CodeGenCUDA] Fix check prefix typo on device-stub.cu tests

Noticed while fixing unused prefix warnings

3 years ago[Syntax] Tablegen Sequence classes. NFC
Sam McCall [Tue, 3 Nov 2020 02:25:16 +0000 (03:25 +0100)]
[Syntax] Tablegen Sequence classes. NFC

Similar to the previous patch, this doesn't convert *all* the classes that
could be converted. It also doesn't enforce any new invariants etc.

It *does* include some data we don't use yet: specific token types that are
allowed and optional/required status of sequence items. (Similar to Dmitri's
prototype). I think these are easier to add as we go than later, and serve
a useful documentation purpose.

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

3 years agoRevert "Reland [CFGuard] Add address-taken IAT tables and delay-load support"
Hans Wennborg [Wed, 11 Nov 2020 14:55:52 +0000 (15:55 +0100)]
Revert "Reland [CFGuard] Add address-taken IAT tables and delay-load support"

This broke both Firefox and Chromium (PR47905) due to what seems like dllimport
function not being handled correctly.

> This patch adds support for creating Guard Address-Taken IAT Entry Tables (.giats$y sections) in object files, matching the behavior of MSVC. These contain lists of address-taken imported functions, which are used by the linker to create the final GIATS table.
> Additionally, if any DLLs are delay-loaded, the linker must look through the .giats tables and add the respective load thunks of address-taken imports to the GFIDS table, as these are also valid call targets.
>
> Reviewed By: rnk
>
> Differential Revision: https://reviews.llvm.org/D87544

This reverts commit cfd8481da1adba1952e0f6ecd00440986e49a946.

3 years ago[Syntax] Tablegen operator<<(NodeKind). NFC
Sam McCall [Tue, 3 Nov 2020 02:34:51 +0000 (03:34 +0100)]
[Syntax] Tablegen operator<<(NodeKind). NFC

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

3 years ago[CodeGen] Remove unused check prefixes
Simon Pilgrim [Wed, 11 Nov 2020 14:57:19 +0000 (14:57 +0000)]
[CodeGen] Remove unused check prefixes

3 years ago[CodeGen] Fix check prefix mismatch on neon-immediate-ubsan.c tests
Simon Pilgrim [Wed, 11 Nov 2020 14:41:29 +0000 (14:41 +0000)]
[CodeGen] Fix check prefix mismatch on neon-immediate-ubsan.c tests

Noticed while fixing unused prefix warnings,

3 years agoRevert "[hwasan] Fix Thread reuse."
Nico Weber [Wed, 11 Nov 2020 14:55:55 +0000 (09:55 -0500)]
Revert "[hwasan] Fix Thread reuse."

This reverts commit e1eeb026e66c38add2a1f8f1271e1f618c2f7a72.
Test fails: https://reviews.llvm.org/D91208#2388613

3 years agoRevert "[LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizat...
Sander de Smalen [Wed, 11 Nov 2020 14:34:20 +0000 (14:34 +0000)]
Revert "[LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizationCost."

This reverts commits:
* [LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizationCost.
  b873aba3943c067a5efd5303cbdf5aeb0732cf88.
* [LoopVectorizer] Silence warning in GetRegUsage.
  9ff701100a868b7b680aac5c54e9db21a55531fd.

3 years agoRevert "Revert "[AMDGPU] Reorganize GCN subtarget features for unaligned access""
Jay Foad [Wed, 11 Nov 2020 14:33:55 +0000 (14:33 +0000)]
Revert "Revert "[AMDGPU] Reorganize GCN subtarget features for unaligned access""

This reverts commit 8b08fa0103c8d8e624b19fad5a5006e7a783ecb7.

The underlying problems were fixed by D90607.

3 years ago[ValueTracking] computeKnownBitsFromShiftOperator - merge zero/one callbacks to singl...
Simon Pilgrim [Wed, 11 Nov 2020 14:15:17 +0000 (14:15 +0000)]
[ValueTracking] computeKnownBitsFromShiftOperator - merge zero/one callbacks to single KnownBits callback. NFCI.

Another cleanup for D90479 - handle the Known Ones/Zeros in a single callback, which will make it much easier to jump over to the KnownBits shift handling.

3 years agoclang-cl: Expose -f[no-]delete-null-pointer-checks as clang-cl flag
Nico Weber [Wed, 11 Nov 2020 14:18:40 +0000 (09:18 -0500)]
clang-cl: Expose -f[no-]delete-null-pointer-checks as clang-cl flag

3 years ago[mlir] Fix exports in mlir_async_runtime
Paul Lietar [Wed, 11 Nov 2020 11:46:04 +0000 (11:46 +0000)]
[mlir] Fix exports in mlir_async_runtime

The MLIR_ASYNCRUNTIME_EXPORT macro was being defined to be either
__declspec(dllexport) or __declspec(dllimport), depending on whether
mlir_c_runner_utils_EXPORTS is defined. The latter was a copy/paste
error and should have been mlir_async_runtime_EXPORTS.

Additionally, the uses of that macro in the .cpp file were unnecessary,
as only function declarations need to be exported, not their definitions.

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

3 years ago[gn build] Port 250de7388b3
LLVM GN Syncbot [Wed, 11 Nov 2020 14:04:25 +0000 (14:04 +0000)]
[gn build] Port 250de7388b3

3 years ago[OpenCL] Make Clang recognize -cl-std=1.0 as a value argument
Elvina Yakubova [Wed, 11 Nov 2020 13:45:58 +0000 (16:45 +0300)]
[OpenCL] Make Clang recognize -cl-std=1.0 as a value argument

This patch makes Clang recognize -cl-std=1.0 as a value argument,
before only -std=cl1.0 has to be used instead.

Fixes https://bugs.llvm.org/show_bug.cgi?id=47981

Reviewed By: Anastasia

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

3 years agoMLIR: Remove TanhOp from ops list. It caused a build failure.
Adrian Kuegel [Wed, 11 Nov 2020 13:58:55 +0000 (14:58 +0100)]
MLIR: Remove TanhOp from ops list. It caused a build failure.

3 years ago[gn build] (manually) port 98aa067109e
Nico Weber [Wed, 11 Nov 2020 13:39:35 +0000 (08:39 -0500)]
[gn build] (manually) port 98aa067109e

3 years ago[gn build] (semi-manually) Port 454579e46a87
Nico Weber [Wed, 11 Nov 2020 13:34:49 +0000 (08:34 -0500)]
[gn build] (semi-manually) Port 454579e46a87

3 years agoRevert "[gn build] (semi-manually) Port 98aa067109"
Nico Weber [Wed, 11 Nov 2020 13:34:30 +0000 (08:34 -0500)]
Revert "[gn build] (semi-manually) Port 98aa067109"

This reverts commit 04ce13e497be60f51d340e649c72138d49cb13e9.
The commit message was wrong. Will reland with fixed message.

3 years agoMLIR: add SinOp Lowering to __ocml_sin_f32 and __ocml_sin_f64
Adrian Kuegel [Wed, 11 Nov 2020 13:14:43 +0000 (14:14 +0100)]
MLIR: add SinOp Lowering to __ocml_sin_f32 and __ocml_sin_f64

This mimics the recent similar patch for GPUToNVVM.

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

3 years ago[flang][driver] Make sure that `-###` is marked as supported (NFC)
Andrzej Warzynski [Wed, 11 Nov 2020 08:45:54 +0000 (08:45 +0000)]
[flang][driver] Make sure that `-###` is marked as supported (NFC)

`-###` has always been supported in the new flang driver. This patch
merely makes sure that it's included when printing the help screen (i.e.
`flang-new -help`).

3 years ago[AArch64]Add memory op cost model for SVE
Caroline Concatto [Fri, 6 Nov 2020 15:53:59 +0000 (15:53 +0000)]
[AArch64]Add memory op cost model for SVE

This patch adds/fixes memory op cost model for SVE with fixed-width
vector.

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

3 years ago[gn build] (semi-manually) Port 98aa067109
Nico Weber [Mon, 9 Nov 2020 23:04:06 +0000 (18:04 -0500)]
[gn build] (semi-manually) Port 98aa067109

3 years ago[KnownBits] Add KnownBits::commonBits helper. NFCI.
Simon Pilgrim [Wed, 11 Nov 2020 12:07:38 +0000 (12:07 +0000)]
[KnownBits] Add KnownBits::commonBits helper. NFCI.

We have a frequent pattern where we're merging two KnownBits to get the common/shared bits, and I just fell for the gotcha where I tried to use the & operator to merge them........

3 years ago[Test] Add failing test for PR48150
Max Kazantsev [Wed, 11 Nov 2020 12:06:57 +0000 (19:06 +0700)]
[Test] Add failing test for PR48150

3 years ago[clang][cli] Port ObjCMTAction to new option parsing system
Jan Svoboda [Wed, 11 Nov 2020 10:05:24 +0000 (11:05 +0100)]
[clang][cli] Port ObjCMTAction to new option parsing system

Merge existing marhsalling info kinds and add some primitives to
express flag options that contribute to a bitfield.

Depends on D82574

Reviewed By: Bigcheese

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

3 years ago[SVE][CodeGen] Lower scalable masked scatters
Kerry McLaughlin [Wed, 11 Nov 2020 11:15:32 +0000 (11:15 +0000)]
[SVE][CodeGen] Lower scalable masked scatters

Lowers the llvm.masked.scatter intrinsics (scalar plus vector addressing mode only)

Changes included in this patch:
 - Custom lowering for MSCATTER, which chooses the appropriate scatter store opcode to use.
    Floating-point scatters are cast to integer, with patterns added to match FP reinterpret_casts.
 - Added the getCanonicalIndexType function to convert redundant addressing
   modes (e.g. scaling is redundant when accessing bytes)
 - Tests with 32 & 64-bit scaled & unscaled offsets

Reviewed By: sdesmalen

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

3 years ago[Syntax] Start to move trivial Node class definitions to TableGen. NFC
Sam McCall [Sat, 31 Oct 2020 20:09:11 +0000 (21:09 +0100)]
[Syntax] Start to move trivial Node class definitions to TableGen. NFC

This defines two node archetypes with trivial class definitions:
 - Alternatives: the generated abstract classes are trivial as all
   functionality is via LLVM RTTI
 - Unconstrained: this is a placeholder, I think all of these are going to be
   Lists but today they have no special accessors etc, so we just say
   "could contain anything", and migrate them one-by-one to Sequence later.

Compared to Dmitri's prototype, Nodes.td looks more like a class hierarchy and
less like a grammar. (E.g. variants list the Alternatives parent rather than
vice versa).
The main reasons for this:
 - the hierarchy is an important part of the API we want direct control over.
   - e.g. we may introduce abstract bases like "loop" that the grammar doesn't
     care about in order to model is-a concepts that might make refactorings
     more expressive. This is less natural in a grammar-like idiom.
   - e.g. we're likely to have to model some alternatives as variants and others
     as class hierarchies, the choice will probably be based on natural is-a
     relationships.
 - it reduces the cognitive load of switching from editing *.td to working with
   code that uses the generated classes

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

3 years ago[clangd] Improve clangd-indexer performance
Aleksandr Platonov [Wed, 11 Nov 2020 11:29:03 +0000 (14:29 +0300)]
[clangd] Improve clangd-indexer performance

This is a try to improve clangd-indexer tool performance:
- avoid processing already processed files.
- use different mutexes for different entities (e.g. do not block insertion of references while symbols are inserted)

Results for LLVM project indexing:
- before: ~30 minutes
- after: ~10 minutes

Reviewed By: kadircet

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

3 years agoRevert "[flang] Fix CheckSpecificationExpr handling of associated names"
Andrzej Warzynski [Wed, 11 Nov 2020 11:11:48 +0000 (11:11 +0000)]
Revert "[flang] Fix CheckSpecificationExpr handling of associated names"

This reverts commit b670189975f5ba4e8ef22c74724c610287b69c28.

This patch causes shared library builds (BUILD_SHARED_LIBS=ON) to fail:
* http://lab.llvm.org:8011/#/builders/33/builds/626

I wasn't able to identify any easy fix, hence reverting.

3 years ago[clang-format] do not break before @tags in JS comments
Krasimir Georgiev [Wed, 11 Nov 2020 11:07:30 +0000 (12:07 +0100)]
[clang-format] do not break before @tags in JS comments

In JavaScript breaking before a `@tag` in a comment puts it on a new line, and
machinery that parses these comments will fail to understand such comments.

This adapts clang-format to not break before `@`. Similar functionality exists
for not breaking before `{`.

Reviewed By: mprobst

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

3 years ago[llvm-reduce] Add reduction for special globals like llvm.used.
Florian Hahn [Tue, 10 Nov 2020 19:44:18 +0000 (19:44 +0000)]
[llvm-reduce] Add reduction for special globals like llvm.used.

This patch adds a reduction of 'special' globals that lead to further
reductions (e.g. alias or regular globals reduction) being less efficient
because there are special constraints on values referenced in those
special globals. For example, values in @llvm.used and
@llvm.compiler.used need to be named, so replacing all uses of an
alias/global with undef or a different unnamed constant results in
invalid IR.

More details:
https://llvm.org/docs/LangRef.html#intrinsic-global-variables

Reviewed By: lebedev.ri

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

3 years ago[SVE][CodeGen] Add the isTruncatingStore flag to MSCATTER
Kerry McLaughlin [Wed, 11 Nov 2020 10:34:49 +0000 (10:34 +0000)]
[SVE][CodeGen] Add the isTruncatingStore flag to MSCATTER

This patch adds the IsTruncatingStore flag to MaskedScatterSDNode, set by getMaskedScatter().
Updated SelectionDAGDumper::print_details for MaskedScatterSDNode to print
the details of masked scatters (is truncating, signed or scaled).

This is the first in a series of patches which adds support for scalable masked scatters

Reviewed By: sdesmalen

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

3 years ago[LoopVectorizer] Silence warning in GetRegUsage.
Sander de Smalen [Wed, 11 Nov 2020 10:45:28 +0000 (10:45 +0000)]
[LoopVectorizer] Silence warning in GetRegUsage.

This patch silences the warning:
error: lambda capture 'DL' is not used [-Werror,-Wunused-lambda-capture]
  auto GetRegUsage = [&DL, &TTI=TTI](Type *Ty, ElementCount VF) {
                      ~^~~
1 error generated.

Introduced in:
  https://reviews.llvm.org/rGb873aba3943c067a5efd5303cbdf5aeb0732cf88

3 years agoAdd Semantic check for Flang OpenMP 4.5 - 2.7.1 schedule clause
Yashaswini [Wed, 11 Nov 2020 09:55:19 +0000 (15:25 +0530)]
Add Semantic check for Flang OpenMP 4.5 - 2.7.1 schedule clause

Semantic check for the positive chunk size.

Test Cases:
omp-do-schedule01.f90
omp-do-schedule02.f90
omp-do-schedule03.f90
omp-do-schedule04.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan

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

3 years agoReland [Syntax] Add minimal TableGen for syntax nodes. NFC
Sam McCall [Mon, 9 Nov 2020 23:00:51 +0000 (00:00 +0100)]
Reland [Syntax] Add minimal TableGen for syntax nodes. NFC

This reverts commit 09c6259d6d0eb51b282f6c3a28052a8146bc095b.
(Fixed side-effecting code being buried in an assert)

3 years ago[libunwind] LIBUNWIND_REMEMBER_HEAP_ALLOC to cmake.
Daniel Kiss [Wed, 11 Nov 2020 09:58:41 +0000 (10:58 +0100)]
[libunwind] LIBUNWIND_REMEMBER_HEAP_ALLOC to cmake.

Missed it originally in https://reviews.llvm.org/D85005.

Reviewed By: gargaroff

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

3 years ago[LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizationCost.
Sander de Smalen [Wed, 11 Nov 2020 09:55:43 +0000 (09:55 +0000)]
[LoopVectorizer] NFCI: Calculate register usage based on TLI.getTypeLegalizationCost.

This is more accurate than dividing the bitwidth based on the element count by the
maximum register size, as it can just reuse whatever has been calculated for
legalization of these types.

This change is also necessary when calculating register usage for scalable vectors, where
the legalization of these types cannot be done based on the widest register size, because
that does not take the 'vscale' component into account.

Reviewed By: SjoerdMeijer

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

3 years ago[clangd] Abort rename when given the same name
Kirill Bobyrev [Wed, 11 Nov 2020 10:13:43 +0000 (11:13 +0100)]
[clangd] Abort rename when given the same name

When user wants to rename the symbol to the same name we shouldn't do any work.
Bail out early and return error to save compute.

Resolves: https://github.com/clangd/clangd/issues/580

Reviewed By: hokein

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

3 years ago[NFC][ARM] Replace lambda with any_of
Sam Parker [Wed, 11 Nov 2020 10:02:20 +0000 (10:02 +0000)]
[NFC][ARM] Replace lambda with any_of

3 years ago[LoopVectorizer] NFC: Return ElementCount from compute[Feasible]MaxVF
Sander de Smalen [Wed, 11 Nov 2020 09:22:18 +0000 (09:22 +0000)]
[LoopVectorizer] NFC: Return ElementCount from compute[Feasible]MaxVF

Interfaces changed to return `ElementCount`:
* LoopVectorizationCostModel::computeMaxVF
* LoopVectorizationCostModel::computeFeasibleMaxVF

This is NFC for fixed-width vectors.

Reviewed By: dmgreen, ctetreau

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

3 years ago[mlir] Add NumberOfExecutions analysis + update RegionBranchOpInterface interface...
Eugene Zhulenev [Wed, 11 Nov 2020 09:38:51 +0000 (01:38 -0800)]
[mlir] Add NumberOfExecutions analysis + update RegionBranchOpInterface interface to query number of region invocations

Implements RFC discussed in: https://llvm.discourse.group/t/rfc-operationinstancesinterface-or-any-better-name/2158/10

Reviewed By: silvas, ftynse, rriddle

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

3 years ago[mlir] Rework DialectConversion inlineRegionBefore
Tres Popp [Tue, 10 Nov 2020 18:03:11 +0000 (19:03 +0100)]
[mlir] Rework DialectConversion inlineRegionBefore

The previous logic for inlining a region A with N blocks into region B
would produce incorrect results on rollback for N greater than 1. This
rollback logic would leave blocks 1..N in region B and only move block 0
to region A.

The new inlining action recording stores the block move actions from N-1
to 0. Now on roll back, block 0 is moved to region A and then 1..N is
appended to the list of blocks in region A.

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

3 years ago[mlir][gpu] Add missing initialization of gpu runtime wrappers.
Christian Sigg [Tue, 10 Nov 2020 11:56:50 +0000 (12:56 +0100)]
[mlir][gpu] Add missing initialization of gpu runtime wrappers.

Reviewed By: herhut

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

3 years ago[mlir] Use assemblyFormat in AllocLikeOp.
Christian Sigg [Wed, 11 Nov 2020 08:42:23 +0000 (09:42 +0100)]
[mlir] Use assemblyFormat in AllocLikeOp.

Split operands into dynamicSizes and symbolOperands.

Reviewed By: nicolasvasilache

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

3 years ago[NFC] First test commit
Jan Svoboda [Wed, 11 Nov 2020 09:20:11 +0000 (10:20 +0100)]
[NFC] First test commit

3 years ago[SelectionDAG] fminnum should be a binary operator
Chen Zheng [Tue, 10 Nov 2020 15:01:00 +0000 (10:01 -0500)]
[SelectionDAG] fminnum should be a binary operator

Reviewed By: craig.topper

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

3 years ago[mlir][llvm] Expose getters for alias and align attribute names
Stephan Herhut [Tue, 10 Nov 2020 15:59:54 +0000 (16:59 +0100)]
[mlir][llvm] Expose getters for alias and align attribute names

This adds getters for `llvm.align` and `llvm.noalias` strings that are used
as attribute names in the llvm dialect.

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

3 years ago[mlir] Allow omitting spaces in assemblyFormat with a `` literal.
Christian Sigg [Wed, 11 Nov 2020 07:24:16 +0000 (08:24 +0100)]
[mlir] Allow omitting spaces in assemblyFormat with a `` literal.

I would like to use this for D90589 to switch std.alloc to assemblyFormat.
Hopefully it will be useful in other places as well.

Reviewed By: rriddle

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

3 years ago[lldb][test] Remove not_remote_testsuite_ready in favor of skipIfRemote decorator
Raphael Isemann [Wed, 11 Nov 2020 08:13:56 +0000 (09:13 +0100)]
[lldb][test] Remove not_remote_testsuite_ready in favor of skipIfRemote decorator

Those two decorators have identical behaviour. This removes
`not_remote_testsuite_ready` as `skipIfRemote` seems more consistent with the
other decorator names we have

Reviewed By: JDevlieghere

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

3 years ago[CodeGen][X86] Remove unused check-prefixes from vec tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 07:32:08 +0000 (15:32 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vec tests. NFCI.

3 years ago[clangd] NFC: Add more logging to remote index test
Kirill Bobyrev [Tue, 10 Nov 2020 12:59:26 +0000 (13:59 +0100)]
[clangd] NFC: Add more logging to remote index test

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 07:13:43 +0000 (15:13 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 06:49:00 +0000 (14:49 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.

3 years ago[AArch64][GlobalISel] Port some AArch64 target specific MUL combines from SDAG.
Amara Emerson [Tue, 10 Nov 2020 05:55:22 +0000 (21:55 -0800)]
[AArch64][GlobalISel] Port some AArch64 target specific MUL combines from SDAG.

These do things like turn a multiply of a pow-2+1 into a shift and and add,
which is a common pattern that pops up, and is universally better than expensive
madd instructions with a constant.

I've added check lines to an existing codegen test since the code being ported
is almost identical, however the mul by negative pow2 constant tests don't generate
the same code because we're missing some generic G_MUL combines still.

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

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 06:17:24 +0000 (14:17 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 05:45:35 +0000 (13:45 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector tzcnt tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 05:31:01 +0000 (13:31 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector tzcnt tests. NFCI.

3 years ago[NFC, Refactor] Rename the (scoped) enum DeclaratorContext's enumerators to remove...
Faisal Vali [Wed, 11 Nov 2020 05:40:12 +0000 (23:40 -0600)]
[NFC, Refactor] Rename the (scoped) enum DeclaratorContext's enumerators to remove duplication

Since these are scoped enumerators, they have to be prefixed by DeclaratorContext, so lets remove Context from the name, and return some characters to the multiverse.

Patch was reviewed here: https://reviews.llvm.org/D91011

Thank you to aaron, bruno, wyatt and barry for indulging me.

3 years ago[SafeStack] Make sure SafeStack does not break musttail call contract
Xun Li [Wed, 11 Nov 2020 04:46:05 +0000 (20:46 -0800)]
[SafeStack] Make sure SafeStack does not break musttail call contract

SafeStack instrumentation should not insert anything inbetween musttail call and return instruction.
For every ReturnInst that needs to be instrumented, we adjust the insertion point to the musttail call if exists.

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

3 years ago[SCEV] Generalize no-self-wrap check in isLoopInvariantExitCondDuringFirstIterations
Max Kazantsev [Wed, 11 Nov 2020 04:17:13 +0000 (11:17 +0700)]
[SCEV] Generalize no-self-wrap check in isLoopInvariantExitCondDuringFirstIterations

Lift limitation on step being `+/- 1`. In fact, the only thing it is needed for
is proving no-self-wrap. We can instead check this flag directly.

Theoretically it can increase the scope of the transform, but I could not
construct such test easily.

Differential Revision: https://reviews.llvm.org/D91126
Reviewed By: apilipenko

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:55:09 +0000 (11:55 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:43:22 +0000 (11:43 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:31:04 +0000 (11:31 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector popcnt tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:22:03 +0000 (11:22 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector popcnt tests. NFCI.

3 years ago[clang] Add missing header guard in <cpuid.h>
Roland McGrath [Wed, 11 Nov 2020 02:56:59 +0000 (18:56 -0800)]
[clang] Add missing header guard in <cpuid.h>

This header has long lacked a standard multiple inclusion guard
like other headers have, for no apparent reason.  The GCC header
of the same name likewise lacks one up through release 10.1, but
trunk GCC (release 11, and perhaps future 10.x) has fixed it
(see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96238).

Reviewed By: phosek

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

3 years agoRevert "[BranchProbabilityInfo] Use SmallVector (NFC)"
Kazu Hirata [Wed, 11 Nov 2020 03:17:13 +0000 (19:17 -0800)]
Revert "[BranchProbabilityInfo] Use SmallVector (NFC)"

This reverts commit 2f1038c7b699e959e0521638e2e2818a849fe19c.

3 years ago[CodeGen][X86] Remove unused check-prefixes from mask tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:07:05 +0000 (11:07 +0800)]
[CodeGen][X86] Remove unused check-prefixes from mask tests. NFCI.

3 years ago[NFC] Use [MC]Register in TwoAddressInstructionPass
Gaurav Jain [Wed, 4 Nov 2020 14:51:00 +0000 (06:51 -0800)]
[NFC] Use [MC]Register in TwoAddressInstructionPass

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

3 years agoFix the data layout mangling specification for 'arm64-pc-win32-macho'
Akira Hatanaka [Wed, 11 Nov 2020 02:36:10 +0000 (18:36 -0800)]
Fix the data layout mangling specification for 'arm64-pc-win32-macho'

rdar://problem/70410504

3 years agoNFC - use script to update testcases and add new testcases.
Chen Zheng [Tue, 10 Nov 2020 14:46:43 +0000 (09:46 -0500)]
NFC - use script to update testcases and add new testcases.

3 years ago[libc++] Change requirements on linear_congruential_engine.
zoecarver [Wed, 11 Nov 2020 02:23:22 +0000 (18:23 -0800)]
[libc++] Change requirements on linear_congruential_engine.

This patch changes how linear_congruential_engine picks its randomization
algorithm. It adds two restrictions, `_OverflowOK` and `_SchrageOK`.
`_OverflowOK` means that m is a power of two so using the classic
`(a * x + c) % m` will create a meaningless overflow. The second checks
that Schrage's algorithm will produce results that are in bounds of min
and max. This patch fixes https://llvm.org/PR27839.

Differential Revision: D65041

3 years ago[EarlyCSE] delete abs/nabs handling
Chen Zheng [Tue, 10 Nov 2020 02:24:36 +0000 (21:24 -0500)]
[EarlyCSE] delete abs/nabs handling

delete abs/nabs handling in earlycse pass to avoid bugs related to
hashing values. After abs/nabs is canonicalized to intrinsics in D87188,
we should get CSE ability for abs/nabs back.

Reviewed By: spatel

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

3 years ago[lld][WebAssembly] Allow references to __tls_base without shared memory
Sam Clegg [Tue, 10 Nov 2020 01:52:39 +0000 (17:52 -0800)]
[lld][WebAssembly] Allow references to __tls_base without shared memory

Previously we limited the use of atomics and TLS to programs
linked with `--shared-memory`.

However, as of https://reviews.llvm.org/D79530 we now allow
programs that use atomic to be linked without `--shared-memory`.
For this to be useful we also want to all TLS usage in such
programs.  In this case, since we know we are single threaded
we simply include the TLS data as a regular active segment
and create an immutable `__tls_base` global that point to the
start of this segment.

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

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

3 years ago[hwasan] Fix Thread reuse.
Evgenii Stepanov [Tue, 10 Nov 2020 22:15:47 +0000 (14:15 -0800)]
[hwasan] Fix Thread reuse.

HwasanThreadList::DontNeedThread clobbers Thread::next_, breaking the
freelist. As a result, only the top of the freelist ever gets reused,
and the rest of it is lost.

Since the Thread object its associated ring buffer is only 8Kb, this is
typically only noticable in long running processes, such as fuzzers.

Fix the problem by switching from an intrusive linked list to a vector.

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

3 years ago[CodeGen][X86] Remove unused check-prefixes from bitcast tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 01:11:28 +0000 (09:11 +0800)]
[CodeGen][X86] Remove unused check-prefixes from bitcast tests. NFCI.

3 years ago[test] Delete redundant lldbutil import, NFC
Vedant Kumar [Wed, 11 Nov 2020 00:37:22 +0000 (16:37 -0800)]
[test] Delete redundant lldbutil import, NFC

3 years ago[ThreadPlan] Add a test for `thread step-in -r`, NFC
Vedant Kumar [Wed, 11 Nov 2020 00:01:16 +0000 (16:01 -0800)]
[ThreadPlan] Add a test for `thread step-in -r`, NFC

Adds test coverage for ThreadPlanStepInRange::SetAvoidRegexp.

See:
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Target/ThreadPlanStepInRange.cpp.html#L309

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

3 years ago[flang] Fix CheckSpecificationExpr handling of associated names
peter klausler [Tue, 10 Nov 2020 22:53:01 +0000 (14:53 -0800)]
[flang] Fix CheckSpecificationExpr handling of associated names

Avoid a spurious error message about a dummy procedure reference
in a specification expression by restructuring the handling of
use-associated and host-associated symbols.

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

3 years ago[ThreadPlan] Delete unused ThreadPlanStepInRange code, NFC
Vedant Kumar [Tue, 10 Nov 2020 23:22:29 +0000 (15:22 -0800)]
[ThreadPlan] Delete unused ThreadPlanStepInRange code, NFC