platform/upstream/llvm.git
4 years ago[libc++/abi] Provide an option to turn on forgiving dynamic_cast when building libc...
Louis Dionne [Wed, 22 Apr 2020 20:17:58 +0000 (16:17 -0400)]
[libc++/abi] Provide an option to turn on forgiving dynamic_cast when building libc++abi

Instead of the ad-hoc #define _LIBCXX_DYNAMIC_FALLBACK, provide an option
to enable the setting when building libc++abi. Also use the occasion to
rename the option to something slightly more descriptive.

Note that in the future, it would be great to simply remove this option
altogether. However, in the meantime, it seems better to have it be an
official option than something ad-hoc.

4 years ago[PowerPC][Future] Initial support for PCRel addressing to get block address
Victor Huang [Wed, 22 Apr 2020 20:01:29 +0000 (15:01 -0500)]
[PowerPC][Future] Initial support for PCRel addressing to get block address

Add initial support for PCRelative addressing to get block address
instead of using TOC.

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

4 years ago[docs] Fix :option: links
Jon Roelofs [Wed, 22 Apr 2020 19:59:57 +0000 (13:59 -0600)]
[docs] Fix :option: links

4 years ago[libc++abi] NFC: Use "" instead of <> to include __cxxabi_config.h
Louis Dionne [Wed, 22 Apr 2020 19:52:26 +0000 (15:52 -0400)]
[libc++abi] NFC: Use "" instead of <> to include __cxxabi_config.h

This is more consistent with how __cxxabi_config.h is included in other
files in libcxxabi/src.

4 years ago[builtins] Add void prototype to unprototyped functions
Ayke van Laethem [Wed, 22 Apr 2020 14:41:23 +0000 (16:41 +0200)]
[builtins] Add void prototype to unprototyped functions

This patch replaces () prototypes with (void) prototypes.

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

4 years ago[ELF] For relative paths in INPUT() and GROUP(), search the directory of the current...
Fangrui Song [Thu, 9 Apr 2020 04:45:21 +0000 (21:45 -0700)]
[ELF] For relative paths in INPUT() and GROUP(), search the directory of the current linker script before searching other paths

For a relative path in INPUT() or GROUP(), this patch changes the search order by adding the directory of the current linker script.
The new search order (consistent with GNU ld >= 2.35 regarding the new test `test/ELF/input-relative.s`):

1. the directory of the current linker script (GNU ld from Binutils 2.35 onwards; https://sourceware.org/bugzilla/show_bug.cgi?id=25806)
2. the current working directory
3. library paths (-L)

This behavior makes it convenient to replace a .so or .a with a linker script with additional input. For example, glibc

```
% cat /usr/lib/x86_64-linux-gnu/libm.a
/* GNU ld script
*/
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /usr/lib/x86_64-linux-gnu/libm-2.29.a /usr/lib/x86_64-linux-gnu/libmvec.a )
```

could be simplified as `GROUP(libm-2.29.a libmvec.a)`.

Another example is to make libc++.a a linker script:
```
INPUT(libc++.a.1 libc++abi.a)
```

Note, -l is not affected.

Reviewed By: psmith

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

4 years ago[libc++] Don't try to include <Block.h> when not available
Louis Dionne [Wed, 22 Apr 2020 19:22:03 +0000 (15:22 -0400)]
[libc++] Don't try to include <Block.h> when not available

4 years ago[CallSite removal][ValueTracking] Use CallBase instead of ImmutableCallSite for getIn...
Craig Topper [Wed, 22 Apr 2020 17:48:09 +0000 (10:48 -0700)]
[CallSite removal][ValueTracking] Use CallBase instead of ImmutableCallSite for getIntrinsicForCallSite. NFC

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

4 years ago[clang] Make sure argument expansion locations are correct in presence of predefined...
Kadir Cetinkaya [Wed, 22 Apr 2020 14:37:27 +0000 (16:37 +0200)]
[clang] Make sure argument expansion locations are correct in presence of predefined buffer

Summary:
Macro argument expansion logic relies on skipping file IDs that created
as a result of an include. Unfortunately it fails to do that for
predefined buffer since it doesn't have a valid insertion location.

As a result of that any file ID created for an include inside the
predefined buffers breaks the traversal logic in
SourceManager::computeMacroArgsCache.

To fix this issue we first record number of created FIDs for predefined
buffer, and then skip them explicitly in source manager.

Another solution would be to just give predefined buffers a valid source
location, but it is unclear where that should be..

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[clangd] Fix a crash for accessing a null template decl returned by findExplicitRefer...
Haojian Wu [Wed, 22 Apr 2020 11:33:02 +0000 (13:33 +0200)]
[clangd] Fix a crash for accessing a null template decl returned by findExplicitReferences.

Summary: Fixes https://github.com/clangd/clangd/issues/347.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[llvm][MIRVRegNamer] Avoid collisions across jump table indices.
Puyan Lotfi [Sun, 12 Apr 2020 05:09:08 +0000 (22:09 -0700)]
[llvm][MIRVRegNamer] Avoid collisions across jump table indices.

Hash Jump Table Indices uniquely within a basic block for MIR
Canonicalizer / MIR VReg Renamer passes.

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

4 years ago[libc++] Add support for blocks in std::function
Louis Dionne [Wed, 22 Apr 2020 17:58:17 +0000 (13:58 -0400)]
[libc++] Add support for blocks in std::function

rdar://14390808

4 years ago[docs] Document lit's --timeout=N flag
Jon Roelofs [Wed, 22 Apr 2020 18:56:22 +0000 (12:56 -0600)]
[docs] Document lit's --timeout=N flag

4 years ago[ObjectYAML][MachO] Add support for relocations
Alexander Shaposhnikov [Wed, 22 Apr 2020 18:50:55 +0000 (11:50 -0700)]
[ObjectYAML][MachO] Add support for relocations

Add support for relocations for MachO to ObjectYAML / yaml2obj / obj2yaml.

Test plan: make check-all

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

4 years agoRename warning identifiers from cxx2a to cxx20; NFC.
Aaron Ballman [Wed, 22 Apr 2020 18:28:15 +0000 (14:28 -0400)]
Rename warning identifiers from cxx2a to cxx20; NFC.

4 years ago[libc++] Update the cache for building libc++/libc++abi on Apple
Louis Dionne [Wed, 22 Apr 2020 17:54:36 +0000 (13:54 -0400)]
[libc++] Update the cache for building libc++/libc++abi on Apple

4 years ago[clangd] go-to-def on names in comments etc that are used nearby.
Sam McCall [Mon, 2 Mar 2020 21:45:25 +0000 (22:45 +0100)]
[clangd] go-to-def on names in comments etc that are used nearby.

Summary:
This is intended as a companion to (and is inspired by) D72874 which attempts to
resolve these cases using the index.
The intent is we'd try this strategy after the AST-based approach but before the
index-based (I think local usages would be more reliable than index matches).

Reviewers: nridge

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agoscudo: Change the macro used to check whether we're targeting the platform.
Peter Collingbourne [Tue, 21 Apr 2020 22:30:50 +0000 (15:30 -0700)]
scudo: Change the macro used to check whether we're targeting the platform.

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

4 years ago[Lanai] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 15:36:02 +0000 (16:36 +0100)]
[Lanai] Remove unused forward declarations. NFC.

4 years ago[Hexagon] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 15:35:19 +0000 (16:35 +0100)]
[Hexagon] Remove unused forward declarations. NFC.

4 years ago[AVR] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 14:53:06 +0000 (15:53 +0100)]
[AVR] Remove unused forward declarations. NFC.

4 years agoBPFMCTargetDesc.h - remove unused raw_ostream forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 14:52:19 +0000 (15:52 +0100)]
BPFMCTargetDesc.h - remove unused raw_ostream forward declaration. NFC.

4 years ago[Docs] Fixed formatting in release notes, NFC
Mikhail Maltsev [Wed, 22 Apr 2020 17:25:22 +0000 (18:25 +0100)]
[Docs] Fixed formatting in release notes, NFC

4 years ago[ARM] Replace arm vendor with none. NFC
David Green [Wed, 22 Apr 2020 15:33:11 +0000 (16:33 +0100)]
[ARM] Replace arm vendor with none. NFC

4 years ago[PowerPC][Future] Remove redundant r2 save and restore for indirect call
Victor Huang [Wed, 22 Apr 2020 15:55:34 +0000 (10:55 -0500)]
[PowerPC][Future] Remove redundant r2 save and restore for indirect call

Currently an indirect call produces the following sequence on PCRelative mode:

extern void function( );
extern void (*ptrfunc) ( );

void g() {
    ptrfunc=function;
}

void f() {
    (*ptrfunc) ( );
}

Producing

paddi 3, 0, .LC0@PCREL, 1
ld 3, 0(3)
std 2, 24(1)
ld 12, 0(3)
mtctr 12
bctrl
ld 2, 24(1)

Though the caller does not use or preserve r2, it is still saved and restored
across a function call. This patch is added to remove these redundant save and
restores for indirect calls.

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

4 years agoUpdate go bindings for 2dea3f129878e929e5d1f00b91a622eb1ec8be4e
Benjamin Kramer [Wed, 22 Apr 2020 17:02:01 +0000 (19:02 +0200)]
Update go bindings for 2dea3f129878e929e5d1f00b91a622eb1ec8be4e

4 years ago[Hexagon] Silence warning
Benjamin Kramer [Wed, 22 Apr 2020 16:57:08 +0000 (18:57 +0200)]
[Hexagon] Silence warning

llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp:296:11: warning: enumeration value 'ScalableVectorTyID' not handled in switch [-Wswitch]
  switch (Ty->getTypeID()) {
          ^

4 years ago[mlir][vulkan-runner] Add support for integer types.
Denis Khalikov [Mon, 20 Apr 2020 20:31:24 +0000 (23:31 +0300)]
[mlir][vulkan-runner] Add support for integer types.

Summary:
Add support for memrefs with element type as integer type
and simple test.

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

4 years ago[lldb/Host] Remove TaskPool and replace its uses with llvm::ThreadPool
Jonas Devlieghere [Wed, 22 Apr 2020 15:48:31 +0000 (08:48 -0700)]
[lldb/Host] Remove TaskPool and replace its uses with llvm::ThreadPool

Remove LLDB's TaskPool and replace its uses with LLVM's ThreadPool.

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

4 years ago[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush
Johannes Doerfert [Wed, 22 Apr 2020 15:17:32 +0000 (10:17 -0500)]
[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush

This was reported as PR45635, committed first as
72a9e7c926f4e32f209e528ec407fe526da5587e, reverted by
188f5cde9635a29a3f20ee2a73abd02890a752c7, and now recommitted with the
test change.

4 years ago[SVE] Add new VectorType subclasses
Christopher Tetreault [Wed, 22 Apr 2020 15:02:02 +0000 (08:02 -0700)]
[SVE] Add new VectorType subclasses

Summary:
Introduce new types for fixed width and scalable vectors.

Does not remove getNumElements yet so as to not break code during transition
period.

Reviewers: deadalnix, efriedma, sdesmalen, craig.topper, huntergr

Reviewed By: sdesmalen

Subscribers: jholewinski, arsenm, jvesely, nhaehnle, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, kerbowa, Joonsoo, grosul1, frgossen, lldb-commits, tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm, #lldb

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

4 years ago[ARM][MC][Thumb] Recommit: Revert relocation for some pc-relative fixups.
Mark Murray [Mon, 20 Apr 2020 15:21:46 +0000 (16:21 +0100)]
[ARM][MC][Thumb] Recommit: Revert relocation for some pc-relative fixups.

Summary:
This commit recommits the reversion of https://reviews.llvm.org/D75039.

Concensus appears to be in favour of assembly-time resolution of
these ADR and LDR relocations, in line with GNU. The previous
backout broke many lld tests, now fixed by Peter Smith in
61bccda9d9d920c72f49025f11e8601daeb096ec.

Reviewers: psmith

Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC][Future] Initial support for PCRel addressing for jump tables.
Victor Huang [Wed, 22 Apr 2020 15:45:01 +0000 (10:45 -0500)]
[PowerPC][Future] Initial support for PCRel addressing for jump tables.

Add initial support for PC Relative addressing to get jump table base
address instead of using TOC.

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

4 years ago[SveEmitter] Add IsOverloadNone flag and builtins for svpfalse and svcnt[bhwd]_pat
Sander de Smalen [Wed, 22 Apr 2020 14:00:01 +0000 (15:00 +0100)]
[SveEmitter] Add IsOverloadNone flag and builtins for svpfalse and svcnt[bhwd]_pat

Add the IsOverloadNone flag to tell CGBuiltin that it does not have
an overloaded type. This is used for e.g. svpfalse which does
not take any arguments and always returns a svbool_t.

This patch also adds builtins for svcntb_pat, svcnth_pat, svcntw_pat
and svcntd_pat, as those don't require custom codegen.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: efriedma

Tags: #clang

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

4 years ago[llvm][NFC][CallSite] Remove CallSite from a few trivial locations
Mircea Trofin [Wed, 22 Apr 2020 04:56:04 +0000 (21:56 -0700)]
[llvm][NFC][CallSite] Remove CallSite from a few trivial locations

Summary: Implementation details and internal (to module) APIs.

Reviewers: craig.topper, dblaikie

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush"
Johannes Doerfert [Wed, 22 Apr 2020 15:36:23 +0000 (10:36 -0500)]
Revert "[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush"

Forgot to include test changes :(

This reverts commit 72a9e7c926f4e32f209e528ec407fe526da5587e.

4 years agoclang-format: Introduce stricter AlignOperands flag
Francois Ferrand [Mon, 22 May 2017 09:23:08 +0000 (11:23 +0200)]
clang-format: Introduce stricter AlignOperands flag

Summary:
Even when BreakBeforeBinaryOperators is set, AlignOperands kept
aligning the beginning of the line, even when it could align the
actual operands (e.g. after an assignment).

With this patch, there is an option to actually align the operands, so
that the operator gets right-aligned with the equal sign or return
operator:

  int aaaaa = bbbbbb
            + cccccc;
  return aaaaaaa
      && bbbbbbb;

This not happen in parentheses, to avoid 'breaking' the indentation:

  if (aaaaa
      && bbbbb)
    return;

Reviewers: krasimir, djasper

Subscribers: cfe-commits, klimek

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

4 years agoclang-format: support aligned nested conditionals formatting
Francois Ferrand [Fri, 15 Jun 2018 12:22:23 +0000 (14:22 +0200)]
clang-format: support aligned nested conditionals formatting

When multiple ternary operators are chained, e.g. like an if/else-if/
else-if/.../else sequence, clang-format will keep aligning the colon
with the question mark, which increases the indent for each
conditionals:

  int a = condition1 ? result1
                     : condition2 ? result2
                                  : condition3 ? result3
                                               : result4;

This patch detects the situation (e.g. conditionals used in false branch
of another conditional), to avoid indenting in that case:

  int a = condition1   ? result1
          : condition2 ? result2
          : condition3 ? result3
                       : result4;

When BreakBeforeTernaryOperators is false, this will format like this:

  int a = condition1 ? result1 :
          condition2 ? result2 :
          conditino3 ? result3 :
                       result4;

4 years ago[ARM] Release notes for the Custom Datapath Extension (CDE)
Mikhail Maltsev [Wed, 22 Apr 2020 15:34:19 +0000 (16:34 +0100)]
[ARM] Release notes for the Custom Datapath Extension (CDE)

Summary:
This change mentions CDE assembly in the LLVM release notes and CDE
intrinsics in both Clang and LLVM release notes.

Reviewers: kristof.beyls, simon_tatham

Reviewed By: kristof.beyls

Subscribers: danielkiss, cfe-commits

Tags: #clang

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

4 years ago[TSAN] Add optional support for distinguishing volatiles
Dmitry Vyukov [Wed, 22 Apr 2020 14:01:33 +0000 (16:01 +0200)]
[TSAN] Add optional support for distinguishing volatiles

Add support to optionally emit different instrumentation for accesses to
volatile variables. While the default TSAN runtime likely will never
require this feature, other runtimes for different environments that
have subtly different memory models or assumptions may require
distinguishing volatiles.

One such environment are OS kernels, where volatile is still used in
various places for various reasons, and often declare volatile to be
"safe enough" even in multi-threaded contexts. One such example is the
Linux kernel, which implements various synchronization primitives using
volatile (READ_ONCE(), WRITE_ONCE()). Here the Kernel Concurrency
Sanitizer (KCSAN) [1], is a runtime that uses TSAN instrumentation but
otherwise implements a very different approach to race detection from
TSAN.

While in the Linux kernel it is generally discouraged to use volatiles
explicitly, the topic will likely come up again, and we will eventually
need to distinguish volatile accesses [2]. The other use-case is
ignoring data races on specially marked variables in the kernel, for
example bit-flags (here we may hide 'volatile' behind a different name
such as 'no_data_race').

[1] https://github.com/google/ktsan/wiki/KCSAN
[2] https://lkml.kernel.org/r/CANpmjNOfXNE-Zh3MNP=-gmnhvKbsfUfTtWkyg_=VqTxS4nnptQ@mail.gmail.com

Author: melver (Marco Elver)
Reviewed-in: https://reviews.llvm.org/D78554

4 years ago[mlir][vulkan-runner] Fix testsuite.
Denis Khalikov [Wed, 22 Apr 2020 14:39:39 +0000 (17:39 +0300)]
[mlir][vulkan-runner] Fix testsuite.

Summary: Fix testsuite after D78542.

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

4 years ago[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush
Johannes Doerfert [Wed, 22 Apr 2020 15:17:32 +0000 (10:17 -0500)]
[OpenMP][FIX] Do not use InaccessibleMemOrArgMemOnly for barrier and flush

This was reported as PR45635.

4 years agoFix -Wunused-variable error.
Haojian Wu [Wed, 22 Apr 2020 15:17:41 +0000 (17:17 +0200)]
Fix -Wunused-variable error.

4 years ago[nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE
Jan Kratochvil [Wed, 22 Apr 2020 14:46:29 +0000 (16:46 +0200)]
[nfc] [lldb] DWARF callbacks: DIERef -> DWARFDIE

Pavel Labath wrote in D73206:
The internal representation of DebugNames and Apple indexes is fixed by
the relevant (pseudo-)standards, so we can't really change it. The
question is how to efficiently (and cleanly) convert from the internal
representation to some common thing. The conversion from AppleIndex to
DIERef is trivial (which is not surprising as it was the first and the
overall design was optimized for that). With debug_names, the situation
gets more tricky. The internal representation of debug_names uses
CU-relative DIE offsets, but DIERef wants an absolute offset. That means
the index has to do more work to produce the common representation. And
it needs to do that for all results, even though a lot of the index
users are really interested only in a single entry. With the switch to
user_id_t, _all_ indexes would have to do some extra work to encode it,
only for their users to have to immediately decode it back. Having
a iterator/callback based api would allow us to minimize the impact of
that, as it would only need to happen for the entries that are really
used. And /I think/ we could make it interface returns DWARFDies
directly, and each index converts to that using the most direct approach
available.

Jan Kratochvil:
It also makes all the callers shorter as they no longer need to fetch
DWARFDIE from DIERef (and handling if not found by ReportInvalidDIERef)
but the callers are already served DWARFDIE which they need.
In some cases the DWARFDIE had to be fetched both by callee (DWARFIndex
implementation) and caller.

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

4 years ago[CMake] Add a warning message to prepare the upcoming upgrade to CMake 3.13.4
Louis Dionne [Wed, 8 Apr 2020 16:26:59 +0000 (12:26 -0400)]
[CMake] Add a warning message to prepare the upcoming upgrade to CMake 3.13.4

As discussed in http://lists.llvm.org/pipermail/llvm-dev/2020-March/140349.html,
the minimum version of CMake required to build LLVM will be upgraded to
3.13.4 right after we create the release branch for LLVM 11.0.0.

As part of this effort, this commit adds a warning to give a heads up
to folks regarding the upcoming upgrade. This should allow users to
upgrade their CMake in advance so that the upgrade can sail right
through when the time comes.

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

4 years ago[NFC][InstCombine] Tests for negation of sign-/zero- extensions
Roman Lebedev [Wed, 22 Apr 2020 14:30:58 +0000 (17:30 +0300)]
[NFC][InstCombine] Tests for negation of sign-/zero- extensions

* sext of non-positive can be negated.
* zext of non-negative can be negated.

4 years ago[BPF] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:45:07 +0000 (14:45 +0100)]
[BPF] Remove unused forward declarations. NFC.

4 years agoBranchFolding.h - remove unused raw_ostream forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:38:04 +0000 (14:38 +0100)]
BranchFolding.h - remove unused raw_ostream forward declaration. NFC.

4 years agoRecordStreamer.h - cleanup includes and forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:36:44 +0000 (14:36 +0100)]
RecordStreamer.h - cleanup includes and forward declarations. NFC.
Reduce MCSymbol.h include to forward declaration.
Remove unused GlobalValue foward declaration.

4 years agoRuntimeDyldImpl.h - remove unused Twine forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 13:16:40 +0000 (14:16 +0100)]
RuntimeDyldImpl.h - remove unused Twine forward declaration. NFC.

4 years ago[NFC] Fix unused result of dyn_cast<VectorType> in non-assert build
Sander de Smalen [Wed, 22 Apr 2020 13:42:44 +0000 (14:42 +0100)]
[NFC] Fix unused result of dyn_cast<VectorType> in non-assert build

4 years ago[llvm-objdump][XCOFF] Print more symbol info in relocation
jasonliu [Tue, 21 Apr 2020 21:52:08 +0000 (21:52 +0000)]
[llvm-objdump][XCOFF] Print more symbol info in relocation

Summary:
Print more symbol info in relocation printing when
--symbol-description is specified.

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

4 years ago[ARM] Don't shrink STM if it would cause an unknown base register store
John Brawn [Wed, 22 Apr 2020 11:07:15 +0000 (12:07 +0100)]
[ARM] Don't shrink STM if it would cause an unknown base register store

If a 16-bit thumb STM with writeback stores the base register but it isn't the
first register in the list, then an unknown value is stored. The load/store
optimizer knows this and generates a 32-bit STM without writeback instead, but
thumb2 size reduction converts it into a 16-bit STM. Fix this by having thumb2
size reduction notice such STMs and leave them as they are.

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

4 years ago[SveEmitter] Add support for _n form builtins
Sander de Smalen [Wed, 22 Apr 2020 12:58:35 +0000 (13:58 +0100)]
[SveEmitter] Add support for _n form builtins

The ACLE has builtins that take a scalar value that is to be expanded
into a vector by the operation. While the ISA may have an instruction
that takes an immediate or a scalar to represent this, the LLVM IR
intrinsic may not, so Clang will have to splat the scalar value.

This patch also adds the _n forms for svabd, svadd, svdiv, svdivr,
svmax, svmin, svmul, svmulh, svub and svsubr.

Reviewers: SjoerdMeijer, efriedma, rovka

Reviewed By: SjoerdMeijer

Tags: #clang

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

4 years ago[AMDGPU] Fix test failures caused by dbdffe3ee9d.
Jay Foad [Wed, 22 Apr 2020 12:42:15 +0000 (13:42 +0100)]
[AMDGPU] Fix test failures caused by dbdffe3ee9d.

4 years ago[ARM] Distribute MVE post-increments
David Green [Wed, 22 Apr 2020 12:30:22 +0000 (13:30 +0100)]
[ARM] Distribute MVE post-increments

This adds some extra processing into the Pre-RA ARM load/store optimizer
to detect and merge MVE loads/stores and adds of the same base. This we
don't always turn into a post-inc during ISel, and due to the nature of
it being a graph we don't always know an order to use for the nodes, not
knowing which nodes to make post-inc and which to use the new post-inc
of. After ISel, we have an order that we can use to post-inc the
following instructions.

So this looks for a loads/store with a starting offset of 0, and an
add/sub from the same base, plus a number of other loads/stores. We then
do some checks and convert the zero offset load/store into a postinc
variant. Any loads/stores after it have the offset subtracted from their
immediates.  For example:
  LDR #4           LDR #4
  LDR #0           LDR_POSTINC #16
  LDR #8           LDR #-8
  LDR #12          LDR #-4
  ADD #16
It only handles MVE loads/stores at the moment. Normal loads/store will
be added in a followup patch, they just have some extra details to
ensure that we keep generating LDRD/LDM successfully.

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

4 years ago[AArch64][FIX] f16 indexed patterns encoding restrictions.
Pavel Iliin [Wed, 22 Apr 2020 11:34:36 +0000 (12:34 +0100)]
[AArch64][FIX] f16 indexed patterns encoding restrictions.

4 years ago[AsmPrinter] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 12:44:58 +0000 (13:44 +0100)]
[AsmPrinter] Remove unused forward declarations. NFC.

4 years agoMetadataLoader.h - remove unused MDNode forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 11:43:58 +0000 (12:43 +0100)]
MetadataLoader.h - remove unused MDNode forward declaration. NFC.

4 years ago[AsmParser] Remove unused forward declarations. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 11:41:50 +0000 (12:41 +0100)]
[AsmParser] Remove unused forward declarations. NFC.

4 years agoX86TargetMachine.h - remove unused X86RegisterBankInfo forward declaration. NFC.
Simon Pilgrim [Wed, 22 Apr 2020 11:40:39 +0000 (12:40 +0100)]
X86TargetMachine.h - remove unused X86RegisterBankInfo forward declaration. NFC.

4 years ago[InstCombine] add tests for min/max FP intrinsics with FMF (PR45478); NFC
Sanjay Patel [Wed, 22 Apr 2020 12:42:44 +0000 (08:42 -0400)]
[InstCombine] add tests for min/max FP intrinsics with FMF (PR45478); NFC

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

4 years ago[ARM] MVE FMA loop tests. NFC
David Green [Wed, 22 Apr 2020 11:40:45 +0000 (12:40 +0100)]
[ARM] MVE FMA loop tests. NFC

4 years ago[NFC][AMDGPU] Fix cmake when LLVM is a subproject
Sebastian Neubauer [Wed, 22 Apr 2020 12:01:38 +0000 (14:01 +0200)]
[NFC][AMDGPU] Fix cmake when LLVM is a subproject

CMAKE_SOURCE_DIR is not the right directory if llvm is included in
another cmake project. PROJECT_SOURCE_DIR is always the same and should
be used instead.

4 years ago[libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'
Louis Dionne [Fri, 17 Apr 2020 14:29:15 +0000 (10:29 -0400)]
[libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'

Instead of having different names for the same Lit feature accross code
bases, use the same name everywhere. This NFC commit is in preparation
for a refactor where all three projects will be using the same Lit
feature detection logic, and hence it won't be convenient to use
different names for the feature.

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

4 years ago[SveEmitter] Implement builtins for gathers/scatters
Andrzej Warzynski [Tue, 7 Apr 2020 10:09:01 +0000 (11:09 +0100)]
[SveEmitter] Implement builtins for gathers/scatters

This patch adds builtins for:
  * regular, first-faulting and non-temporal gather loads
  * regular and non-temporal scatter stores

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

4 years ago[InstCombine] Negator: shufflevector is negatible
Roman Lebedev [Wed, 22 Apr 2020 11:58:39 +0000 (14:58 +0300)]
[InstCombine] Negator: shufflevector is negatible

All these folds are correct as per alive-tv

4 years ago[NFC][InstCombine] Add shuffle negation tests
Roman Lebedev [Wed, 22 Apr 2020 11:57:57 +0000 (14:57 +0300)]
[NFC][InstCombine] Add shuffle negation tests

4 years ago[AMDGPU] Add 192-bit register classes
Jay Foad [Thu, 16 Apr 2020 16:02:19 +0000 (17:02 +0100)]
[AMDGPU] Add 192-bit register classes

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

4 years ago[AMDGPU] Add missing AReg classes
Jay Foad [Fri, 17 Apr 2020 08:25:37 +0000 (09:25 +0100)]
[AMDGPU] Add missing AReg classes

Add 96-bit, 160-bit and 256-bit AReg classes to match VReg and SReg.
NFC as far as I know, but it may avoid weird legalization problems.

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

4 years ago[libc++ testing] Fix unused variable warning turned error
David Zarzycki [Wed, 22 Apr 2020 11:45:47 +0000 (07:45 -0400)]
[libc++ testing] Fix unused variable warning turned error

4 years ago[LLD][ELF][ARM] Replace adr, ldr with .inst .reloc in test [NFC]
Peter Smith [Wed, 22 Apr 2020 10:57:13 +0000 (11:57 +0100)]
[LLD][ELF][ARM] Replace adr, ldr with .inst .reloc in test [NFC]

After D78301 MC no longer emits a relocation for this case. Change to use
.inst and .reloc to synthesize the same instruction and relocation. One
more test case I missed.

4 years ago[llvm-objdump] Look in all viable sections for call/branch targets
James Henderson [Mon, 20 Apr 2020 13:23:01 +0000 (14:23 +0100)]
[llvm-objdump] Look in all viable sections for call/branch targets

Prior to this patch, llvm-objdump would only look in the last section
(according to the section header table order) that matched an address
for a symbol when identifying the target symbol of a call or branch
operation. If there are multiple sections with the same address, due to
some of them being empty, it did not look in those, even if the symbol
couldn't be found in the first section looked in.

This patch causes llvm-objdump to look in all sections for possible
candidate symbols. If there are multiple possible symbols, it picks one
from a non-empty section, if possible (as that is more likely to be the
"real" symbol since functions can't really be in emptiy sections),
before falling back to those in empty sections. If all else fails, it
falls back to absolute symbols as it did before.

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

Reviewed by: grimar, Higuoxing

4 years ago[NFC][llvm][X86] Adding missing -mtiple to X86 test.
Lucas Prates [Wed, 22 Apr 2020 10:31:41 +0000 (11:31 +0100)]
[NFC][llvm][X86] Adding missing -mtiple to X86 test.

The modified test was missing the specification of the intended triple
in its run line, assuming X86 is the default.

4 years ago[AArch64][SVE] Add SVE intrinsic for LD1RQ
Kerry McLaughlin [Wed, 22 Apr 2020 08:38:48 +0000 (09:38 +0100)]
[AArch64][SVE] Add SVE intrinsic for LD1RQ

Summary:
Adds the following intrinsic for contiguous load & replicate:
  - @llvm.aarch64.sve.ld1rq

The LD1RQ intrinsic only needs the SImmS16XForm added by this
patch. The others (SImmS2XForm, SImmS3XForm & SImmS4XForm)
were added for consistency.

Reviewers: andwar, sdesmalen, efriedma, cameron.mcinally, dancgr, rengolin

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, cfe-commits, llvm-commits

Tags: #llvm

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

4 years agoMake some static class members constexpr
Benjamin Kramer [Wed, 22 Apr 2020 10:09:37 +0000 (12:09 +0200)]
Make some static class members constexpr

This allows them to be ODR used in C++17 mode. NFC.

4 years ago[yaml2obj] - Program headers: add an additional check for `Offset`
Georgii Rymar [Thu, 16 Apr 2020 13:41:28 +0000 (16:41 +0300)]
[yaml2obj] - Program headers: add an additional check for `Offset`

The `Offset` field is used to set the file offset of a program header.
In a normal object it should not be greater than the minimal offset
of sections included into segment.

This patch adds a check for that and adds tests.

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

4 years ago[yaml2obj] - Change how p_offset is calculated when creating segments. NFCI.
Georgii Rymar [Fri, 17 Apr 2020 12:06:04 +0000 (15:06 +0300)]
[yaml2obj] - Change how p_offset is calculated when creating segments. NFCI.

This depends on D78361 and simplifies the computation of the `p_offset`.

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

4 years ago[obj2yaml] - Fix the issue with dumping empty sections when dumping program headers.
Georgii Rymar [Tue, 7 Apr 2020 15:20:51 +0000 (18:20 +0300)]
[obj2yaml] - Fix the issue with dumping empty sections when dumping program headers.

Imagine we have:

```
ProgramHeaders:
  - Type:  PT_LOAD
    Flags: [ PF_W, PF_R ]
    Sections:
      - Section: .bar
    VAddr: 0x2000
Sections:
  - Name:    .foo
    Type:    SHT_PROGBITS
    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
    Address: 0x1000
  - Name:    .bar
    Type:    SHT_PROGBITS
    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
    Address: 0x2000
```

Both `.foo` and `.bar` share the same starting file offset,
but `VA(.foo)` < `VA(PT_LOAD)`, we should not include it into segment.

This patch fixes the issue.

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

4 years ago[ARM][MVE] Tail-predication: some more comments and debug messages. NFC.
Sjoerd Meijer [Wed, 22 Apr 2020 09:17:28 +0000 (10:17 +0100)]
[ARM][MVE] Tail-predication: some more comments and debug messages. NFC.

Finding the loop tripcount is the first crucial step in preparing a loop for
tail-predication, and this adds a debug message if a tripcount cannot be found.

And while I was at it, I added some more comments here and there.

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

4 years ago[clangd] Remove vscode plugin: now https://github.com/clangd/vscode-clangd
Sam McCall [Tue, 21 Apr 2020 23:28:49 +0000 (01:28 +0200)]
[clangd] Remove vscode plugin: now https://github.com/clangd/vscode-clangd

Summary:
Moving this out of the monorepo for consistency with other editor plugins.
There's no version lock with clangd itself, and we never ran tests with lit.

The first version from the new repo has been published.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[Driver][docs] Document option -mtune as a no-op.
Sjoerd Meijer [Wed, 22 Apr 2020 07:49:02 +0000 (08:49 +0100)]
[Driver][docs] Document option -mtune as a no-op.

This documents that option -mtune is accepted for compatibility with GCC,
currently it has no effect, and thus does not currently perform any CPU type
specific tuning.

Corresponding discussion on the cfe dev list:
http://lists.llvm.org/pipermail/cfe-dev/2020-April/065169.html

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

4 years ago[AMDGPU] Remove obsolete special case for 1024-bit vector types. NFC.
Jay Foad [Wed, 22 Apr 2020 08:05:24 +0000 (09:05 +0100)]
[AMDGPU] Remove obsolete special case for 1024-bit vector types. NFC.

4 years ago[AMDGPU] Simplify definition of VReg and AReg classes. NFC.
Jay Foad [Tue, 21 Apr 2020 10:50:49 +0000 (11:50 +0100)]
[AMDGPU] Simplify definition of VReg and AReg classes. NFC.

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

4 years ago[MLIR] Use nested symbol to identify kernel in `LaunchFuncOp`.
Frederik Gossen [Tue, 21 Apr 2020 10:16:41 +0000 (10:16 +0000)]
[MLIR] Use nested symbol to identify kernel in `LaunchFuncOp`.

Summary:
Use a nested symbol to identify the kernel to be invoked by a `LaunchFuncOp` in the GPU dialect.
This replaces the two attributes that were used to identify the kernel module and the kernel within seperately.

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

4 years ago[MLIR] Use `kernel` as a short hand for `gpu.kernel` attribute.
Frederik Gossen [Tue, 21 Apr 2020 07:11:10 +0000 (07:11 +0000)]
[MLIR] Use `kernel` as a short hand for `gpu.kernel` attribute.

Summary:
Use the shortcu `kernel` for the `gpu.kernel` attribute of `gpu.func`.
The parser supports this and test cases are easier to read.

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

4 years ago[NFC] Test changes
Sam Parker [Tue, 21 Apr 2020 14:57:28 +0000 (15:57 +0100)]
[NFC] Test changes

Add some more targets for the ARM cost model tests and add some tests
for icmps and bitcasts.

4 years ago[MLIR] Fix test case for kernel attribute.
Frederik Gossen [Tue, 21 Apr 2020 07:00:37 +0000 (07:00 +0000)]
[MLIR] Fix test case for kernel attribute.

Summary:
Fix a broken test case in the `invalid.mlir` lit test case.
`expect` was missing its `e`.

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

4 years ago[llvm] [X86] Make test more robust against different builds
aartbik [Wed, 22 Apr 2020 03:43:00 +0000 (20:43 -0700)]
[llvm] [X86] Make test more robust against different builds

Summary:
Rationale:
Using the --debug-only flag requires a debug build. Also, the debug output is not always consistent over different builds.
This change avoids all problems by just testing the generated assembly for AVX.

Reviewers: craig.topper, mehdi_amini, nicolasvasilache

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lldb] Fix modules build by adding missing include
Raphael Isemann [Wed, 22 Apr 2020 07:14:06 +0000 (09:14 +0200)]
[lldb] Fix modules build by adding missing include

This header is using FileSpec so we should at least include the forward header.

4 years ago[VE] Update shift operation instructions
Kazushi (Jam) Marukawa [Wed, 22 Apr 2020 07:09:16 +0000 (09:09 +0200)]
[VE] Update shift operation instructions

Summary:
Changing all mnemonic to match assembly instructions to simplify mnemonic
naming rules. This time update all shift operation instructions.  This also
corrects instruction's operation kinds.

Reviewed By: simoll

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

4 years ago[VE] Add alternative names to registers
Kazushi (Jam) Marukawa [Wed, 22 Apr 2020 07:07:28 +0000 (09:07 +0200)]
[VE] Add alternative names to registers

Summary:
VE uses identical names "%s0-63" to all generic registers.  Change to use
alternative name mechanism among all generic registers instead of hard-
coding them.

Reviewed By: arsenm

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

4 years ago[CallSite removal] Remove unneeded includes of CallSite.h. NFC
Craig Topper [Wed, 22 Apr 2020 07:03:59 +0000 (00:03 -0700)]
[CallSite removal] Remove unneeded includes of CallSite.h. NFC

4 years ago[MLIR] Verify there are no side-effecting ops in GenericAtomicRMWOp body.
Alexander Belyaev [Wed, 22 Apr 2020 07:02:00 +0000 (09:02 +0200)]
[MLIR] Verify there are no side-effecting ops in GenericAtomicRMWOp body.

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

4 years ago[MLIR] Add extra locking during cubin generation.
Stephan Herhut [Tue, 21 Apr 2020 19:21:37 +0000 (21:21 +0200)]
[MLIR] Add extra locking during cubin generation.

We also need to lock the LLVMDialect mutex when initializing
LLVM targets or destroying llvm modules concurrently. Added another
scoped lock to that effect.

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

4 years ago[MLIR] Update documentation for loop.parallel.
Alexander Belyaev [Tue, 21 Apr 2020 14:00:28 +0000 (16:00 +0200)]
[MLIR] Update documentation for loop.parallel.

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

4 years ago[Attributor] Replace AccessKind2Accesses map with an "array map"
Johannes Doerfert [Sat, 18 Apr 2020 01:47:38 +0000 (20:47 -0500)]
[Attributor] Replace AccessKind2Accesses map with an "array map"

The number of different access location kinds we track is relatively
small (8 so far). With this patch we replace the DenseMap that mapped
from index (0-7) to the access set pointer with an array of access set
pointers. This reduces memory consumption.

No functional change is intended.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 472499 (215654/s)
temporary memory allocations: 77794 (35506/s)
peak heap memory consumption: 35.28MB
peak RSS (including heaptrack overhead): 125.46MB
total memory leaked: 269.04KB
```

After:
```
calls to allocation functions: 472270 (308673/s)
temporary memory allocations: 77578 (50704/s)
peak heap memory consumption: 32.70MB
peak RSS (including heaptrack overhead): 121.78MB
total memory leaked: 269.04KB
```

Difference:
```
calls to allocation functions: -229 (346/s)
temporary memory allocations: -216 (326/s)
peak heap memory consumption: -2.58MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```

---

4 years ago[Attributor] Run IRPosition::verify only with EXPENSIVE_CHECKS
Johannes Doerfert [Tue, 21 Apr 2020 16:13:20 +0000 (11:13 -0500)]
[Attributor] Run IRPosition::verify only with EXPENSIVE_CHECKS

4 years ago[CallSite removal][Target] Replace CallSite with CallBase. NFC
Craig Topper [Wed, 22 Apr 2020 06:29:17 +0000 (23:29 -0700)]
[CallSite removal][Target] Replace CallSite with CallBase. NFC

In some cases just delete an unneeded include.

4 years ago[PowerPC] Exploit RLDIMI for OR with large immediates
Qiu Chaofan [Fri, 17 Apr 2020 07:08:58 +0000 (15:08 +0800)]
[PowerPC] Exploit RLDIMI for OR with large immediates

This patch exploits rldimi instruction for patterns like
`or %a, 0b000011110000`, which saves number of instructions when the
operand has only one use, compared with `li-ori-sldi-or`.

Reviewed By: nemanjai

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