platform/upstream/llvm.git
3 years ago[lit] Avoid calling realpath() for every printed message
Alex Richardson [Mon, 19 Oct 2020 15:21:10 +0000 (16:21 +0100)]
[lit] Avoid calling realpath() for every printed message

I did some profiling of lit while trying to optimize the libc++ test
startup for remote hosts and it turns out that there is a realpath() call
for every message printed and this shows up in the profile.
The inspect.getframeinfo() function calls realpath() internally and
moreover we don't need most of the other information returned from it.
This patch uses inspect.getsourcefile() and os.path.abspath() to remove
../ from the path instead. Not resolving symlinks reduces the startup time
for running a single test with lit by about 50ms for me.

Reviewed By: ldionne, yln
Differential Revision: https://reviews.llvm.org/D89186

3 years agoRevert rGa704d8238c86bac: "[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp...
Simon Pilgrim [Mon, 19 Oct 2020 15:03:21 +0000 (16:03 +0100)]
Revert rGa704d8238c86bac: "[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support"

This reverts commit a704d8238c86bac524f14adb6b04e0908a324e15.

Causing stage2 build failures on some bots.

3 years ago[clang-tidy] Add scoped enum constants to identifier naming check
Nathan James [Mon, 19 Oct 2020 14:57:46 +0000 (15:57 +0100)]
[clang-tidy] Add scoped enum constants to identifier naming check

Added option `ScopedEnumConstant(Prefix|Case|Suffix)` to readability-identitied-naming.
This controls the style for constants in scoped enums, declared as enum (class|struct).
If this option is unspecified the EnumConstant style will be used instead.

Reviewed By: aaron.ballman

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

3 years ago[flang] Add name match checks for interface procedures
Peter Steinfeld [Sat, 17 Oct 2020 01:27:51 +0000 (18:27 -0700)]
[flang] Add name match checks for interface procedures

We had neglected to check for name mismatches for procedure definitions that
appear in interfaces.

I also changed label11.f90 to an error test since I think they're better than
"FileCheck" tests.

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

3 years ago[clangd] Add test for structured-binding completion. NFC
Sam McCall [Mon, 19 Oct 2020 14:45:32 +0000 (16:45 +0200)]
[clangd] Add test for structured-binding completion. NFC

3 years ago[MLIR][SPIRVToLLVM] Updated documentation for composite ops
George Mitenkov [Mon, 19 Oct 2020 14:20:11 +0000 (17:20 +0300)]
[MLIR][SPIRVToLLVM] Updated documentation for composite ops

Added a section on composite ops (`spv.CompositeExtract` and
`spv.CompositeInsert`) conversion.

Reviewed By: antiagainst

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

3 years ago[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) vector support
Simon Pilgrim [Mon, 19 Oct 2020 14:41:07 +0000 (15:41 +0100)]
[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) vector support

Scalar cases were already being handled by foldLogOpOfMaskedICmps (so this was dead code), but refactoring to support non-uniform vectors will take some time, so tweak this fold in the meantime.

3 years agoRevert "Extend tests of run-clang-tidy"
Aaron Ballman [Mon, 19 Oct 2020 14:36:15 +0000 (10:36 -0400)]
Revert "Extend tests of run-clang-tidy"

This reverts commit 627c01bee0deb353b3e3e90c1b8d0b6d73464466.

Some failing build bots:
http://lab.llvm.org:8011/#/builders/109/builds/690
http://lab.llvm.org:8011/#/builders/14/builds/476

3 years ago[Aarch64] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans.
Paul C. Anagnostopoulos [Thu, 15 Oct 2020 22:42:27 +0000 (18:42 -0400)]
[Aarch64] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans.

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

3 years agoExtend tests of run-clang-tidy
Alexander Lanin [Mon, 19 Oct 2020 14:28:21 +0000 (10:28 -0400)]
Extend tests of run-clang-tidy

new test: parsing and using compile_commands
new test: export fixes to yaml file
old test extended with CHECK-MESSAGES in order to ensure that they "fail as intended"

3 years ago[InstCombine] Add (icmp eq B, 0) | (icmp ult/gt A, B) -> (icmp ule A, B-1) vector...
Simon Pilgrim [Mon, 19 Oct 2020 14:23:35 +0000 (15:23 +0100)]
[InstCombine] Add (icmp eq B, 0) | (icmp ult/gt A, B) -> (icmp ule A, B-1) vector support

3 years ago[clang-tidy] Better support for Override function in RenamerClangTidy based checks
Nathan James [Mon, 19 Oct 2020 14:21:05 +0000 (15:21 +0100)]
[clang-tidy] Better support for Override function in RenamerClangTidy based checks

Methods that override virtual methods will now get renamed if the initial virtual method has a name violation.
Addresses https://bugs.llvm.org/show_bug.cgi?id=34879

Reviewed By: alexfh

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

3 years ago[clangd] Rename edge name for filesymbols to slabs in memorytree
Kadir Cetinkaya [Mon, 19 Oct 2020 10:33:35 +0000 (12:33 +0200)]
[clangd] Rename edge name for filesymbols to slabs in memorytree

This was causing duplicate `symbols` components on the path as both the
edge from an index to filesymbols and filesymbols to symbolslabs were named
symbols.

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

3 years ago[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) unifor...
Simon Pilgrim [Mon, 19 Oct 2020 13:55:18 +0000 (14:55 +0100)]
[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support

3 years ago[InstCombine] foldOrOfICmps - pull out repeated getOperand() calls. NFCI.
Simon Pilgrim [Mon, 19 Oct 2020 13:05:29 +0000 (14:05 +0100)]
[InstCombine] foldOrOfICmps - pull out repeated getOperand() calls. NFCI.

3 years ago[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) vector...
Simon Pilgrim [Mon, 19 Oct 2020 12:55:33 +0000 (13:55 +0100)]
[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) vector tests

3 years ago[TableGen] Enhance !empty and !size to handle strings and DAGs.
Paul C. Anagnostopoulos [Sun, 18 Oct 2020 14:47:07 +0000 (10:47 -0400)]
[TableGen] Enhance !empty and !size to handle strings and DAGs.
Fix bug in the type checking for !empty, !head, !size, !tail.

3 years ago[clang] update of the DragonFlyBSD's driver for the 5.8.x releases
David Carlier [Mon, 19 Oct 2020 13:04:49 +0000 (14:04 +0100)]
[clang] update of the DragonFlyBSD's driver for the 5.8.x releases

Reviewers: sepavloff, jyknight

Reviewed By: sepavloff

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

3 years ago[ADT] Avoid use of result_of_t in function_ref
Sam McCall [Mon, 19 Oct 2020 12:58:31 +0000 (14:58 +0200)]
[ADT] Avoid use of result_of_t in function_ref

It has bugs on some old libc++ versions and we don't need the power.
See https://reviews.llvm.org/D88977

3 years ago[AMDGPU] Do not generate S_CMP_LG_U64 on gfx7
Piotr Sobczak [Fri, 16 Oct 2020 07:11:01 +0000 (09:11 +0200)]
[AMDGPU] Do not generate S_CMP_LG_U64 on gfx7

S_CMP_LG_U64 was added in gfx8 and is guarded by hasScalarCompareEq64().

Rewrite S_CMP_LG_U64 to S_OR_B32 + S_CMP_LG_U32 for targets that
do not support 64-bit scalar compare.

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

3 years ago[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) tests
Simon Pilgrim [Mon, 19 Oct 2020 12:42:41 +0000 (13:42 +0100)]
[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) tests

3 years ago[RISCV][ASAN] Fix TLS offsets
Luís Marques [Mon, 19 Oct 2020 12:40:34 +0000 (13:40 +0100)]
[RISCV][ASAN] Fix TLS offsets

Fix a RISC-V ASan test failure: `TestCases/Linux/static_tls.cpp`.

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

3 years agoFix compiler-rt build on Windows after D89640
Hans Wennborg [Mon, 19 Oct 2020 12:38:53 +0000 (14:38 +0200)]
Fix compiler-rt build on Windows after D89640

It moved the cmake code from the else-branch to the if-branch
but forgot to flip the condition.

3 years ago[VE] Add setcc for fp128
Kazushi (Jam) Marukawa [Sun, 18 Oct 2020 00:20:34 +0000 (09:20 +0900)]
[VE] Add setcc for fp128

Add setcc for fp128 and clean existing ISel patterns.  Also add
a regression test.

Reviewed By: simoll

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

3 years ago[VE] Add cast to/from fp128 patterns
Kazushi (Jam) Marukawa [Sat, 17 Oct 2020 17:30:28 +0000 (02:30 +0900)]
[VE] Add cast to/from fp128 patterns

Add cast to/from fp128 patterns.  Clean other cast patterns too.
Update a regression test by adding missing tests.

Reviewed By: simoll

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

3 years ago[yaml2obj] - Fix comments. NFC.
Georgii Rymar [Mon, 19 Oct 2020 12:13:01 +0000 (15:13 +0300)]
[yaml2obj] - Fix comments. NFC.

This addressed post commit comments for D89391.

3 years ago[llvm-readobj/elf] - Change the behavior of handing DT_SONAME.
Georgii Rymar [Wed, 14 Oct 2020 11:20:38 +0000 (14:20 +0300)]
[llvm-readobj/elf] - Change the behavior of handing DT_SONAME.

The current situation/behavior is:
1) llvm-readelf doesn't need a string that is specified by `DT_SONAME`.
2) llvm-readobj/elf always tries to read it, even when there is no `DT_SONAME` tag.
3) Because of that both tools reports a warning for many our test cases.

This patch delays getting a SOName string and changes the behavior (llvm-readobj) to
only report a warning when there is a `DT_SONAME` and a string cab't be read.
Warning is not reported for llvm-readelf, as it never tries to dump it.

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

3 years ago[LangRef] Correct return type llvm.test.set.loop.iterations.*
Sam Parker [Mon, 19 Oct 2020 11:26:44 +0000 (12:26 +0100)]
[LangRef] Correct return type llvm.test.set.loop.iterations.*

The langref description for llvm.test.set.loop.iterations.* were
missing the i1 return type.

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

Patch by: Janek van Oirschot

3 years ago[nfc][clang-change-namespace] Remove unnecessary isScoped EnumDecl Matcher
Nathan James [Mon, 19 Oct 2020 11:53:51 +0000 (12:53 +0100)]
[nfc][clang-change-namespace] Remove unnecessary isScoped EnumDecl Matcher

3 years ago[mlir][nfc] Move BaseOpWithOffsetSizesAndStrides to the beginning of Ops.td.
Alexander Belyaev [Sat, 17 Oct 2020 11:15:31 +0000 (13:15 +0200)]
[mlir][nfc] Move BaseOpWithOffsetSizesAndStrides to the beginning of Ops.td.

Move the class to where all base classes are defined.
Also remove all the builders since they are definted in subclasses anyway.

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

3 years ago[mlir] Refactored BufferPlacement transformation.
Marcel Koester [Wed, 16 Sep 2020 10:31:08 +0000 (12:31 +0200)]
[mlir] Refactored BufferPlacement transformation.

The current BufferPlacement transformation contains several concepts for
hoisting allocations. However, more advanced hoisting techniques should not be
integrated into the BufferPlacement transformation. Hence, this CL refactors the
current BufferPlacement pass into three separate pieces: BufferDeallocation and
BufferAllocation(Loop)Hoisting. Moreover, it extends the hoisting functionality
by allowing to move allocations out of loops.

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

3 years ago[InstCombine] Add (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1) vector tests
Simon Pilgrim [Mon, 19 Oct 2020 10:46:21 +0000 (11:46 +0100)]
[InstCombine] Add (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1) vector tests

3 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Mon, 19 Oct 2020 10:15:38 +0000 (11:15 +0100)]
Fix MSVC "not all control paths return a value" warning. NFCI.

3 years ago[nfc] [lldb] Move LookupAddress to DWARFCompileUnit
Jan Kratochvil [Mon, 19 Oct 2020 09:26:16 +0000 (11:26 +0200)]
[nfc] [lldb] Move LookupAddress to DWARFCompileUnit

LookupAddress makes no sense for DWARFTypeUnit.
Also make GetNonSkeletonUnit to preserve the called type.

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

3 years agoRevert "[PM/CC1] Add -f[no-]split-cold-code CC1 option to toggle splitting"
Hans Wennborg [Mon, 19 Oct 2020 10:23:22 +0000 (12:23 +0200)]
Revert "[PM/CC1] Add -f[no-]split-cold-code CC1 option to toggle splitting"

This broke Chromium's PGO build, it seems because hot-cold-splitting got turned
on unintentionally. See comment on the code review for repro etc.

> This patch adds -f[no-]split-cold-code CC1 options to clang. This allows
> the splitting pass to be toggled on/off. The current method of passing
> `-mllvm -hot-cold-split=true` to clang isn't ideal as it may not compose
> correctly (say, with `-O0` or `-Oz`).
>
> To implement the -fsplit-cold-code option, an attribute is applied to
> functions to indicate that they may be considered for splitting. This
> removes some complexity from the old/new PM pipeline builders, and
> behaves as expected when LTO is enabled.
>
> Co-authored by: Saleem Abdulrasool <compnerd@compnerd.org>
> Differential Revision: https://reviews.llvm.org/D57265
> Reviewed By: Aditya Kumar, Vedant Kumar
> Reviewers: Teresa Johnson, Aditya Kumar, Fedor Sergeev, Philip Pfaffe, Vedant Kumar

This reverts commit 273c299d5d649a0222fbde03c9a41e41913751b4.

3 years ago[clangd] Add $/memoryUsage LSP extension
Kadir Cetinkaya [Mon, 12 Oct 2020 22:10:04 +0000 (00:10 +0200)]
[clangd] Add $/memoryUsage LSP extension

Performs a detailed profiling of clangd lsp server and conveys the
result to the client as a json object. It is of the form:
   {
     "_self": 0,
     "_total": 8,
     "child1": {
       "_self": 4,
       "_total": 4,
     }
     "child2": {
       "_self": 2,
       "_total": 4,
       "child_deep": {
         "_self": 2,
         "_total": 2,
       }
     }
   }

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

3 years ago[InstCombine] Support vectors-with-undef in and(logicalshift(1,X),1) --> zext(X ...
Simon Pilgrim [Fri, 16 Oct 2020 15:06:14 +0000 (16:06 +0100)]
[InstCombine] Support vectors-with-undef in and(logicalshift(1,X),1) --> zext(X == 0) fold

3 years ago[InstCombine] Add vectors-with-undef tests for and(logicalshift(1,X),1) --> zext...
Simon Pilgrim [Fri, 16 Oct 2020 14:56:05 +0000 (15:56 +0100)]
[InstCombine] Add vectors-with-undef tests for and(logicalshift(1,X),1) --> zext(X == 0)

3 years agoFix build issue caused by f693f915a07eca94a3faeadc3b5dad59fc0eb1de
David Sherwood [Mon, 19 Oct 2020 09:44:17 +0000 (10:44 +0100)]
Fix build issue caused by f693f915a07eca94a3faeadc3b5dad59fc0eb1de

3 years ago[VE] Support select_cc
Kazushi (Jam) Marukawa [Sat, 17 Oct 2020 13:09:50 +0000 (22:09 +0900)]
[VE] Support select_cc

Add missing ISel patterns related to select_cc DAG nodes.
Add regression test of all combination of possible scalar types.

Reviewed By: simoll

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

3 years ago[VE] Add VBRD/VMV instructions
Kazushi (Jam) Marukawa [Sun, 18 Oct 2020 09:47:45 +0000 (18:47 +0900)]
[VE] Add VBRD/VMV instructions

Add VBRD/VMV vector instructions.  In order to do that, also support
VM512 registers and RV instruction format in MC layer.  Also add
regression tests for new instructions.

Reviewed By: simoll

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

3 years ago[VE] Add LSV/LVS/LVM/SVM instructions
Kazushi (Jam) Marukawa [Thu, 15 Oct 2020 21:43:57 +0000 (06:43 +0900)]
[VE] Add LSV/LVS/LVM/SVM instructions

Add LSV/LVS/LVM/SVM vector instructions and regression tests.
Also update AsmParser to support new format of operands.

Reviewed By: simoll

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

3 years ago[VE] Support br_cc comparing fp128
Kazushi (Jam) Marukawa [Sat, 17 Oct 2020 14:45:18 +0000 (23:45 +0900)]
[VE] Support br_cc comparing fp128

Support br_cc instruction comparing fp128 values.  Add a br_cc.ll
regression test for all kind of br_cc instructions.  And, clean
existing branch regression tests, this time.  Clean a brcond.ll
regression test for brcond instruction.  Remove mixed branch1.ll
regression test.

Reviewed By: simoll

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

3 years ago[VE] Update ISel patterns for select instruction
Kazushi (Jam) Marukawa [Thu, 15 Oct 2020 21:24:29 +0000 (06:24 +0900)]
[VE] Update ISel patterns for select instruction

Add an ISel pattern for fp128 select instruction and optimize generated
code for other types' select. instructions.  Add a regression test also.

Reviewed By: simoll

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

3 years ago[mlir] Use `let arguments =` syntax instead of inheritance in LLVM dialect
Alex Zinenko [Fri, 16 Oct 2020 16:30:08 +0000 (18:30 +0200)]
[mlir] Use `let arguments =` syntax instead of inheritance in LLVM dialect

LLVM dialect has been defining Op arguments by deriving the `Arguments` ODS
class. This has arguably worse readability due to large indentation caused by
multiple derivations, and is inconsistent with other ODS files. Use the `let
arguments` form instead.

Reviewed By: rriddle

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

3 years ago[ORC] Break up C-API header Orc.h, and add JITEventListener support.
Lang Hames [Fri, 16 Oct 2020 23:50:24 +0000 (16:50 -0700)]
[ORC] Break up C-API header Orc.h, and add JITEventListener support.

This patch breaks Orc.h up into Orc.h, LLJIT.h and OrcEE.h.

Orc.h contain core Orc utilities.
LLJIT.h contains LLJIT specific types and functions.
OrcEE.h contains types and functions that depend on ExecutionEngine.

The intent is that these headers should match future library divisions: Clients
who only use Orc.h should only need to link againt the Orc core libraries,
clients using LLJIT.h will also need to link against LLVM core, and clients
using OrcEE.h will also have to link against ExecutionEngine.

In addition to breaking up the Orc.h header this patch introduces functions to:
(1) Set the object linking layer creation function on LLJITBuilder.
(2) Create an RTDyldObjectLinkingLayer instance (particularly for use in (1)).
(3) Register JITEventListeners with an RTDyldObjectLinkingLayer.

Together (1), (2) and (3) can be used to force use of RTDyldObjectLinkingLayer
as the underlying JIT linker for LLJIT, rather than the platform default, and
to register event listeners with the RTDyldObjectLinkingLayer.

3 years ago[ORC] Add function to get pool entry string.
Lang Hames [Mon, 19 Oct 2020 08:36:14 +0000 (01:36 -0700)]
[ORC] Add function to get pool entry string.

Patch by Andres Freund. Thanks Andres!

3 years ago[ORC] Add C API support for defining absolute symbols.
Lang Hames [Fri, 16 Oct 2020 03:33:22 +0000 (20:33 -0700)]
[ORC] Add C API support for defining absolute symbols.

Also tweaks the definition of TryToGenerate to make it dovetail more neatly
with the new function.

3 years ago[ORC] Add support for custom generators to the C bindings.
Lang Hames [Fri, 16 Oct 2020 00:33:16 +0000 (17:33 -0700)]
[ORC] Add support for custom generators to the C bindings.

C API clients can now define a custom definition generator by providing a
callback function (to implement DefinitionGenerator::tryToGenerate) and context
object. All arguments for the DefinitionGenerator::tryToGenerate method have
been given C API counterparts, and the API allows for optionally asynchronous
generation.

3 years ago[Support] Add a C-API function to create a StringError instance.
Lang Hames [Fri, 16 Oct 2020 00:31:14 +0000 (17:31 -0700)]
[Support] Add a C-API function to create a StringError instance.

This will allow C API clients to return errors from callbacks. This
functionality will be used in upcoming Orc C-bindings functions.

3 years ago[ORC] Add an OrcV2 ResourceTracker / Removable-code example.
Lang Hames [Thu, 15 Oct 2020 01:40:49 +0000 (18:40 -0700)]
[ORC] Add an OrcV2 ResourceTracker / Removable-code example.

3 years ago[ORC] Add basic ResourceTracker support to the OrcV2 C Bindings.
Lang Hames [Thu, 15 Oct 2020 00:17:44 +0000 (17:17 -0700)]
[ORC] Add basic ResourceTracker support to the OrcV2 C Bindings.

Based on a patch by Andres Freund. Thanks Andres!

3 years ago[ORC] Rename LLVMOrcJITDylibDefinitionGeneratorRef.
Lang Hames [Wed, 14 Oct 2020 19:13:00 +0000 (12:13 -0700)]
[ORC] Rename LLVMOrcJITDylibDefinitionGeneratorRef.

The DefinitionGenerator class has been moved out of JITDylib. This updates
the C API type and function names to reflect that.

3 years ago[ORC] Fix C API function name.
Lang Hames [Wed, 14 Oct 2020 18:35:37 +0000 (11:35 -0700)]
[ORC] Fix C API function name.

Patch by Andres Freund. Thanks Andres!

3 years ago[ORC] Add C API functions to obtain and clear the symbol string pool.
Lang Hames [Fri, 2 Oct 2020 04:12:19 +0000 (21:12 -0700)]
[ORC] Add C API functions to obtain and clear the symbol string pool.

Symbol string pool entries are ref counted, but not automatically cleared.
This can cause the size of the pool to grow without bound if it's not
periodically cleared. These functions allow that to be done via the C API.

3 years ago[ORC] Add a C API function to set the ExecutionSession error reporter.
Lang Hames [Thu, 1 Oct 2020 18:24:34 +0000 (11:24 -0700)]
[ORC] Add a C API function to set the ExecutionSession error reporter.

3 years ago[ORC] Fix a memory leak in the OrcV2 C API (and some comment typos).
Lang Hames [Thu, 1 Oct 2020 22:25:06 +0000 (15:25 -0700)]
[ORC] Fix a memory leak in the OrcV2 C API (and some comment typos).

The LLVMOrcLLJITAddLLVMIRModule function was leaking its
LLVMOrcThreadSafeModuleRef argument. Wrapping the argument in a unique_ptr
fixes this.

3 years ago[ORC] Update Symbol Lookup / DefinitionGenerator system.
Lang Hames [Wed, 14 Oct 2020 00:24:18 +0000 (17:24 -0700)]
[ORC] Update Symbol Lookup / DefinitionGenerator system.

This patch moves definition generation out from the session lock, instead
running it under a per-dylib generator lock. It also makes the
DefinitionGenerator::tryToGenerate method optionally asynchronous: Generators
are handed an opaque LookupState object which can be captured to stop/restart
the lookup process.

The new scheme provides the following benefits and guarantees:

(1) Queries that do not need to attempt definition generation (because all
    requested symbols matched against existing definitions in the JITDylib)
    can proceed without being blocked by any running definition generators.

(2) Definition generators can capture the LookupState to continue their work
    asynchronously. This allows generators to run for an arbitrary amount of
    time without blocking a thread. Definition generators that do not need to
    run asynchronously can return without capturing the LookupState to eliminate
    unnecessary recursion and improve lookup performance.

(3) Definition generators still do not need to worry about concurrency or
    re-entrance: Since they are still run under a (per-dylib) lock, generators
    will never be re-entered concurrently, or given overlapping symbol sets to
    generate.

Finally, the new system distinguishes between symbols that are candidates for
generation (generation candidates) and symbols that failed to match for a query
(due to symbol visibility). This fixes a bug where an unresolved symbol could
trigger generation of a duplicate definition for an existing hidden symbol.

3 years ago[ORC] Move DefinitionGenerator out of JITDylib.
Lang Hames [Thu, 1 Oct 2020 21:40:08 +0000 (14:40 -0700)]
[ORC] Move DefinitionGenerator out of JITDylib.

This will make it easier to implement asynchronous definition generators.

3 years ago[ORC] Move MaterializationResponsibility methods to ExecutionSession.
Lang Hames [Fri, 2 Oct 2020 22:36:01 +0000 (15:36 -0700)]
[ORC] Move MaterializationResponsibility methods to ExecutionSession.

MaterializationResponsibility, JITDylib, and ExecutionSession collectively
manage the OrcV2 core JIT state. Responsibility for maintaining and
updating this state has previously been spread among these classes, resulting
in implementations that are each non-trivial, but all tightly coupled. This has
in turn made reading the code and reasoning about state update and locking
rules difficult.

The core state model can be simplified by thinking of
MaterializationResponsibility and JITDylib as facets of ExecutionSession. This
commit is the first in a series intended to refactor Core.cpp to reflect this
model. Operations on MaterializationResponsibility and JITDylib will forward to
implementation methods inside ExecutionSession. Raw state will remain with the
original classes, but in most cases will only be modified by the
ExecutionSession.

3 years ago[ARM][SchedModels] Convert IsPredicatedPred to MCSchedPredicate
Evgeny Leviant [Mon, 19 Oct 2020 08:37:54 +0000 (11:37 +0300)]
[ARM][SchedModels] Convert IsPredicatedPred to MCSchedPredicate

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

3 years ago[lldb] Make DW_AT_declaration-with-children.s test more realistic
Pavel Labath [Mon, 19 Oct 2020 08:28:47 +0000 (10:28 +0200)]
[lldb] Make DW_AT_declaration-with-children.s test more realistic

(Re)add DW_AT_specification and DW_AT_object_pointer attributes. These
were removed in fa89f641c, as they were bogus due to bad test case
reduction.

3 years ago[TableGen] Remove test case
Evgeny Leviant [Mon, 19 Oct 2020 08:02:53 +0000 (11:02 +0300)]
[TableGen] Remove test case

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

3 years ago[NFC][SCEV] Rename SCEVCastExpr into SCEVIntegralCastExpr
Roman Lebedev [Mon, 19 Oct 2020 07:57:26 +0000 (10:57 +0300)]
[NFC][SCEV] Rename SCEVCastExpr into SCEVIntegralCastExpr

All existing SCEV cast types operate on integers.
D89456 will add SCEVPtrToIntExpr cast expression type.
I believe this is best for consistency.

Reviewed By: mkazantsev

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

3 years ago[OpenMP][MLIR] Fix for nested parallel regions
Kiran Chandramohan [Sat, 17 Oct 2020 21:24:27 +0000 (22:24 +0100)]
[OpenMP][MLIR] Fix for nested parallel regions

Usage of nested parallel regions were not working correctly and leading
to assertion failures. Fix contains the following changes,
1) Don't set the insertion point in the body callback.
2) Save the continuation IP in a stack and set the branch to
continuationIP at the terminator.

Reviewed By: SouraVX, jdoerfert, ftynse

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

3 years ago[clang-rename] Fix rename on variable templates.
Haojian Wu [Mon, 19 Oct 2020 07:44:29 +0000 (09:44 +0200)]
[clang-rename] Fix rename on variable templates.

This patch adds support for renaming variable templates.

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

3 years ago[SVE][CodeGen] Replace more TypeSize comparison operators with their scalar equivalents
David Sherwood [Tue, 29 Sep 2020 11:08:40 +0000 (12:08 +0100)]
[SVE][CodeGen] Replace more TypeSize comparison operators with their scalar equivalents

In certain places in llvm/lib/CodeGen we were relying upon the TypeSize
comparison operators when in fact the code was only ever expecting
either scalar values or fixed width vectors. This patch changes a few
functions that were always expecting to work on scalar or fixed width
types:

1. DAGCombiner::mergeTruncStores - deals with scalar integers only.
2. DAGCombiner::ReduceLoadWidth - not valid for vectors.
3. DAGCombiner::createBuildVecShuffle - should only be used for
   fixed width vectors.
4. SelectionDAGLegalize::ExpandFCOPYSIGN and
   SelectionDAGLegalize::getSignAsIntValue - only work on scalars.

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

3 years ago[examples] Fix test: Kaleidoscope Chapter 4 no longer supports redefinition.
Lang Hames [Mon, 19 Oct 2020 07:33:31 +0000 (00:33 -0700)]
[examples] Fix test: Kaleidoscope Chapter 4 no longer supports redefinition.

This may be fixed in the future, but since redefinition in OrcV2 requires more
manual work on the JIT client's part it was left out of the most recent update
to the tutorials.

3 years ago[clang-rename] Fix rename on function template specializations.
Haojian Wu [Mon, 19 Oct 2020 07:26:32 +0000 (09:26 +0200)]
[clang-rename] Fix rename on function template specializations.

previously, we missed to rename occurrences to explicit function template
specilizations.

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

3 years ago[SVE][CodeGen][NFC] Replace TypeSize comparison operators with their scalar equivalents
David Sherwood [Tue, 29 Sep 2020 11:08:40 +0000 (12:08 +0100)]
[SVE][CodeGen][NFC] Replace TypeSize comparison operators with their scalar equivalents

In certain places in llvm/lib/CodeGen we were relying upon the TypeSize
comparison operators when in fact the code was only ever expecting
either scalar values or fixed width vectors. I've changed some of these
places to use the equivalent scalar operator.

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

3 years ago[examples] Fix Kaleidoscope-Ch3, which was broken by ad92f16ccc5.
Lang Hames [Mon, 19 Oct 2020 07:25:15 +0000 (00:25 -0700)]
[examples] Fix Kaleidoscope-Ch3, which was broken by ad92f16ccc5.

3 years ago[SVE] Replace TypeSize comparison operators in llvm/utils/TableGen
David Sherwood [Wed, 7 Oct 2020 07:26:17 +0000 (08:26 +0100)]
[SVE] Replace TypeSize comparison operators in llvm/utils/TableGen

In CodeGenDAGPatterns.cpp we were relying upon TypeSize comparison
operators for ordering types, when we can actually just use the known
minimum size since the scalable property is already being taken into
account. Also, in TypeInfer::EnforceSameSize I fixed some implicit
TypeSize->uint64_t casts by changing the code to test the equality
of TypeSize objects instead.

In other places I have replaced calls to getSizeInBits() with
getFixedSizeInBits() because we are only ever expecting integer values.

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

3 years ago[ORC] Move SimpleResourceManager function object inits out of constructor.
Lang Hames [Mon, 19 Oct 2020 07:15:58 +0000 (00:15 -0700)]
[ORC] Move SimpleResourceManager function object inits out of constructor.

MSVC doesn't seem to like capturing references to variables in lambdas passed to
the variable's constructor. This should fix the windows bots that have been
unable to build the new ResourceTracker unit test.

3 years ago[ORC] Add a missing '&'.
Lang Hames [Mon, 19 Oct 2020 06:24:39 +0000 (23:24 -0700)]
[ORC] Add a missing '&'.

3 years ago[SVE][CodeGen] Replace uses of TypeSize comparison operators
David Sherwood [Tue, 29 Sep 2020 07:03:13 +0000 (08:03 +0100)]
[SVE][CodeGen] Replace uses of TypeSize comparison operators

In certain places in the code we can never end up in a situation where
we're mixing fixed width and scalable vector types. For example,
we can't have truncations and extends that change the lane count. Also,
in other places such as GenWidenVectorStores and GenWidenVectorLoads we
know from the behaviour of FindMemType that we can never choose a vector
type with a different scalable property.

In various places I have used EVT::bitsXY functions instead of
TypeSize::isKnownXY, where it probably makes sense to keep an assert
that scalable properties match.

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

3 years ago[SVE][AArch64] Replace TypeSize comparisons with their integer equivalents
David Sherwood [Fri, 9 Oct 2020 11:03:20 +0000 (12:03 +0100)]
[SVE][AArch64] Replace TypeSize comparisons with their integer equivalents

In many places in the AArch64 backend we are comparing TypeSize objects,
but in fact we are only ever expecting fixed width types. I've changed
all such comparisons to use their integer equivalents by replacing
calls to getSizeInBits() with getFixedSizeInBits(), etc.

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

3 years ago[Test] Add one more SCEV range test
Max Kazantsev [Mon, 19 Oct 2020 06:38:20 +0000 (13:38 +0700)]
[Test] Add one more SCEV range test

3 years ago[NFC][SCEV] Use getMinusOne where possible
Max Kazantsev [Mon, 19 Oct 2020 05:55:35 +0000 (12:55 +0700)]
[NFC][SCEV] Use getMinusOne where possible

3 years ago[mlir][gpu] NFC: Make room for more than one GPU rewrite pattern.
Christian Sigg [Wed, 14 Oct 2020 08:31:08 +0000 (10:31 +0200)]
[mlir][gpu] NFC: Make room for more than one GPU rewrite pattern.

AllReduceLowering is currently the only GPU rewrite pattern, but more are coming. This is a preparation change.

Reviewed By: herhut

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

3 years ago[PrologEpilogInserter] Fix prolog-params.mir
Fangrui Song [Mon, 19 Oct 2020 05:36:58 +0000 (22:36 -0700)]
[PrologEpilogInserter] Fix prolog-params.mir

3 years ago[mlir] Allow space literals (` `) in assemblyFormat.
Christian Sigg [Sun, 18 Oct 2020 05:40:42 +0000 (07:40 +0200)]
[mlir] Allow space literals (` `) in assemblyFormat.

Spaces are only printed, not parsed.

Reviewed By: rriddle

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

3 years ago[PowerPC] Skip combining (uint_to_fp x) if x is not simple type
Kai Luo [Mon, 19 Oct 2020 03:41:05 +0000 (03:41 +0000)]
[PowerPC] Skip combining (uint_to_fp x) if x is not simple type

Current powerpc64le backend hits
```
Combining: t7: f64 = uint_to_fp t6
llc: llvm-project/llvm/include/llvm/CodeGen/ValueTypes.h:291: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a SimpleValueType!"' failed.
```
This patch fixes it by skipping combination if `t6` is not simple type.
Fixed https://bugs.llvm.org/show_bug.cgi?id=47660.

Reviewed By: #powerpc, steven.zhang

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

3 years ago[PrologEpilogInserter] Reduce PR16393 test and fix a prologue parameter in a debuginf...
Fangrui Song [Mon, 19 Oct 2020 05:17:22 +0000 (22:17 -0700)]
[PrologEpilogInserter] Reduce PR16393 test and fix a prologue parameter in a debuginfo test

3 years ago[gn build] Port 6154c4115cd
LLVM GN Syncbot [Mon, 19 Oct 2020 04:23:08 +0000 (04:23 +0000)]
[gn build] Port 6154c4115cd

3 years ago[gn build] Port 0aec49c8531
LLVM GN Syncbot [Mon, 19 Oct 2020 04:23:07 +0000 (04:23 +0000)]
[gn build] Port 0aec49c8531

3 years ago[ORC][examples] Update Kaleidoscope and BuildingAJIT tutorial series to OrcV2.
Lang Hames [Wed, 23 Sep 2020 05:37:25 +0000 (22:37 -0700)]
[ORC][examples] Update Kaleidoscope and BuildingAJIT tutorial series to OrcV2.

This patch updates the Kaleidoscope and BuildingAJIT tutorial series (chapter
1-4) to OrcV2. Chapter 5 of the BuildingAJIT series is removed -- it will be
re-instated once we have in-tree support for out-of-process JITing.

This patch only updates the tutorial code, not the text. Patches welcome for
that, otherwise I will try to update it in a few weeks.

3 years ago[ORC] Add support for resource tracking/removal (removable code).
Lang Hames [Fri, 11 Sep 2020 16:50:41 +0000 (09:50 -0700)]
[ORC] Add support for resource tracking/removal (removable code).

This patch introduces new APIs to support resource tracking and removal in Orc.
It is intended as a thread-safe generalization of the removeModule concept from
OrcV1.

Clients can now create ResourceTracker objects (using
JITDylib::createResourceTracker) to track resources for each MaterializationUnit
(code, data, aliases, absolute symbols, etc.) added to the JIT. Every
MaterializationUnit will be associated with a ResourceTracker, and
ResourceTrackers can be re-used for multiple MaterializationUnits. Each JITDylib
has a default ResourceTracker that will be used for MaterializationUnits added
to that JITDylib if no ResourceTracker is explicitly specified.

Two operations can be performed on ResourceTrackers: transferTo and remove. The
transferTo operation transfers tracking of the resources to a different
ResourceTracker object, allowing ResourceTrackers to be merged to reduce
administrative overhead (the source tracker is invalidated in the process). The
remove operation removes all resources associated with a ResourceTracker,
including any symbols defined by MaterializationUnits associated with the
tracker, and also invalidates the tracker. These operations are thread safe, and
should work regardless of the the state of the MaterializationUnits. In the case
of resource transfer any existing resources associated with the source tracker
will be transferred to the destination tracker, and all future resources for
those units will be automatically associated with the destination tracker. In
the case of resource removal all already-allocated resources will be
deallocated, any if any program representations associated with the tracker have
not been compiled yet they will be destroyed. If any program representations are
currently being compiled then they will be prevented from completing: their
MaterializationResponsibility will return errors on any attempt to update the
JIT state.

Clients (usually Layer writers) wishing to track resources can implement the
ResourceManager API to receive notifications when ResourceTrackers are
transferred or removed. The MaterializationResponsibility::withResourceKeyDo
method can be used to create associations between the key for a ResourceTracker
and an allocated resource in a thread-safe way.

RTDyldObjectLinkingLayer and ObjectLinkingLayer are updated to use the
ResourceManager API to enable tracking and removal of memory allocated by the
JIT linker.

The new JITDylib::clear method can be used to trigger removal of every
ResourceTracker associated with the JITDylib (note that this will only
remove resources for the JITDylib, it does not run static destructors).

This patch includes unit tests showing basic usage. A follow-up patch will
update the Kaleidoscope and BuildingAJIT tutorial series to OrcV2 and will
use this API to release code associated with anonymous expressions.

3 years ago[ORC] Remove OrcV1 APIs.
Lang Hames [Tue, 8 Sep 2020 04:21:28 +0000 (21:21 -0700)]
[ORC] Remove OrcV1 APIs.

This removes all legacy layers, legacy utilities, the old Orc C bindings,
OrcMCJITReplacement, and OrcMCJITReplacement regression tests.

ExecutionEngine and MCJIT are not affected by this change.

3 years ago[MLIR] ODS TypeDefs: getChecked() and internal enhancements
John Demme [Mon, 19 Oct 2020 01:07:44 +0000 (01:07 +0000)]
[MLIR] ODS TypeDefs: getChecked() and internal enhancements

Have the ODS TypeDef generator write the getChecked() definition.
Also add to TypeParamCommaFormatter a `JustParams` format and
refactor around that.

Reviewed By: rriddle

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

3 years ago[X86] Sort the tables before printing in X86FoldTablesEmitter.
Craig Topper [Mon, 19 Oct 2020 00:16:14 +0000 (17:16 -0700)]
[X86] Sort the tables before printing in X86FoldTablesEmitter.

This makes diffing with the manual tables easier. And if we ever
directly use the autogenerated tables instead of the manual tables
we'll need them to be in sorted order for the binary search.

3 years ago[MLIR] ODS TypeDef documentation
John Demme [Mon, 19 Oct 2020 00:20:53 +0000 (00:20 +0000)]
[MLIR] ODS TypeDef documentation

Adds documentation for the new ODS TypeDef support.

Reviewed By: rriddle

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

3 years agoPR47893: Synthesis of a comparison operator from an 'operator<=>'
Richard Smith [Sun, 18 Oct 2020 21:15:12 +0000 (14:15 -0700)]
PR47893: Synthesis of a comparison operator from an 'operator<=>'
inherits the SFINAEness of its enclosing context.

3 years agoPR47870: Properly mangle placeholders for deduced class template
Richard Smith [Sun, 18 Oct 2020 20:52:31 +0000 (13:52 -0700)]
PR47870: Properly mangle placeholders for deduced class template
specializations that have no deduced type.

3 years ago[mlir] Add canonicalization for cond_br that feed into a cond_br on the same condition
River Riddle [Sun, 18 Oct 2020 20:43:09 +0000 (13:43 -0700)]
[mlir] Add canonicalization for cond_br that feed into a cond_br on the same condition

```
   ...
   cond_br %cond, ^bb1(...), ^bb2(...)
 ...
 ^bb1: // has single predecessor
   ...
   cond_br %cond, ^bb3(...), ^bb4(...)
```

 ->

```
   ...
   cond_br %cond, ^bb1(...), ^bb2(...)
 ...
 ^bb1: // has single predecessor
   ...
   br ^bb3(...)
```

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

3 years ago[X86] Add test cases for PR47874. NFC
Craig Topper [Sun, 18 Oct 2020 19:45:01 +0000 (12:45 -0700)]
[X86] Add test cases for PR47874. NFC

3 years ago[libc++][dsl] Run checks for locale names aliases using a single %exec
Alex Richardson [Sun, 18 Oct 2020 15:06:00 +0000 (16:06 +0100)]
[libc++][dsl] Run checks for locale names aliases using a single %exec

This changes the checking for available locales to use one program that
iterates over argv to test multiple locale names instead of checking each
name with a separate executable.

This massively speeds up running individual tests using an SSH executor
(it can take up to 10 seconds to compile and run a single test in some
emulated environments) in case no locales are installed since then all
fallback names are tested idividually. But even on a native machine
this reduces the libc++ lit startup time by ~1-2 second for me on a machine
that does not have locale data installed.

Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D88884

3 years ago[clang-format] Add a SpaceAroundPointerQualifiers style option
Alex Richardson [Sun, 18 Oct 2020 15:05:36 +0000 (16:05 +0100)]
[clang-format] Add a SpaceAroundPointerQualifiers style option

Some projects (e.g. FreeBSD) align pointers to the right but expect a
space between the '*' and any pointer qualifiers such as const. To handle
these cases this patch adds a new config option SpaceAroundPointerQualifiers
that can be used to configure whether spaces need to be added before/after
pointer qualifiers.

PointerAlignment = Right
SpaceAroundPointerQualifiers = Default/After:
void *const *x = NULL;
SpaceAroundPointerQualifiers = Before/Both
void * const *x = NULL;

PointerAlignment = Left
SpaceAroundPointerQualifiers = Default/Before:
void* const* x = NULL;
SpaceAroundPointerQualifiers = After/Both
void* const * x = NULL;

PointerAlignment = Middle
SpaceAroundPointerQualifiers = Default/Before/After/Both:
void * const * x = NULL;

Reviewed By: MyDeveloperDay

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

3 years ago[libc++] Fix aligned_alloc tests FreeBSD
Alex Richardson [Sun, 18 Oct 2020 15:05:01 +0000 (16:05 +0100)]
[libc++] Fix aligned_alloc tests FreeBSD

On FreeBSD we get the following error when passing zero as the requested
alignment: error: requested alignment is not a power of 2

Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D88820

3 years ago[NFC] Make non-modifying members const.
Mark de Wever [Sun, 18 Oct 2020 12:11:41 +0000 (14:11 +0200)]
[NFC] Make non-modifying members const.

Implementing the likelihood attributes for the iteration statements adds
a new helper function. This function can't be const qualified since
these non-modifying members aren't const qualified.

3 years ago[PowerPC][AIX] Make `__vector [un]signed long` an error
Hubert Tong [Sun, 18 Oct 2020 14:30:14 +0000 (10:30 -0400)]
[PowerPC][AIX] Make `__vector [un]signed long` an error

The semantics associated with `__vector [un]signed long` are neither
consistently specified nor consistently implemented.

The IBM XL compilers on AIX traditionally treated these as deprecated
aliases for the corresponding `__vector int` type in both 32-bit and
64-bit modes. The newer, Clang-based, IBM XL compilers on AIX make usage
of the previously deprecated types an error. This is also consistent
with IBM XL C/C++ for Linux on Power (on little endian distributions).

In line with the above, this patch upgrades (on AIX) the deprecation of
`__vector long` to become removal.

Reviewed By: ZarkoCA

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