platform/upstream/llvm.git
3 years ago[ObjC][ARC] Add and use a function which finds and returns the single
Akira Hatanaka [Fri, 13 Nov 2020 18:40:40 +0000 (10:40 -0800)]
[ObjC][ARC] Add and use a function which finds and returns the single
dependency. NFC

Use findSingleDependency in place of FindDependencies and stop passing a
set of Instructions around. Modify FindDependencies to return a boolean
flag which indicates whether the dependencies it has found are all
valid.

3 years agoMove variable declarations to functions in which they are used. NFC
Akira Hatanaka [Fri, 13 Nov 2020 17:56:12 +0000 (09:56 -0800)]
Move variable declarations to functions in which they are used. NFC

3 years ago[GlobalISel] Add convenience matchers for nots and all-ones constants
Jessica Paquette [Fri, 13 Nov 2020 19:28:55 +0000 (11:28 -0800)]
[GlobalISel] Add convenience matchers for nots and all-ones constants

Add a convenience matcher which handles

```
G_XOR %not_reg, -1
```

And a convenience matcher which returns true if an integer constant is
all-ones.

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

3 years ago[DFSan][NewPM] Handle dfsan under NPM
Arthur Eubanks [Thu, 12 Nov 2020 21:19:04 +0000 (13:19 -0800)]
[DFSan][NewPM] Handle dfsan under NPM

Make it required. Since it's a module pass, optnone won't test it, so
extend the clang test to also use opt-bisect now that it's supported.

14/16 check-dfsan tests failed with NPM enabled, now all pass.

Reviewed By: leonardchan

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

3 years ago[KnownBits] Combine abs() implementations
Nikita Popov [Fri, 13 Nov 2020 21:17:26 +0000 (22:17 +0100)]
[KnownBits] Combine abs() implementations

ValueTracking was using a more powerful abs() implementation. Roll
it into KnownBits::abs(). Also add an exhaustive test for abs(),
in both the poisoning and non-poisoning variants.

3 years agoSerialization: Merge three diagnostics to simplify ASTReader::getInputFile, NFC
Duncan P. N. Exon Smith [Thu, 12 Nov 2020 17:53:49 +0000 (12:53 -0500)]
Serialization: Merge three diagnostics to simplify ASTReader::getInputFile, NFC

Clean up the logic for `err_fe_{pch,module,ast}_file_modified` to use a
`select` like other ASTReader diagnostics. There should be no
functionality change here, just a cleanup.

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

3 years ago[NFC] Refactor function declaration addition in AsyncToLLVM
Rahul Joshi [Fri, 13 Nov 2020 19:58:40 +0000 (11:58 -0800)]
[NFC] Refactor function declaration addition in AsyncToLLVM

- Extract repeated code into helper function/lambdas.

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

3 years ago[RISCV] Add test case showing failure to use GREVIW for i32 bitreverse if result...
Craig Topper [Fri, 13 Nov 2020 20:38:20 +0000 (12:38 -0800)]
[RISCV] Add test case showing failure to use GREVIW for i32 bitreverse if result is not sign extended. NFC

3 years ago[mlir][vector] Support N-D vector in InsertMap/ExtractMap op
Thomas Raoux [Fri, 13 Nov 2020 20:16:47 +0000 (12:16 -0800)]
[mlir][vector] Support N-D vector in InsertMap/ExtractMap op

Support multi-dimension vector for InsertMap/ExtractMap op and update the
transformations. Currently the relation between IDs and dimension is implicitly
deduced from the types. We can then calculate an AffineMap based on it. In the
future the AffineMap could be part of the operation itself.

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

3 years ago[OpenMP] Add omp_calloc implementation
Nawrin Sultana [Fri, 6 Nov 2020 20:45:25 +0000 (14:45 -0600)]
[OpenMP] Add omp_calloc implementation

This patch adds omp_calloc implementation according to OpenMP 5.1
specification.

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

3 years ago[mlir][Linalg] Change LinalgDependenceGraph to use LinalgOp.
MaheshRavishankar [Fri, 13 Nov 2020 20:21:43 +0000 (12:21 -0800)]
[mlir][Linalg] Change LinalgDependenceGraph to use LinalgOp.

Using LinalgOp will reduce the repeated conversion from Operation <->
LinalgOp.

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

3 years agoemacs: Add callbr to keyword list
Matt Arsenault [Fri, 25 Sep 2020 15:57:13 +0000 (11:57 -0400)]
emacs: Add callbr to keyword list

3 years agoGlobalISel: Fix typos
Matt Arsenault [Fri, 25 Sep 2020 16:59:28 +0000 (12:59 -0400)]
GlobalISel: Fix typos

3 years ago[WebAssembly] Rename atomic.notify and *.atomic.wait
Heejin Ahn [Fri, 13 Nov 2020 12:24:47 +0000 (04:24 -0800)]
[WebAssembly] Rename atomic.notify and *.atomic.wait

- atomic.notify -> memory.atomic.notify
- i32.atomic.wait -> memory.atomic.wait32
- i64.atomic.wait -> memory.atomic.wait64

See https://github.com/WebAssembly/threads/pull/149.

Reviewed By: tlively

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

3 years ago[AlwaysInliner] Call mergeAttributesForInlining after inlining
Guozhi Wei [Fri, 13 Nov 2020 19:57:29 +0000 (11:57 -0800)]
[AlwaysInliner] Call mergeAttributesForInlining after inlining

Like inlineCallIfPossible and InlinerPass, after inlining mergeAttributesForInlining
should be called to merge callee's attributes to caller. But it is not called in
AlwaysInliner, causes caller's attributes inconsistent with inlined code.

Attached test case demonstrates that attribute "min-legal-vector-width"="512" is
not merged into caller without this patch, and it causes failure in SelectionDAG
when lowering the inlined AVX512 intrinsic.

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

3 years ago[RISCV] Add test case for failure to use GREVIW for i32 bswap if result is not sign...
Craig Topper [Fri, 13 Nov 2020 19:45:05 +0000 (11:45 -0800)]
[RISCV] Add test case for failure to use GREVIW for i32 bswap if result is not sign extended. NFC

3 years ago[WebAssembly] Remove a temporarily added RUN line
Heejin Ahn [Fri, 13 Nov 2020 11:43:45 +0000 (03:43 -0800)]
[WebAssembly] Remove a temporarily added RUN line

This RUN line was added as a temporary measure to undo the damage done
by D79655. Everyone's build system should be fine by now.

Reviewed By: tlively

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

3 years agoExtend the dfsan store/load callback with write/read address
Jianzhou Zhao [Fri, 13 Nov 2020 19:46:32 +0000 (19:46 +0000)]
Extend the dfsan store/load callback with write/read address

This helped debugging.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D91236

3 years agoThe AssertRecognizer used the module from a frames SC without checking it was non...
Jim Ingham [Fri, 13 Nov 2020 19:36:17 +0000 (11:36 -0800)]
The AssertRecognizer used the module from a frames SC without checking it was non-null.

I only have a crash report for this.  I could reproduce it with a slightly older
lldb by running an expression that called pthread_kill, but we started making modules
for our expression JIT code, so that no longer triggers the bug.  I can't think of another
good way to test it but the fix is obvious.

3 years agoSerialization: Rename three AST diagnostics, NFC
Duncan P. N. Exon Smith [Fri, 13 Nov 2020 17:00:08 +0000 (12:00 -0500)]
Serialization: Rename three AST diagnostics, NFC

All three diagnostics have a select between "PCH", "module", and "AST"
in the text. The most generic of these is "AST", so rename them from
`err_module_...` to `err_ast_...`.

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

3 years ago[RISCV] Add RORW/ROLW/RORIW/ROLIW test cases that don't sign extend the result. NFC
Craig Topper [Fri, 13 Nov 2020 18:26:11 +0000 (10:26 -0800)]
[RISCV] Add RORW/ROLW/RORIW/ROLIW test cases that don't sign extend the result. NFC

This shows that we currently fail to select RORIW/ROLIW.

3 years ago[PowerPC] Add paired vector load and store builtins and intrinsics
Baptiste Saleil [Fri, 13 Nov 2020 18:32:57 +0000 (12:32 -0600)]
[PowerPC] Add paired vector load and store builtins and intrinsics

This patch adds the Clang builtins and LLVM intrinsics to load and store vector pairs.

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

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