platform/upstream/llvm.git
3 years ago[docs] Update ORCv2 design doc.
Lang Hames [Wed, 11 Nov 2020 23:05:43 +0000 (10:05 +1100)]
[docs] Update ORCv2 design doc.

Fixes some formatting and wording, and adds a roadmap section.

3 years ago[coro] Async coroutines: Allow more than 3 arguments in the dispatch function
Arnold Schwaighofer [Mon, 9 Nov 2020 20:05:57 +0000 (12:05 -0800)]
[coro] Async coroutines: Allow more than 3 arguments in the dispatch function

We need to be able to call function pointers. Inline the dispatch
function.

Also inline the context projection function.

Transfer debug locations from the suspend point to the inlined functions.

Use the function argument index instead of the function argument in
coro.id.async. This solves any spurious use issues.

Coerce the arguments of the tail call function at a suspend point. The LLVM
optimizer seems to drop casts leading to a vararg intrinsic.

rdar://70097093

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

3 years ago[NewPM] Provide method to run all pipeline callbacks, used for -O0
Arthur Eubanks [Sun, 8 Nov 2020 21:51:29 +0000 (13:51 -0800)]
[NewPM] Provide method to run all pipeline callbacks, used for -O0

Some targets may add required passes via
TargetMachine::registerPassBuilderCallbacks(). We need to run those even
under -O0. As an example, BPFTargetMachine adds
BPFAbstractMemberAccessPass, a required pass.

This also allows us to clean up BackendUtil.cpp (and out-of-tree Rust
usage of the NPM) by allowing us to share added passes like coroutines
and sanitizers between -O0 and other optimization levels.

Since callbacks may end up not adding passes, we need to check if the
pass managers are empty before adding them, so PassManager now has an
isEmpty() function. For example, polly adds callbacks but doesn't always
add passes in those callbacks, so this is necessary to keep
-debug-pass-manager tests' output from changing depending on if polly is
enabled or not.

Tests are a continuation of those added in
https://reviews.llvm.org/D89083.

Reviewed By: asbirlea, Meinersbur

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

3 years agoSuppress printing of inline namespace names in diagnostics by default,
Richard Smith [Wed, 11 Nov 2020 22:34:20 +0000 (14:34 -0800)]
Suppress printing of inline namespace names in diagnostics by default,
except where they are necessary to disambiguate the target.

This substantially improves diagnostics from the standard library,
which are otherwise full of `::__1::` noise.

3 years agoSuppress printing template arguments that match default template
Richard Smith [Wed, 11 Nov 2020 21:04:35 +0000 (13:04 -0800)]
Suppress printing template arguments that match default template
arguments of types by default.

This somewhat improves the worst-case printing of types like
std::string, std::vector, etc., where many irrelevant default arguments
can be included in the type as printed if we've lost the type sugar.

3 years ago[clangd] Add index server request logging
Sam McCall [Mon, 2 Nov 2020 23:24:03 +0000 (00:24 +0100)]
[clangd] Add index server request logging

- Add verbose logging of payloads
- Add public logging of request summaries
- fix non-logging of messages in request scopes (oops!)
- add test for public/non-public logging, extending pipeline_helper a bit.

We've accumulated quite a lot of duplication in the request handlers by now.
I should factor that out, but not in this patch...

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

3 years ago[libc++] Implement P0919R3: heterogenous lookup for unordered containers
Ruslan Arutyunyan [Tue, 10 Nov 2020 12:49:55 +0000 (07:49 -0500)]
[libc++] Implement P0919R3: heterogenous lookup for unordered containers

Implement heterogenous lookup for unordered containers, including the
refinement from P1690R1.

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

3 years ago[PowerPC] Accumulator/Unprimed Accumulator register copy, spill and restore
Baptiste Saleil [Mon, 2 Nov 2020 15:38:24 +0000 (09:38 -0600)]
[PowerPC] Accumulator/Unprimed Accumulator register copy, spill and restore

This patch adds support for accumulator/unprimed accumulator
register copy, spill and restore for MMA.

Authored By: Baptiste Saleil

Reviewed By: #powerpc, bsaleil, amyk

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

3 years ago[Polly][OpTree] Fix mid-processing change of access kind.
Michael Kruse [Wed, 11 Nov 2020 22:14:48 +0000 (16:14 -0600)]
[Polly][OpTree] Fix mid-processing change of access kind.

Operand tree forwarding can cause the change of an access kind; in
particular change from a scalar kind to an array kind if the scalar
dependency is not necessary. Such an access cannot and doesn't need to
be forwarded anymore.

Fixes llvm.org/PR48034

3 years ago[Polly][OpTree] Better report applied changes.
Michael Kruse [Wed, 11 Nov 2020 22:00:42 +0000 (16:00 -0600)]
[Polly][OpTree] Better report applied changes.

Print to dbgs() any taken action.

Also, read-only scalars do not require any action unless
-polly-analyze-read-only-scalars=true is used. Better refect this by
using ForwardingAction::triviallyForwardable and thus not bumping the
statistics.

3 years agoFrontend: Change ComputePreambleBounds to take MemoryBufferRef, NFC
Duncan P. N. Exon Smith [Thu, 5 Nov 2020 17:43:58 +0000 (12:43 -0500)]
Frontend: Change ComputePreambleBounds to take MemoryBufferRef, NFC

Avoid requiring an actual MemoryBuffer in ComputePreambleBounds, when
a MemoryBufferRef will do just fine.

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

3 years ago[clangd] Sanity-check array sizes read from disk before allocating them.
Sam McCall [Wed, 11 Nov 2020 12:45:19 +0000 (13:45 +0100)]
[clangd] Sanity-check array sizes read from disk before allocating them.

Previously a corrupted index shard could cause us to resize arrays to an
arbitrary int32. This tends to be a huge number, and can render the
system unresponsive.

Instead, cap this at the amount of data that might reasonably be read
(e.g. the #bytes in the file). If the specified length is more than that,
assume the data is corrupt.

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

3 years ago[libc++] NFC: Simplify incude of <cstdlib>
Louis Dionne [Wed, 11 Nov 2020 22:04:32 +0000 (17:04 -0500)]
[libc++] NFC: Simplify incude of <cstdlib>

We include <exception>, which includes <cstdlib> unconditionally anyway.

3 years ago[libc++abi] Reuse libc++'s refstring.h header instead of copying it
Louis Dionne [Wed, 11 Nov 2020 21:50:43 +0000 (16:50 -0500)]
[libc++abi] Reuse libc++'s refstring.h header instead of copying it

This has been a long-standing TODO item, however we have now been requiring
a monorepo layout to build libc++ and libc++abi for a while now. Hence,
we can fix this code duplication issue now.

Note that it's still not super pretty to reach into libc++ to include
headers, but it's better than having duplicated code which can get out
of sync.

3 years ago[flang] Fix CheckSpecificationExpr handling of associated names
peter klausler [Wed, 11 Nov 2020 19:05:23 +0000 (11:05 -0800)]
[flang] Fix CheckSpecificationExpr handling of associated names

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

Updated to fix a circular dependence between shared library
binaries that was introduced by the original patch.

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

3 years ago[CGSCC][Inliner] Handle new non-trivial edges in updateCGAndAnalysisManagerForPass
Arthur Eubanks [Sat, 7 Nov 2020 02:32:46 +0000 (18:32 -0800)]
[CGSCC][Inliner] Handle new non-trivial edges in updateCGAndAnalysisManagerForPass

Previously the inliner did a bit of a hack by adding ref edges for all
new edges introduced by performing an inline before calling
updateCGAndAnalysisManagerForPass(). This was because
updateCGAndAnalysisManagerForPass() didn't handle new non-trivial call
edges.

This adds handling of non-trivial call edges to
updateCGAndAnalysisManagerForPass().  The inliner called
updateCGAndAnalysisManagerForFunctionPass() since it was handling adding
newly introduced edges (so updateCGAndAnalysisManagerForPass() would
only have to handle promotion), but now it needs to call
updateCGAndAnalysisManagerForCGSCCPass() since
updateCGAndAnalysisManagerForPass() is now handling the new call edges
and function passes cannot add new edges.

We follow the previous path of adding trivial ref edges then letting promotion
handle changing the ref edges to call edges and the CGSCC updates. So
this still does not allow adding call edges that result in an addition
of a non-trivial ref edge.

This is in preparation for better detecting devirtualization. Previously
since the inliner itself would add ref edges,
updateCGAndAnalysisManagerForPass() would think that promotion and thus
devirtualization had happened after any sort of inlining.

Reviewed By: asbirlea

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

3 years ago[Matrix] Update mangling to use paramterized vendor ext type syntax.
Florian Hahn [Wed, 11 Nov 2020 21:39:22 +0000 (21:39 +0000)]
[Matrix] Update mangling to use paramterized vendor ext type syntax.

The Itanium CXX ABI grammer has been extended to support parameterized
vendor extended types [1].

This patch updates Clang's mangling for matrix types to use the new
extension.

[1] https://github.com/itanium-cxx-abi/cxx-abi/commit/b359d28971bdb961dd9b61bd0ef8c884452b4740

Reviewed By: rjmccall

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

3 years ago[libc++] NFC: Synchronize libc++abi and libc++ new definitions
Louis Dionne [Wed, 11 Nov 2020 21:33:38 +0000 (16:33 -0500)]
[libc++] NFC: Synchronize libc++abi and libc++ new definitions

Some changes were made to the libc++abi new/delete definitions, but
they were not copied back to the libc++ definition. It sucks that we
have this duplication, but for now at least let's keep them in sync.

3 years ago[AArch64][GlobalISel] Mark G_FCONSTANT as legal when there is full fp16 support
Jessica Paquette [Wed, 11 Nov 2020 21:21:35 +0000 (13:21 -0800)]
[AArch64][GlobalISel] Mark G_FCONSTANT as legal when there is full fp16 support

When there is full fp16 support, there is no reason to widen 16-bit
G_FCONSTANTs to 32 bits. Mark them as legal in this case.

Also, we currently import a pattern for materializing a 16-bit 0.0.
Add a testcase showing we select it.

(All other 16-bit G_FCONSTANTS are not yet selected.)

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

3 years ago[VE] Support vector register in inline asm
Kazushi (Jam) Marukawa [Wed, 11 Nov 2020 11:48:33 +0000 (20:48 +0900)]
[VE] Support vector register in inline asm

Support a vector register constraint in inline asm of clang.
Add a regression test also.

Reviewed By: simoll

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

3 years agoFrontend: Skip namespace around createVFSFromCompilerInvocation definition, NFC
Duncan P. N. Exon Smith [Fri, 6 Nov 2020 17:40:43 +0000 (12:40 -0500)]
Frontend: Skip namespace around createVFSFromCompilerInvocation definition, NFC

Qualify definitions with `clang::` rather than opening/closing a namespace.

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

3 years ago[flang] Allow labels on END statements.
peter klausler [Tue, 10 Nov 2020 23:03:21 +0000 (15:03 -0800)]
[flang] Allow labels on END statements.

F18 clause 5.3.3 explicitly allows labels on program unit END statements.
Label resolution code accounts for this for singleton program units,
but incorrectly generates an error for host subprograms with internal
subprograms.

   subroutine s(n)
      call s1(n)
      if (n == 0) goto 88 ! incorrect error
      print*, 's'
   contains
      subroutine s1(n)
         if (n == 0) goto 77 ! ok
         print*, 's1'
   77 end subroutine s1
   88 end

Label resolution code makes a sequential pass over an entire file to
collect label information for all subprograms, followed by a pass through
that information for semantics checks.  The problem is that END statements
may be separated from prior subprogram code by internal subprogram
definitions, so an END label can be associated with the wrong subprogram.

There are several ways to fix this.  Labels are always local to a
subprogram.  So the two separate passes over the entire file could probably
instead be interleaved to perform analysis on a subprogram as soon as the
end of the subprogram is reached, using a small stack.  The stack structure
would account for the "split" code case.  This might work.

It is possible that there is some not otherwise apparent advantage to
the current full-file pass design.  The parse tree has productions that
provide access to a subprogram END statement "in advance".  An alternative
is to access this information to solve the problem.  This PR implements
this latter option.

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

3 years agoAdd a flag to control whether to propagate labels from condition values to results
Jianzhou Zhao [Wed, 11 Nov 2020 06:13:06 +0000 (06:13 +0000)]
Add a flag to control whether to propagate labels from condition values to results

Before the change, DFSan always does the propagation. W/o
origin tracking, it is harder to understand such flows. After
the change, the flag is off by default.

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

3 years ago[libcxx] Check _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE first in __locale
Xiang Xiao [Wed, 11 Nov 2020 20:30:21 +0000 (15:30 -0500)]
[libcxx] Check _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE first in __locale

This is consistent with what's done in locale.cpp, and it ensures that
we get the default rune table whenever _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
is defined, regardless of the actual platform.

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

3 years agoFix 21555fff4de811309ea7935f9cb65578c957d77f
Walter Erquinigo [Wed, 11 Nov 2020 20:28:45 +0000 (12:28 -0800)]
Fix 21555fff4de811309ea7935f9cb65578c957d77f

Buildbot failed on Windows
http://lab.llvm.org:8011/#/builders/83/builds/693

Error: On Windows, std::future can't hold an Expected, as it doesn't have a default
constructor.

Solution: Use std::future<bool> instead of std::future<Expected<T>>

3 years agoAdd missing override (& fix an else-after-return while I'm here)
David Blaikie [Wed, 11 Nov 2020 20:29:08 +0000 (12:29 -0800)]
Add missing override (& fix an else-after-return while I'm here)

3 years ago[flang] Use IMPLICIT from scope of external function reference
peter klausler [Tue, 10 Nov 2020 23:10:48 +0000 (15:10 -0800)]
[flang] Use IMPLICIT from scope of external function reference

Implicitly typed references to external functions are applying
the IMPLICIT typing rules of the global scope in which their
symbols were created, not the IMPLICIT typing rules in force in
the scope from which they were referenced.

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

3 years agoRevert "[clang][cli] Port ObjCMTAction to new option parsing system"
Mehdi Amini [Wed, 11 Nov 2020 20:00:21 +0000 (20:00 +0000)]
Revert "[clang][cli] Port ObjCMTAction to new option parsing system"

This reverts commit 09248a5d25bb1c9f357247fa3da8fbe4470e9c67.

Some builds are broken. I suspect a `static constexpr` in a class missing a
definition out of class (required pre-c++17).

3 years ago[OpenMP] Fix shutdown hang/race bug
Peyton, Jonathan L [Mon, 2 Nov 2020 21:46:29 +0000 (15:46 -0600)]
[OpenMP] Fix shutdown hang/race bug

The deadlock/race happens when primary thread gets initz lock and tries to join
the worker thread which waits for the same lock in TLS key destructor.
The patch removes the lock and the code of setting TLS value which needed
the lock. Also removed setting TLS from __kmp_unregister_root_current_thread.

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

3 years ago[clangd] Fix serialization error check.
Sam McCall [Wed, 11 Nov 2020 19:45:58 +0000 (20:45 +0100)]
[clangd] Fix serialization error check.

3 years ago[AArch4] Regenerate test checks for f16-imm.ll. NFC
David Green [Wed, 11 Nov 2020 19:42:12 +0000 (19:42 +0000)]
[AArch4] Regenerate test checks for f16-imm.ll. NFC

3 years ago[flang] Add isnan() extension intrinsic function, with folding
peter klausler [Tue, 10 Nov 2020 23:07:53 +0000 (15:07 -0800)]
[flang] Add isnan() extension intrinsic function, with folding

It's nonstandard, but commonly implemented.

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

3 years ago[NFC] [Legalize] Fix spaces and style.
Pavel Iliin [Wed, 11 Nov 2020 19:08:46 +0000 (19:08 +0000)]
[NFC] [Legalize] Fix spaces and style.

3 years agoDisable implicit nesting on parsing textual pass pipeline
Mehdi Amini [Wed, 11 Nov 2020 05:33:47 +0000 (05:33 +0000)]
Disable implicit nesting on parsing textual pass pipeline

Previous the textual form of the pass pipeline would implicitly nest,
instead we opt for the explicit form here: this has less surprise.

This also avoids asserting in the bindings when passing a pass pipeline
with incorrect nesting.

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

3 years ago[mlir] Fix post-dominance between blocks of different regions.
Thomas Raoux [Wed, 11 Nov 2020 02:08:26 +0000 (18:08 -0800)]
[mlir] Fix post-dominance between blocks of different regions.

If block A and B are in different regions and region of A is not an ancestor of
B, either A is included in region of B or the two regions are disjoint. In both
case A doesn't post-dominate B.

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

3 years ago[OpenMP][Tool] Fix possible NULL-pointer dereference in test
Joachim Protze [Wed, 11 Nov 2020 19:10:54 +0000 (20:10 +0100)]
[OpenMP][Tool] Fix possible NULL-pointer dereference in test

Avoid dereferencing a possibly uninitialized pointer as mentioned in D91280.

3 years ago[OpenMP][Tests] Fix compiler warnings in OpenMP runtime tests
Joachim Protze [Wed, 11 Nov 2020 18:35:14 +0000 (19:35 +0100)]
[OpenMP][Tests] Fix compiler warnings in OpenMP runtime tests

This patch allows to pass the OpenMP runtime tests after configuring with
`cmake . -DOPENMP_TEST_FLAGS:STRING="-Werror"`.
The warnings for OMPT tests are addressed in D90752.

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

3 years ago[OpenMP][OMPT] Update the omp-tools header file to reflect 5.1 changes
Joachim Protze [Wed, 4 Nov 2020 11:16:25 +0000 (12:16 +0100)]
[OpenMP][OMPT] Update the omp-tools header file to reflect 5.1 changes

This doesn't add functionality, but just adds the new types and renames the
master callback to masked callback.

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

3 years agoAdd a simple stack trace printer for DFSan
Jianzhou Zhao [Wed, 28 Oct 2020 06:48:49 +0000 (06:48 +0000)]
Add a simple stack trace printer for DFSan

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

3 years agoMove variable declarations to functions in which they are used. NFC
Akira Hatanaka [Wed, 11 Nov 2020 18:56:10 +0000 (10:56 -0800)]
Move variable declarations to functions in which they are used. NFC

3 years ago[lldb/test] Add missing decorators import
Vedant Kumar [Wed, 11 Nov 2020 18:48:27 +0000 (10:48 -0800)]
[lldb/test] Add missing decorators import

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

Adds test coverage for ThreadPlanStepInRange::SetAvoidRegexp, but
disables the test on Windows.

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

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

3 years ago[NFC] Reformat llvm-elfabi
Haowei Wu [Wed, 11 Nov 2020 18:40:06 +0000 (10:40 -0800)]
[NFC] Reformat llvm-elfabi

Makes diff in next commit more readable.

3 years ago[RISCV] srem-vector-lkk.ll - remove unused check prefix
Simon Pilgrim [Wed, 11 Nov 2020 18:37:58 +0000 (18:37 +0000)]
[RISCV] srem-vector-lkk.ll - remove unused check prefix

3 years ago[Sparc] fp16-promote.ll - Refactor check prefixes + remove unused ones
Simon Pilgrim [Wed, 11 Nov 2020 18:32:18 +0000 (18:32 +0000)]
[Sparc] fp16-promote.ll - Refactor check prefixes + remove unused ones

3 years ago[SystemZ] Regenerate some fp tests + remove unused check prefixes
Simon Pilgrim [Wed, 11 Nov 2020 18:27:55 +0000 (18:27 +0000)]
[SystemZ] Regenerate some fp tests + remove unused check prefixes

Just use default CHECK

3 years ago[BPF] intrinsic-array-2.ll - remove unused check prefixes
Simon Pilgrim [Wed, 11 Nov 2020 18:17:44 +0000 (18:17 +0000)]
[BPF] intrinsic-array-2.ll - remove unused check prefixes

Just use default CHECK

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

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

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

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

Depends on D89283.

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

  thread trace start

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

Also, if the user typed

  help thread trace start

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

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

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

On a machine without intel-pt support, I got

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

Reviewed By: clayborg, labath

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

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

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

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

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

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

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

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

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

Just use default CHECK

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

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

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

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

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

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

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

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

As a result, we could never select things like

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

Because we don't import any patterns for compares.

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

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

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

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

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

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

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

Reviewed By: jhenderson

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This reverts commit ae3640e386ccfbe0e984cc8c4b0399006ed835c7.

The new test is failing on the Windows LLDB buildbot.

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

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

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

Reviewed By: MaskRay

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

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

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

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

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

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

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

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

Noticed while fixing unused prefix warnings

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

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

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

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

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

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

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

This reverts commit cfd8481da1adba1952e0f6ecd00440986e49a946.

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

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

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

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

Noticed while fixing unused prefix warnings,

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

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

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

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

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

This reverts commit 8b08fa0103c8d8e624b19fad5a5006e7a783ecb7.

The underlying problems were fixed by D90607.

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

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

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

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

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

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

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

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

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

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

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

Reviewed By: Anastasia

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

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

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

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

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

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

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

This mimics the recent similar patch for GPUToNVVM.

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

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

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

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

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

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

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

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

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

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

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

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

Depends on D82574

Reviewed By: Bigcheese

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

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

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

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

Reviewed By: sdesmalen

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

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

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

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

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

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

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

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

Reviewed By: kadircet

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

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

This reverts commit b670189975f5ba4e8ef22c74724c610287b69c28.

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

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

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

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

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

Reviewed By: mprobst

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

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

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

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

Reviewed By: lebedev.ri

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

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

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

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

Reviewed By: sdesmalen

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