platform/upstream/llvm.git
3 years agoPass the source range when diagnosing an unknown attribute
Aaron Ballman [Fri, 13 Nov 2020 18:27:28 +0000 (10:27 -0800)]
Pass the source range when diagnosing an unknown attribute

This way, the whole attribute gets highlighted with diagnostics instead
of just the scope name in an attribute like [[clang::unknown]].

3 years agoSerialization: Hoist the check for in-flight diagnostics in ASTReader::getInputFile...
Duncan P. N. Exon Smith [Thu, 12 Nov 2020 18:05:07 +0000 (13:05 -0500)]
Serialization: Hoist the check for in-flight diagnostics in ASTReader::getInputFile, NFC

This logic seems easier to follow without the `Error()` helper, and
checking `DiagnosticsEngine::isDiagnosticInFlight` just once up front.

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

3 years ago[AArch64][GlobalISel] Select G_SELECT cc, t, (G_SUB 0, x) -> CSNEG t, x, cc
Jessica Paquette [Tue, 3 Nov 2020 22:59:29 +0000 (14:59 -0800)]
[AArch64][GlobalISel] Select G_SELECT cc, t, (G_SUB 0, x) -> CSNEG t, x, cc

When we see

```
%sub = G_SUB 0, %x
%select = G_SELECT %cc, %t, %sub
```

Fold away the G_SUB by producing

```
%select = CSNEG %t, %x, cc
```

Simple IR example: https://godbolt.org/z/K8TEnh

This is valid on both sides of the select, but for now, just handle one side.
It may make more sense to handle swapping sides during post-legalizer lowering.

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

3 years ago[Local] Emit nsw for inbounds offset calculation
Nikita Popov [Fri, 13 Nov 2020 17:38:26 +0000 (18:38 +0100)]
[Local] Emit nsw for inbounds offset calculation

In line with D90708, we can use nsw for the inbounds offset
calculation -- the muls were already using nsw, but the adds were
not.

3 years ago[AArch64][GlobalISel] NFC: Use CmpInst::isUnsigned instead of static helper
Jessica Paquette [Fri, 13 Nov 2020 17:28:37 +0000 (09:28 -0800)]
[AArch64][GlobalISel] NFC: Use CmpInst::isUnsigned instead of static helper

Reducing some code duplication.

We had a helper for checking if a predicate is unsigned. Remove that and use
the existing function in Instructions.cpp.

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

3 years ago[WebAssembly] Added R_WASM_FUNCTION_OFFSET_I64 for use with DWARF DW_AT_low_pc
Wouter van Oortmerssen [Thu, 12 Nov 2020 23:05:05 +0000 (15:05 -0800)]
[WebAssembly] Added R_WASM_FUNCTION_OFFSET_I64 for use with DWARF DW_AT_low_pc

Needed for wasm64, see discussion in https://reviews.llvm.org/D91203

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

3 years ago[CostModel][X86] Remove unused CHECK prefixes
Simon Pilgrim [Fri, 13 Nov 2020 17:29:54 +0000 (17:29 +0000)]
[CostModel][X86] Remove unused CHECK prefixes

Allows us to remove the "CHECK: {{^}}" hack and help simplify D91275

3 years ago[Local] Clean up EmitGEPOffset
Nikita Popov [Wed, 4 Nov 2020 21:13:40 +0000 (22:13 +0100)]
[Local] Clean up EmitGEPOffset

Handle the emission of the add in a single place, instead of three
different ones.

Don't emit an unnecessary add with zero to start with. It will get
dropped by InstCombine, but we may as well not create it in the
first place. This also means that InstCombine does not need to
specially handle this extra add.

This is conceptually NFC, but can affect worklist order etc.

3 years ago[lldb] Fix SymbolFile/PDB/udt-layout.test
Jonas Devlieghere [Fri, 13 Nov 2020 17:29:51 +0000 (09:29 -0800)]
[lldb] Fix SymbolFile/PDB/udt-layout.test

Update the test for 406ad187486b4277fc82a2c0714ae53396e47928

3 years ago[CGProfile] allows bitcast in metadata node storing function pointers
Yuanfang Chen [Fri, 13 Nov 2020 17:27:10 +0000 (09:27 -0800)]
[CGProfile] allows bitcast in metadata node storing function pointers

For example,  during RAUW in IRMover, the `Function` ValueAsMetadata in "CG Profile" could become bitcast.

Reviewed By: tejohnson

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

3 years ago[GlobalISel] Add matchers for specific constants and a matcher for negations
Jessica Paquette [Fri, 13 Nov 2020 00:42:32 +0000 (16:42 -0800)]
[GlobalISel] Add matchers for specific constants and a matcher for negations

It's fairly common to need matchers for a specific constant value, or for
common idioms like finding a negated register.

Add

- `m_SpecificICst`, which returns true when matching a specific value..
- `m_ZeroInt`, which returns true when an integer 0 is matched.
- `m_Neg`, which returns when a register is negated.

Also update a few places which use idioms related to the new matchers.

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

3 years ago[clangd] Canonicalize LLVM_ENABLE_ZLIB
Kadir Cetinkaya [Fri, 13 Nov 2020 17:19:52 +0000 (18:19 +0100)]
[clangd] Canonicalize LLVM_ENABLE_ZLIB

It is used in our lit test's configuration now.

3 years ago[SCEV] Fix nsw flags for GEP expressions
Nikita Popov [Mon, 2 Nov 2020 20:40:08 +0000 (21:40 +0100)]
[SCEV] Fix nsw flags for GEP expressions

The SCEV code for constructing GEP expressions currently assumes
that the addition of the base and all the offsets is nsw if the GEP
is inbounds. While the addition of the offsets is indeed nsw, the
addition to the base address is not, as the base address is
interpreted as an unsigned value.

Fix the GEP expression code to not assume nsw for the base+offset
calculation. However, do assume nuw if we know that the offset is
non-negative. With this, we use the same behavior as the
construction of GEP addrecs does. (Modulo the fact that we
disregard SCEV unification, as the pre-existing FIXME points out).

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

3 years ago[gn build] Port 8741a76f
Arthur Eubanks [Fri, 13 Nov 2020 17:17:52 +0000 (09:17 -0800)]
[gn build] Port 8741a76f

3 years ago[ValueTracking] Don't set nsw flag for inbounds addition
Nikita Popov [Mon, 2 Nov 2020 18:08:37 +0000 (19:08 +0100)]
[ValueTracking] Don't set nsw flag for inbounds addition

When computing the known bits for a GEP, don't set the nsw flag
when adding an offset to an address. The nsw flag only applies to
pure offset additions (see also D90708).

The nsw flag is only used in a very minor way by the code, to the
point that I was not able to come up with a test case where it
makes a difference.

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

3 years ago[libc++] Install GDB in the Docker images
Louis Dionne [Fri, 13 Nov 2020 16:41:11 +0000 (11:41 -0500)]
[libc++] Install GDB in the Docker images

This will allow running the GDB pretty printer tests.

3 years ago[LangRef] Clarify GEP inbounds wrapping semantics
Nikita Popov [Tue, 3 Nov 2020 19:39:50 +0000 (20:39 +0100)]
[LangRef] Clarify GEP inbounds wrapping semantics

Clarify the semantics of GEP inbounds, in particular with regard
to what it means for wrapping. This cleans up some confusion on
when it is legal to apply nuw/nsw flags to various parts of the
GEP calculation.

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

3 years ago[KnownBits] Merge the minimum shift amount and leading/trailing shift value bits...
Simon Pilgrim [Fri, 13 Nov 2020 16:25:44 +0000 (16:25 +0000)]
[KnownBits] Merge the minimum shift amount and leading/trailing shift value bits handling.

By starting with the source shift value minimum leading/trailing bits, we can then add the minimum known shift amount to more accurately predict the minimum leading/trailing bits of the result.

This is currently only covered by the exhaustive unit tests in KnownBitsTests.cpp, but will help with some of the regressions encountered in D90479 (PR44526).

3 years agoclang: Don't assert on no_unique_address fields in @encode()
Nico Weber [Mon, 2 Nov 2020 17:00:24 +0000 (12:00 -0500)]
clang: Don't assert on no_unique_address fields in @encode()

Just skip (non-bitfield) zero-sized fields, like we do with empty bases.

The class->struct conversion in the test is because -std=c++20 else deletes some default methods
due to non-accessible base dtors otherwise.

As a side-effect of writing the test, I discovered that D76801 did an ABI breaking change of sorts
for Objective-C's @encode. But it's been in for a while, so I'm not sure if we want to row back on
that or now.

Fixes PR48048.

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

3 years ago[MLIR] Allow setting "CodeView" flag in LLVMIR translation on MSVC.
Scott Todd [Fri, 13 Nov 2020 16:30:36 +0000 (17:30 +0100)]
[MLIR] Allow setting "CodeView" flag in LLVMIR translation on MSVC.

Reviewed By: ftynse, mehdi_amini

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

3 years agoAMDGPU/GlobalISel: Regenerate some checks
Matt Arsenault [Wed, 11 Nov 2020 17:11:17 +0000 (12:11 -0500)]
AMDGPU/GlobalISel: Regenerate some checks

Fixes indentation confusing diff in future patch.

3 years agoAMDGPU: Factor out large flat offset splitting
Matt Arsenault [Thu, 12 Nov 2020 15:59:15 +0000 (10:59 -0500)]
AMDGPU: Factor out large flat offset splitting

3 years ago[gn build] (semi-manually) Port 6a8099e0f61
Nico Weber [Fri, 13 Nov 2020 16:20:23 +0000 (11:20 -0500)]
[gn build] (semi-manually) Port 6a8099e0f61

3 years agoGlobalISel: Directly expose getDefSrcRegIgnoringCopies utility
Matt Arsenault [Wed, 11 Nov 2020 15:24:23 +0000 (10:24 -0500)]
GlobalISel: Directly expose getDefSrcRegIgnoringCopies utility

It's useful to get both the instruction and register at the same time.

3 years ago[clangd] Ensure we test for compatibility of serialized index format
Kadir Cetinkaya [Wed, 11 Nov 2020 10:08:14 +0000 (11:08 +0100)]
[clangd] Ensure we test for compatibility of serialized index format

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

3 years ago[clangd] Assert on varint encoding
Kadir Cetinkaya [Fri, 13 Nov 2020 09:13:42 +0000 (10:13 +0100)]
[clangd] Assert on varint encoding

5th byte of a varint can't be bigger than 0x0f, fix a test and add an
assertion.

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

3 years ago[WebAssembly] Add new relocation type for TLS data symbols
Sam Clegg [Wed, 11 Nov 2020 01:46:52 +0000 (17:46 -0800)]
[WebAssembly] Add new relocation type for TLS data symbols

These relocations represent offsets from the __tls_base symbol.

Previously we were just using normal MEMORY_ADDR relocations and relying
on the linker to select a segment-offset rather and absolute value in
Symbol::getVirtualAddress().  Using an explicit relocation type allows
allow us to clearly distinguish absolute from relative relocations based
on the relocation information alone.

One place this is useful is being able to reject absolute relocation in
the PIC case, but still accept TLS relocations.

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

3 years agoAMDGPU: Refactor getBaseWithOffsetUsingSplitOR usage
Matt Arsenault [Wed, 11 Nov 2020 17:56:22 +0000 (12:56 -0500)]
AMDGPU: Refactor getBaseWithOffsetUsingSplitOR usage

3 years ago[NFC][IntrRefLDV] Remove dead code from transferSpillOrRestoreInst()
Djordje Todorovic [Thu, 5 Nov 2020 15:17:40 +0000 (07:17 -0800)]
[NFC][IntrRefLDV] Remove dead code from transferSpillOrRestoreInst()

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

3 years agoRevert "[NFC] Move code between functions as a preparation step for further improvement"
David Zarzycki [Fri, 13 Nov 2020 15:50:44 +0000 (10:50 -0500)]
Revert "[NFC] Move code between functions as a preparation step for further improvement"

This reverts commit 08016ac32b746b27be43d92255bf22a12012e244.

A bunch of tests are failing my local two stage builder.

3 years ago[lld][WebAssembly] Add test for TLS BSS data. NFC.
Sam Clegg [Wed, 11 Nov 2020 04:52:01 +0000 (20:52 -0800)]
[lld][WebAssembly] Add test for TLS BSS data. NFC.

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

3 years ago[libc++] Only check for GCC's empty string storage on macOS and iOS
Louis Dionne [Thu, 12 Nov 2020 16:02:14 +0000 (11:02 -0500)]
[libc++] Only check for GCC's empty string storage on macOS and iOS

We don't need to do that on other Apple platforms, since they never
shipped libstdc++. I also added a comment extracted from the original
commit by Howard Hinnant (e115af2777f6).

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

3 years ago[libc++] Port the time functions to z/OS
Zbigniew Sarbinowski [Thu, 12 Nov 2020 18:38:52 +0000 (13:38 -0500)]
[libc++] Port the time functions to z/OS

This patch adds a shim for missing time functions on z/OS, and adds a
layer of indirection to account for differences in the timespec struct
on different systems.

This was originally committed as 173b51169b83 and reverted in 777ca48c9f08
because the original commit also checked-in unrelated changes.

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

3 years ago[OpenMP][Tool] Update archer to accept new OpenMP 5.1 enum values
Joachim Protze [Wed, 4 Nov 2020 12:25:15 +0000 (13:25 +0100)]
[OpenMP][Tool] Update archer to accept new OpenMP 5.1 enum values

OpenMP 5.1 adds an extra enum entry for ompt_scope_t, which makes the related
switch statement incomplete.
Also adding cases for newly added barrier variants.

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

3 years ago[gn build] more hotfix after 17df195f70 to unbreak llvm-config tests
Nico Weber [Fri, 13 Nov 2020 15:02:54 +0000 (10:02 -0500)]
[gn build] more hotfix after 17df195f70 to unbreak llvm-config tests

3 years ago[TableGen] Enhance the six comparison bang operators.
Paul C. Anagnostopoulos [Sun, 8 Nov 2020 16:52:30 +0000 (11:52 -0500)]
[TableGen] Enhance the six comparison bang operators.

Update the Programmer's Reference.

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

3 years agollvmbuildectomy - remove conflict file
serge-sans-paille [Fri, 13 Nov 2020 14:55:27 +0000 (15:55 +0100)]
llvmbuildectomy - remove conflict file

3 years ago[gn build] Port 8bb6347939b
Nico Weber [Fri, 13 Nov 2020 14:55:08 +0000 (09:55 -0500)]
[gn build] Port 8bb6347939b

3 years agollvmbuildectomy - support disabled native target
serge-sans-paille [Fri, 13 Nov 2020 14:49:27 +0000 (15:49 +0100)]
llvmbuildectomy - support disabled native target

3 years ago[gn build] (manually) merge 1d0676b54c4e3
Nico Weber [Fri, 13 Nov 2020 14:39:28 +0000 (09:39 -0500)]
[gn build] (manually) merge 1d0676b54c4e3

3 years ago[gn build] Hotfix to unbreak build after 9218ff50f9308
Nico Weber [Fri, 13 Nov 2020 14:26:43 +0000 (09:26 -0500)]
[gn build] Hotfix to unbreak build after 9218ff50f9308

3 years ago[DivergenceAnalysis] Use addRequiredTransitive
Piotr Sobczak [Tue, 10 Nov 2020 16:17:24 +0000 (17:17 +0100)]
[DivergenceAnalysis] Use addRequiredTransitive

For querying divergence the chained analysis passes are required
to be alive, for instance LoopInfoWrapperPass.

Ensure that by using addRequiredTransitive.

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

3 years agollvmbuildectomy - compatibility with ocaml bindings
serge-sans-paille [Fri, 13 Nov 2020 13:04:19 +0000 (14:04 +0100)]
llvmbuildectomy - compatibility with ocaml bindings

Use exact component name in add_ocaml_library.
Make expand_topologically compatible with new architecture.
Fix quoting in is_llvm_target_library.
Fix LLVMipo component name.
Write release note.

3 years agoAdd !annotation metadata and remarks pass.
Florian Hahn [Fri, 13 Nov 2020 09:46:55 +0000 (09:46 +0000)]
Add !annotation metadata and remarks pass.

This patch adds a new !annotation metadata kind which can be used to
attach annotation strings to instructions.

It also adds a new pass that emits summary remarks per function with the
counts for each annotation kind.

The intended uses cases for this new metadata is annotating
'interesting' instructions and the remarks should provide additional
insight into transformations applied to a program.

To motivate this, consider these specific questions we would like to get answered:

* How many stores added for automatic variable initialization remain after optimizations? Where are they?
* How many runtime checks inserted by a frontend could be eliminated? Where are the ones that did not get eliminated?

Discussed on llvm-dev as part of 'RFC: Combining Annotation Metadata and Remarks'
(http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html)

Reviewed By: thegameg, jdoerfert

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

3 years ago[clang] Fix an assertion crash in delayed access check.
Haojian Wu [Fri, 13 Nov 2020 13:00:57 +0000 (14:00 +0100)]
[clang] Fix an assertion crash in delayed access check.

`TD->getTemplatedDecl()` might not be a DeclContext variant, which can
trigger an assertion inside `isa<>`.

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

3 years agoRevert "[AsmPrinter] fix -disable-debug-info option"
Hans Wennborg [Fri, 13 Nov 2020 12:46:13 +0000 (13:46 +0100)]
Revert "[AsmPrinter] fix -disable-debug-info option"

The test fails on Mac, see comment on the code review.

> This option was in a rather convoluted place, causing global parameters
> to be set in awkward and undesirable ways to try to account for it
> indirectly. Add tests for the -disable-debug-info option and ensure we
> don't print unintended markers from unintended places.
>
> Reviewed By: dstenb
>
> Differential Revision: https://reviews.llvm.org/D91083

This reverts commit 9606ef03f03904cec213db031b5ea6fd6052dc5d.

3 years agoReland [clang][cli] Port ObjCMTAction to new option parsing system
Jan Svoboda [Wed, 11 Nov 2020 10:05:24 +0000 (11:05 +0100)]
Reland [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

Original patch by Daniel Grumberg.

Reviewed By: Bigcheese

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

3 years ago[mlir] Transform scf.parallel to scf.for + async.execute
Eugene Zhulenev [Fri, 13 Nov 2020 11:01:52 +0000 (03:01 -0800)]
[mlir] Transform scf.parallel to scf.for + async.execute

Depends On D89958

1. Adds `async.group`/`async.awaitall` to group together multiple async tokens/values
2. Rewrite scf.parallel operation into multiple concurrent async.execute operations over non overlapping subranges of the original loop.

Example:

```
   scf.for (%i, %j) = (%lbi, %lbj) to (%ubi, %ubj) step (%si, %sj) {
     "do_some_compute"(%i, %j): () -> ()
   }
```

Converted to:

```
   %c0 = constant 0 : index
   %c1 = constant 1 : index

   // Compute blocks sizes for each induction variable.
   %num_blocks_i = ... : index
   %num_blocks_j = ... : index
   %block_size_i = ... : index
   %block_size_j = ... : index

   // Create an async group to track async execute ops.
   %group = async.create_group

   scf.for %bi = %c0 to %num_blocks_i step %c1 {
     %block_start_i = ... : index
     %block_end_i   = ... : index

     scf.for %bj = %c0 t0 %num_blocks_j step %c1 {
       %block_start_j = ... : index
       %block_end_j   = ... : index

       // Execute the body of original parallel operation for the current
       // block.
       %token = async.execute {
         scf.for %i = %block_start_i to %block_end_i step %si {
           scf.for %j = %block_start_j to %block_end_j step %sj {
             "do_some_compute"(%i, %j): () -> ()
           }
         }
       }

       // Add produced async token to the group.
       async.add_to_group %token, %group
     }
   }

   // Await completion of all async.execute operations.
   async.await_all %group
```
In this example outer loop launches inner block level loops as separate async
execute operations which will be executed concurrently.

At the end it waits for the completiom of all async execute operations.

Reviewed By: ftynse, mehdi_amini

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

3 years ago[MC][mips] Remove unused check prefixes. NFC
Simon Atanasyan [Thu, 12 Nov 2020 21:24:11 +0000 (00:24 +0300)]
[MC][mips] Remove unused check prefixes. NFC

3 years ago[mips] Add tests to check disassembling of add.ps/mul.ps/sub.ps instructions
Simon Atanasyan [Thu, 5 Nov 2020 13:30:45 +0000 (16:30 +0300)]
[mips] Add tests to check disassembling of add.ps/mul.ps/sub.ps instructions

3 years ago[clangd] Add missing tests to rename feature
Kirill Bobyrev [Fri, 13 Nov 2020 11:27:36 +0000 (12:27 +0100)]
[clangd] Add missing tests to rename feature

This adds a couple of missed tests from existing clang-rename ones and
introduces several new ones (e.g. static class member). This patch is required
to ensure feature parity for migration off Clang-Rename API D71880.

Reviewed By: hokein

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

3 years ago[UpdateTestChecks] Fix $ in function test for ARM.
Yvan Roux [Fri, 13 Nov 2020 11:20:56 +0000 (12:20 +0100)]
[UpdateTestChecks] Fix $ in function test for ARM.

Removes AArch64 target checking inside 32bit ARM test to bring back
buildbots to a green state.  But $ are not well handled for ARM and it
still need to be fixed.

3 years ago[SVE][CodeGen] Improve codegen of scalable masked scatters
Kerry McLaughlin [Fri, 13 Nov 2020 10:51:17 +0000 (10:51 +0000)]
[SVE][CodeGen] Improve codegen of scalable masked scatters

If the scatter store is able to perform the sign/zero extend of
its index, this is folded into the instruction with refineIndexType().
Additionally, refineUniformBase() will return the base pointer and index
from an add + splat_vector.

Reviewed By: sdesmalen

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

3 years ago[NFC] Move code between functions as a preparation step for further improvement
Max Kazantsev [Fri, 13 Nov 2020 10:45:42 +0000 (17:45 +0700)]
[NFC] Move code between functions as a preparation step for further improvement

3 years ago[ValueTracking] computeKnownBitsFromShiftOperator use KnownBits direct for constant...
Simon Pilgrim [Fri, 13 Nov 2020 10:47:56 +0000 (10:47 +0000)]
[ValueTracking] computeKnownBitsFromShiftOperator use KnownBits direct for constant shift amounts.

Let KnownBits shift handlers deal with out-of-range shift amounts.

3 years ago[NFC] Refactor lambda into static function
Max Kazantsev [Fri, 13 Nov 2020 10:18:16 +0000 (17:18 +0700)]
[NFC] Refactor lambda into static function

3 years ago[lldb][NFC] Fix flaky TestForwardDeclFromStdModule test
Raphael Isemann [Fri, 13 Nov 2020 10:39:21 +0000 (11:39 +0100)]
[lldb][NFC] Fix flaky TestForwardDeclFromStdModule test

"[lldb/DataFormatters] Display null C++ pointers as nullptr" added an assumption
that the member we check for is always a nullptr, but it is actually never
initialized. That causes the test to randomly fail due to the pointer having
some random value that isn't 0.

3 years agoFix MSVC signed/unsigned comparison warning. NFCI.
Simon Pilgrim [Fri, 13 Nov 2020 10:20:28 +0000 (10:20 +0000)]
Fix MSVC signed/unsigned comparison warning. NFCI.

3 years ago[VE] Add vst intrinsic instructions
Kazushi (Jam) Marukawa [Fri, 13 Nov 2020 09:27:05 +0000 (18:27 +0900)]
[VE] Add vst intrinsic instructions

Add vst intrinsic instructions and a regression test.

Reviewed By: simoll

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

3 years ago[NFC] Move lambdae into static functions
Max Kazantsev [Fri, 13 Nov 2020 10:00:49 +0000 (17:00 +0700)]
[NFC] Move lambdae into static functions

3 years ago[docs] Fix undefined reference in ORCv2 design doc.
Florian Hahn [Fri, 13 Nov 2020 09:42:36 +0000 (09:42 +0000)]
[docs] Fix undefined reference in ORCv2 design doc.

This fixes a typo introduced in 984e87923f1096c815cef900cda0926c68286ddf
which caused the docs build to fail.

3 years ago[AMDGPU] One more use of the new export target names. NFC.
Jay Foad [Fri, 13 Nov 2020 09:41:37 +0000 (09:41 +0000)]
[AMDGPU] One more use of the new export target names. NFC.

3 years agollvmbuildectomy - replace llvm-build by plain cmake
serge-sans-paille [Fri, 9 Oct 2020 16:41:21 +0000 (18:41 +0200)]
llvmbuildectomy - replace llvm-build by plain cmake

No longer rely on an external tool to build the llvm component layout.

Instead, leverage the existing `add_llvm_componentlibrary` cmake function and
introduce `add_llvm_component_group` to accurately describe component behavior.

These function store extra properties in the created targets. These properties
are processed once all components are defined to resolve library dependencies
and produce the header expected by llvm-config.

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

3 years ago[nfc] Fix missing include
serge-sans-paille [Tue, 10 Nov 2020 13:55:25 +0000 (14:55 +0100)]
[nfc] Fix missing include

3 years ago[ORC][examples] Fix missing includes/dependencies in more examples.
Lang Hames [Fri, 13 Nov 2020 09:22:01 +0000 (20:22 +1100)]
[ORC][examples] Fix missing includes/dependencies in more examples.

3 years ago[ORC] Make a narrowing conversion explicit.
Lang Hames [Fri, 13 Nov 2020 09:09:38 +0000 (20:09 +1100)]
[ORC] Make a narrowing conversion explicit.

3 years ago[Test] One more IndVars test with inverted exit condition
Max Kazantsev [Fri, 13 Nov 2020 09:02:31 +0000 (16:02 +0700)]
[Test] One more IndVars test with inverted exit condition

3 years ago[IndVars] Fix branches exiting by true with invariant conditions
Max Kazantsev [Fri, 13 Nov 2020 08:42:02 +0000 (15:42 +0700)]
[IndVars] Fix branches exiting by true with invariant conditions

Forgot to invert the condition for them.

3 years ago[Test] Add test with inverted branch
Max Kazantsev [Fri, 13 Nov 2020 08:21:52 +0000 (15:21 +0700)]
[Test] Add test with inverted branch

3 years ago[mlir][bufferize] Fix buffer promotion to stack for index types
Stephan Herhut [Thu, 12 Nov 2020 16:09:57 +0000 (17:09 +0100)]
[mlir][bufferize] Fix buffer promotion to stack for index types

The index type does not have a bitsize and hence the size of corresponding allocations cannot be computed.  Instead, the promotion pass now has an explicit option to specify the size of index.

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

3 years ago[mlir][gpu] Only transform mapped parallel loops to GPU.
Stephan Herhut [Thu, 12 Nov 2020 17:36:14 +0000 (18:36 +0100)]
[mlir][gpu] Only transform mapped parallel loops to GPU.

This exposes a hook to configure legality of operations such that only
`scf.parallel` operations that have mapping attributes are marked as
illegal. Consequently, the transformation can now also be applied to
mixed forms.

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

3 years ago[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.
Lang Hames [Fri, 13 Nov 2020 08:02:52 +0000 (19:02 +1100)]
[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.

Fix the Kaleidoscope examples after 1d0676b54c4 by explicitly creating the
SymbolStringPool.

3 years ago[PowerPC] Add test case for negated abs. NFC.
Kai Luo [Fri, 13 Nov 2020 08:05:08 +0000 (08:05 +0000)]
[PowerPC] Add test case for negated abs. NFC.

3 years ago[NFC] Refactor loop-invariant getters to return Optional
Max Kazantsev [Fri, 13 Nov 2020 07:39:19 +0000 (14:39 +0700)]
[NFC] Refactor loop-invariant getters to return Optional

3 years ago[mlir][Pass] Remove the verifierPass now that verification is run during normal pass...
River Riddle [Fri, 13 Nov 2020 07:45:07 +0000 (23:45 -0800)]
[mlir][Pass] Remove the verifierPass now that verification is run during normal pass execution

A recent refactoring removed the need to interleave verifier passes and instead opted to verify during the normal execution of passes instead. As such, the old verify pass is no longer necessary and can be removed.

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

3 years ago[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.
Lang Hames [Fri, 13 Nov 2020 07:40:40 +0000 (18:40 +1100)]
[examples] Fix Kaleidoscope examples after OrcJIT break-up / remote TPC commit.

Fix the Kaleidoscope examples after 1d0676b54c4 by explicitly creating the
SymbolStringPool.

3 years ago[mlir][Asm] Add support for resolving operation locations after parsing has finished
River Riddle [Fri, 13 Nov 2020 07:33:43 +0000 (23:33 -0800)]
[mlir][Asm] Add support for resolving operation locations after parsing has finished

This revision adds support in the parser/printer for "deferrable" aliases, i.e. those that can be resolved after printing has finished. This allows for printing aliases for operation locations after the module instead of before, i.e. this is now supported:

```
"foo.op"() : () -> () loc(#loc)

#loc = loc("some_location")
```

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

3 years agodebugserver should advance pc past builtin_debugtrap insn
Jason Molenda [Fri, 13 Nov 2020 07:28:24 +0000 (23:28 -0800)]
debugserver should advance pc past builtin_debugtrap insn

On x86_64, when you hit a __builtin_debugtrap instruction, you
can continue past this in the debugger.  This patch has debugserver
recognize the specific instruction used for __builtin_debugtrap
and advance the pc past it, so that the user can continue execution
once they've hit one of these.

In the patch discussion, we were in agreement that it would be better
to have this knowledge up in lldb instead of depending on each
stub rewriting the pc behind the debugger's back, but that's a
larger scale change for another day.

<rdar://problem/65521634>
Differential revision: https://reviews.llvm.org/D91238

3 years ago[ORC][examples] Fix include and library dependence for SpeculativeJIT example.
Lang Hames [Fri, 13 Nov 2020 07:11:14 +0000 (18:11 +1100)]
[ORC][examples] Fix include and library dependence for SpeculativeJIT example.

3 years ago[Driver] Add option -fproc-stat-report
Serge Pavlov [Fri, 24 Apr 2020 10:53:05 +0000 (17:53 +0700)]
[Driver] Add option -fproc-stat-report

The new option `-fproc-stat-info=<file>` can be used to generate report
about used memory and execution tile of each stage of compilation.
Documentation for this option can be found in `UserManual.rst`. The
option can be used in parallel builds.

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

3 years ago[ORC] Add dependence of OrcJIT on OrcTargetProcess.
Lang Hames [Fri, 13 Nov 2020 06:48:27 +0000 (17:48 +1100)]
[ORC] Add dependence of OrcJIT on OrcTargetProcess.

The SelfTargetProcessControl class depends on OrcTargetProcess.

3 years ago[mlir] Remove C++17 only use of inline on constexpr variable
River Riddle [Fri, 13 Nov 2020 07:02:25 +0000 (23:02 -0800)]
[mlir] Remove C++17 only use of inline on constexpr variable

3 years ago[mlir][Interfaces] Add implicit casts from concrete operation types to the interfaces...
River Riddle [Fri, 13 Nov 2020 06:55:28 +0000 (22:55 -0800)]
[mlir][Interfaces] Add implicit casts from concrete operation types to the interfaces they implement.

This removes the need to have an explicit `cast<>` given that we always know it `isa` instance of the interface.

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

3 years ago[mlir][DenseElementsAttr] Allow for custom floating point types in `getValues`
River Riddle [Fri, 13 Nov 2020 06:43:06 +0000 (22:43 -0800)]
[mlir][DenseElementsAttr] Allow for custom floating point types in `getValues`

Some users have native c++ data types that correspond to floating point values stored within a DenseElementsAttr that do not have a corresponding native C++ data type(e.g. bfloat16/half/etc). This revision allows for such users to use those native types directly, and removes the need to go through APFloat when the much faster native value path is available.

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

3 years ago[NFC] Removed unused variable
Arthur Eubanks [Fri, 13 Nov 2020 06:20:39 +0000 (22:20 -0800)]
[NFC] Removed unused variable

Obsolete as of https://reviews.llvm.org/D91046.

3 years ago[ObjC][ARC] Clear the lists of basic blocks and instructions before
Akira Hatanaka [Fri, 13 Nov 2020 02:33:29 +0000 (18:33 -0800)]
[ObjC][ARC] Clear the lists of basic blocks and instructions before
continuing the loop

This fixes a bug introduced in c6f1713c46e61bbb8ece9ac5ac329d02e7f93228.

3 years ago[ORC] Make WrapperFunctionResult::zeroInit static
Lang Hames [Fri, 13 Nov 2020 06:15:13 +0000 (17:15 +1100)]
[ORC] Make WrapperFunctionResult::zeroInit static

3 years ago[ORC] Remove designated initializer.
Lang Hames [Fri, 13 Nov 2020 06:12:33 +0000 (17:12 +1100)]
[ORC] Remove designated initializer.

3 years ago[ORC] Break up OrcJIT library, add Orc-RPC based remote TargetProcessControl
Lang Hames [Wed, 11 Nov 2020 00:55:24 +0000 (11:55 +1100)]
[ORC] Break up OrcJIT library, add Orc-RPC based remote TargetProcessControl
implementation.

This patch aims to improve support for out-of-process JITing using OrcV2. It
introduces two new class templates, OrcRPCTargetProcessControlBase and
OrcRPCTPCServer, which together implement the TargetProcessControl API by
forwarding operations to an execution process via an Orc-RPC Endpoint. These
utilities are used to implement out-of-process JITing from llvm-jitlink to
a new llvm-jitlink-executor tool.

This patch also breaks the OrcJIT library into three parts:
  -- OrcTargetProcess: Contains code needed by the JIT execution process.
  -- OrcShared: Contains code needed by the JIT execution and compiler
     processes
  -- OrcJIT: Everything else.

This break-up allows JIT executor processes to link against OrcTargetProcess
and OrcShared only, without having to link in all of OrcJIT. Clients executing
JIT'd code in-process should start linking against OrcTargetProcess as well as
OrcJIT.

In the near future these changes will enable:
  -- Removal of the OrcRemoteTargetClient/OrcRemoteTargetServer class templates
     which provided similar functionality in OrcV1.
  -- Restoration of Chapter 5 of the Building-A-JIT tutorial series, which will
     serve as a simple usage example for these APIs.
  -- Implementation of lazy, cross-target compilation in lli's -jit-kind=orc-lazy
     mode.

3 years ago[AsmPrinter] fix -disable-debug-info option
Jameson Nash [Fri, 13 Nov 2020 04:49:43 +0000 (23:49 -0500)]
[AsmPrinter] fix -disable-debug-info option

This option was in a rather convoluted place, causing global parameters
to be set in awkward and undesirable ways to try to account for it
indirectly. Add tests for the -disable-debug-info option and ensure we
don't print unintended markers from unintended places.

Reviewed By: dstenb

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

3 years ago[X86] Use EVT::getIntegerVT instead of MVT::getIntegerVT where the type can be i2...
Craig Topper [Fri, 13 Nov 2020 05:46:34 +0000 (21:46 -0800)]
[X86] Use EVT::getIntegerVT instead of MVT::getIntegerVT where the type can be i2 or i4.

This was a mistake introduced in D91294. I'm not sure how to
exercise this with the existing code, but I hit it while trying
some follow up experiments.

3 years ago[X86] When storing v1i1/v2i1/v4i1 to memory, make sure we store zeros in the rest...
Craig Topper [Fri, 13 Nov 2020 04:18:50 +0000 (20:18 -0800)]
[X86] When storing v1i1/v2i1/v4i1 to memory, make sure we store zeros in the rest of the byte

We can't store garbage in the unused bits. It possible that something like zextload from i1/i2/i4 is created to read the memory. Those zextloads would be legalized assuming the extra bits are 0.

I'm not sure that the code in lowerStore is executed for the v1i1/v2i1/v4i1 case. It looks like the DAG combine in combineStore may have converted them to v8i1 first. And I think we're missing some cases to avoid going to the stack in the first place. But I don't have time to investigate those things at the moment so I wanted to focus on the correctness issue.

Should fix PR48147.

Reviewed By: RKSimon

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

3 years ago[IndVars] Replace checks with invariants if we cannot remove them
Max Kazantsev [Fri, 13 Nov 2020 05:05:14 +0000 (12:05 +0700)]
[IndVars] Replace checks with invariants if we cannot remove them

If we cannot prove that the check is trivially true, but can prove that it either
fails on the 1st iteration or never fails, we can replace it with first iteration check.

Differential Revision: https://reviews.llvm.org/D88527
Reviewed By: skatkov

3 years agoSuppress trailing template arguments equivalent to default arguments
Richard Smith [Fri, 13 Nov 2020 04:55:21 +0000 (20:55 -0800)]
Suppress trailing template arguments equivalent to default arguments
when printing the name of a member of a class template specialization.

3 years agoFix MLIR lit test configuration after cmake Python detection change
Mehdi Amini [Fri, 13 Nov 2020 04:43:06 +0000 (04:43 +0000)]
Fix MLIR lit test configuration after cmake Python detection change

07f1047f41d changed the CMake detection to use find_package(Python3 ...
but didn't update the lit configuration to use the expected Python3_EXECUTABLE
cmake variable to point to the interpreter path.
This resulted in an empty path on MacOS.

3 years ago[Tests][LoopVect] Exercise basic uniform memory operand logic
Philip Reames [Fri, 13 Nov 2020 03:08:45 +0000 (19:08 -0800)]
[Tests][LoopVect] Exercise basic uniform memory operand logic

3 years ago[OpenMP] Fixed a bug when displaying affinity
Shilei Tian [Fri, 13 Nov 2020 03:27:22 +0000 (22:27 -0500)]
[OpenMP] Fixed a bug when displaying affinity

Currently the affinity format string has initial value. When users set
the format via OMP_AFFINITY_FORMAT, it will overwrite the format string. However,
when copying the format, the tailing null is missing. As a result, if the user
format string is shorter than default value, the remaining part in the default
value still makes effort. This bug is not exposed because the test case doesn't
check the end of a string. It only checks whether given output "contains" the
check string.

Reviewed By: AndreyChurbanov

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

3 years ago[hip] Remove the coercion on aggregate kernel arguments.
Michael Liao [Tue, 10 Nov 2020 14:34:14 +0000 (09:34 -0500)]
[hip] Remove the coercion on aggregate kernel arguments.

- If an aggregate argument is indirectly accessed within kernels, direct
  passing results in unpromotable `alloca`, which degrade performance
  significantly. InferAddrSpace pass is enhanced in
  [D91121](https://reviews.llvm.org/D91121) to take the assumption that
  generic pointers loaded from the constant memory could be regarded
  global ones. The need for the coercion on aggregate arguments is
  mitigated.

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

3 years ago[Polly] Fix memory leak.
Michael Kruse [Fri, 13 Nov 2020 01:31:47 +0000 (19:31 -0600)]
[Polly] Fix memory leak.

3 years ago[InstCombine] fold sub of low-bit masked value from offset of same value
Sanjay Patel [Fri, 13 Nov 2020 00:59:56 +0000 (19:59 -0500)]
[InstCombine] fold sub of low-bit masked value from offset of same value

There might be some demanded/known bits way to generalize this,
but I'm not seeing it right now.

This came up as a regression when I was looking at a different
demanded bits improvement.

https://rise4fun.com/Alive/5fl

  Name: general
  Pre: ((-1 << countTrailingZeros(C1)) & C2) == 0
  %a1 = add i8 %x, C1
  %a2 = and i8 %x, C2
  %r = sub i8 %a1, %a2
  =>
  %r = and i8 %a1, ~C2

  Name: test 1
  %a1 = add i8 %x, 192
  %a2 = and i8 %x, 10
  %r = sub i8 %a1, %a2
  =>
  %r = and i8 %a1, -11

  Name: test 2
  %a1 = add i8 %x, -108
  %a2 = and i8 %x, 3
  %r = sub i8 %a1, %a2
  =>
  %r = and i8 %a1, -4