platform/upstream/llvm.git
4 years ago[MLIR] Move eraseArguments and eraseResults to FunctionLike
mikeurbach [Thu, 22 Oct 2020 17:39:39 +0000 (11:39 -0600)]
[MLIR] Move eraseArguments and eraseResults to FunctionLike

Previously, they were only defined for `FuncOp`.

To support this, `FunctionLike` needs a way to get an updated type
from the concrete operation. This adds a new hook for that purpose,
called `getTypeWithoutArgsAndResults`.

For now, `FunctionLike` continues to assume the type is
`FunctionType`, and concrete operations that use another type can hide
the `getType`, `setType`, and `getTypeWithoutArgsAndResults` methods.

Reviewed By: rriddle

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

4 years ago[libc][NFC][Obvious] Use the new macro to declare special constants in tests.
Siva Chandra Reddy [Sun, 1 Nov 2020 05:28:44 +0000 (22:28 -0700)]
[libc][NFC][Obvious] Use the new macro to declare special constants in tests.

4 years ago[WebAssembly] Don't fold frame offset for global addresses
Julien Jorge [Mon, 2 Nov 2020 01:29:26 +0000 (17:29 -0800)]
[WebAssembly] Don't fold frame offset for global addresses

When machine instructions are in the form of
```
%0 = CONST_I32 @str
%1 = ADD_I32 %stack.0, %0
%2 = LOAD 0, 0, %1
```

In the `ADD_I32` instruction, it is possible to fold it if `%0` is a
`CONST_I32` from an immediate number. But in this case it is a global
address, so we shouldn't do that. But we haven't checked if the operand
of `ADD` is an immediate so far. This fixes the problem. (The case
applies the same for `ADD_I64` and `CONST_I64` instructions.)

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

Patch by Julien Jorge (jjorge@quarkslab.com)

Reviewed By: dschuff

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

4 years ago[mlir][vector] Make linalg FillOp vectorization use Transfer op
Thomas Raoux [Tue, 3 Nov 2020 22:35:26 +0000 (14:35 -0800)]
[mlir][vector] Make linalg FillOp vectorization use Transfer op

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

4 years ago[ARM] remove cost-kind predicate for most math op costs
Sanjay Patel [Tue, 3 Nov 2020 22:06:21 +0000 (17:06 -0500)]
[ARM] remove cost-kind predicate for most math op costs

This is based on the same idea that I am using for the basic model implementation
and what I have partly already done for x86: throughput cost is number of
instructions/uops, so size/blended costs are identical except in special cases
(for example, fdiv or other known-expensive machine instructions or things like
MVE that may require cracking into >1 uop)).

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

4 years agoRemove extra comma after macro, fix GCC warning (NFC)
Mehdi Amini [Tue, 3 Nov 2020 22:21:39 +0000 (22:21 +0000)]
Remove extra comma after macro, fix GCC warning (NFC)

4 years ago[MLIR] NFC : Move OpenMP dialect include to translation
Kiran Chandramohan [Tue, 3 Nov 2020 17:42:05 +0000 (17:42 +0000)]
[MLIR] NFC : Move OpenMP dialect include to translation

The OpenMP dialect include is only needed for translation
and is not required in LLVM dialect.

Reviewed By: ftynse

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

4 years agoWhen re-checking an already-substituted template argument, don't lose
Richard Smith [Tue, 3 Nov 2020 22:02:56 +0000 (14:02 -0800)]
When re-checking an already-substituted template argument, don't lose
the reference-ness of the parameter's type.

4 years agoUndo Revert "Ignore template instantiations if not in AsIs mode"
Matt Morehouse [Tue, 3 Nov 2020 21:59:01 +0000 (13:59 -0800)]
Undo Revert "Ignore template instantiations if not in AsIs mode"

MaskRay already fixed the ASan bug.

4 years agoRevert "Ignore template instantiations if not in AsIs mode"
Matt Morehouse [Tue, 3 Nov 2020 19:48:07 +0000 (11:48 -0800)]
Revert "Ignore template instantiations if not in AsIs mode"

This reverts commit 53df3beb624989ed32d87697d0c17601d7871465 due to
check-asan failure on the buildbot.

4 years ago[docs] Fix docs-llvm-html after recent TableGen changes D90617
Fangrui Song [Tue, 3 Nov 2020 21:43:24 +0000 (13:43 -0800)]
[docs] Fix docs-llvm-html after recent TableGen changes D90617

4 years ago[libc++][NFC] Mark LWG issue 2899 as not complete.
zoecarver [Tue, 3 Nov 2020 21:35:12 +0000 (13:35 -0800)]
[libc++][NFC] Mark LWG issue 2899 as not complete.

Commit 59e26308e60a08a5a4534ba827744564c71d7aff accidentally
marked this LWG issue as complete but it has not yet been
implemented. D66262 fixes this issue.

4 years ago[LIBC][NFC] Rename errno and assert files to match other files with functions
Michael Jones [Mon, 2 Nov 2020 23:16:00 +0000 (23:16 +0000)]
[LIBC][NFC] Rename errno and assert files to match other files with functions

Rename the files containing the `__errno_location` function
to `__errno_location.h/cpp` to match the other files and move
the `llvmlibc_errno` macro to its own file.

Split assert.h into `__assert_fail.h` (contains the function prototype)
and assert.h (contains the assert macro).

Reviewed By: sivachandra

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

4 years ago[NFC] Fix call to lldb RegisterValue constructor
Jordan Rupprecht [Tue, 3 Nov 2020 21:24:06 +0000 (13:24 -0800)]
[NFC] Fix call to lldb RegisterValue constructor

4 years ago[mlir][Parser] Small optimization to parsing
River Riddle [Tue, 3 Nov 2020 20:31:24 +0000 (12:31 -0800)]
[mlir][Parser] Small optimization to parsing

* Use function_ref instead of std::function in several methods
* Use ::get instead of ::getChecked for IntegerType.
  - It is already fully verified and constructing a mlir::Location can be extremely costly during parsing.

4 years ago[PowerPC] Add MMA builtin decoding and definitions
Baptiste Saleil [Tue, 3 Nov 2020 21:08:00 +0000 (15:08 -0600)]
[PowerPC] Add MMA builtin decoding and definitions

Add MMA builtin decoding. These builtins use the new PowerPC-specific types __vector_pair and __vector_quad.
So to avoid pervasive changes, we use custom type descriptors and custom decoding for these builtins.
We also use custom code generation to expand builtin calls with pointers to simpler intrinsic calls with non-pointer types.

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

4 years ago[NFC] Inline wasm assertion-only variable
Jordan Rupprecht [Tue, 3 Nov 2020 21:06:52 +0000 (13:06 -0800)]
[NFC] Inline wasm assertion-only variable

4 years ago[libc++] Harden tests against executors not running tests in a shell
Louis Dionne [Tue, 3 Nov 2020 19:44:47 +0000 (14:44 -0500)]
[libc++] Harden tests against executors not running tests in a shell

Some executors do not run the tests in a shell, and so assuming that
they can understand shell builtins is wrong. Instead, call Bash
directly to do what we need to do.

This still requires the executor to be able to run Bash, but at least
it does not require it to interpret command lines in the Bash language.

4 years ago[lldb] [test] Update XFAILs/skips for FreeBSD
Michał Górny [Tue, 3 Nov 2020 18:25:48 +0000 (19:25 +0100)]
[lldb] [test] Update XFAILs/skips for FreeBSD

Update expected failures and test skips based on common results
for the old and new FreeBSD plugins.

4 years ago[lldb] [test/Shell] Pass -pthread to host toolchain on FreeBSD too
Michał Górny [Tue, 3 Nov 2020 18:25:16 +0000 (19:25 +0100)]
[lldb] [test/Shell] Pass -pthread to host toolchain on FreeBSD too

4 years ago[lldb] [test] Remove xfail from tests that pass on FreeBSD
Michał Górny [Tue, 3 Nov 2020 17:46:10 +0000 (18:46 +0100)]
[lldb] [test] Remove xfail from tests that pass on FreeBSD

4 years ago[OpenMP] Fixed an issue in the test case parallel_offloading_map
Shilei Tian [Tue, 3 Nov 2020 20:59:05 +0000 (15:59 -0500)]
[OpenMP] Fixed an issue in the test case parallel_offloading_map

There is a non-conforming use of variable-sized array in the test case `parallel_offloading_map.c`. This patch fixed it.

Reviewed By: protze.joachim

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

4 years ago[clangd] Fix missing override warnings in remote-index client
Kadir Cetinkaya [Tue, 3 Nov 2020 20:46:44 +0000 (21:46 +0100)]
[clangd] Fix missing override warnings in remote-index client

4 years ago[clangd] Handle absolute/relative path specifications in Config
Kadir Cetinkaya [Tue, 27 Oct 2020 22:03:41 +0000 (23:03 +0100)]
[clangd] Handle absolute/relative path specifications in Config

This introduces a mechanism for providers to interpret paths specified
in a fragment either as absolute or relative to fragment location.
This information should be used during compile stage to handle blocks correctly.

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

4 years ago[libc++] Remove support for .run.fail.cpp tests
Louis Dionne [Tue, 3 Nov 2020 20:24:00 +0000 (15:24 -0500)]
[libc++] Remove support for .run.fail.cpp tests

Unfortunately, executing these tests correctly on platforms that do not
support a shell is very challenging. Since the executor can't just negate
the result of the command, we'd have to ship a portable program capable
of running the actual test executable, and negating its result.

Doing this portably is challenging. Since we do not currently have strong
use cases for tests that fail at runtime (we effectively have no tests
using that capability right now), it is difficult to justify making them
work portably. Instead, it makes more sense to remove this feature until
we can implement it properly (i.e. without requiring shell support).

4 years ago[unittest][TrasnformerTest] Fix asan stack-use-after-return
Fangrui Song [Tue, 3 Nov 2020 20:34:45 +0000 (12:34 -0800)]
[unittest][TrasnformerTest] Fix asan stack-use-after-return

4 years ago[libc++] NFC: Simplify how we run config tests
Louis Dionne [Tue, 3 Nov 2020 19:37:42 +0000 (14:37 -0500)]
[libc++] NFC: Simplify how we run config tests

We can use the convenience substitutions provided by the format instead
of bootstrapping our own.

4 years ago[crashlog] Print the actual exception in the CommandReturnObject
Jonas Devlieghere [Tue, 3 Nov 2020 19:49:59 +0000 (11:49 -0800)]
[crashlog] Print the actual exception in the CommandReturnObject

Before:

  error: python exception <class 'AttributeError'>

After:

  error: python exception: 'DarwinImage' object has no attribute 'debugger'

4 years ago[musttail] Unify musttail call preceding return checking
Xun Li [Tue, 3 Nov 2020 19:39:27 +0000 (11:39 -0800)]
[musttail] Unify musttail call preceding return checking

There is already an API in BasicBlock that checks and returns the musttail call if it precedes the return instruction.
Use it instead of manually checking in each place.

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

4 years ago[compiler-rt] Use empty SuspendedThreadsList for Fuchsia
Petr Hosek [Tue, 3 Nov 2020 18:41:17 +0000 (10:41 -0800)]
[compiler-rt] Use empty SuspendedThreadsList for Fuchsia

d48f2d7 made destructor of SuspendedThreadsList protected, so we need
an empty subclass to pass to the callback now.

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

4 years ago[memprof] Don't protect destructor in final
Vitaly Buka [Tue, 3 Nov 2020 19:27:04 +0000 (11:27 -0800)]
[memprof] Don't protect destructor in final

4 years ago[Reassociate] Convert `add`-like `or`'s into an `add`'s to allow reassociation
Roman Lebedev [Tue, 3 Nov 2020 19:01:22 +0000 (22:01 +0300)]
[Reassociate] Convert `add`-like `or`'s into an `add`'s to allow reassociation

InstCombine is quite aggressive in doing the opposite transform,
folding `add` of operands with no common bits set into an `or`,
and that not many things support that new pattern..

In this case, teaching Reassociate about it is easy,
there's preexisting art for `sub`/`shl`:
just convert such an `or` into an `add`:
https://rise4fun.com/Alive/Xlyv

4 years ago[NFC][Reassociate] Add tests with `add`-like `or` (w/ no common bits set)
Roman Lebedev [Tue, 3 Nov 2020 18:24:13 +0000 (21:24 +0300)]
[NFC][Reassociate] Add tests with `add`-like `or` (w/ no common bits set)

4 years ago[mlir][vector] Add canonicalization patterns for ExtractStride/ShapeCast + Splat...
Thomas Raoux [Tue, 3 Nov 2020 18:56:22 +0000 (10:56 -0800)]
[mlir][vector] Add canonicalization patterns for ExtractStride/ShapeCast + Splat constant

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

4 years agoRevert "Precommit LTO pipeline test"
Sanne Wouda [Tue, 3 Nov 2020 19:29:14 +0000 (19:29 +0000)]
Revert "Precommit LTO pipeline test"

This reverts commit 5a72a1623e4afd9365a13473079db1ec66af1f0e.

4 years agoRevert "Add loop distribution to the LTO pipeline"
Sanne Wouda [Tue, 3 Nov 2020 19:29:00 +0000 (19:29 +0000)]
Revert "Add loop distribution to the LTO pipeline"

This reverts commit 6e80318eecde2639faa1e72be045c78b8b8aedad.

4 years ago[AMDGPU] Add some missing tests for GFX10.3 subtargets
Jay Foad [Tue, 3 Nov 2020 19:17:27 +0000 (19:17 +0000)]
[AMDGPU] Add some missing tests for GFX10.3 subtargets

4 years agoFix - [Clang] Add the ability to map DLL storage class to visibility
Ben Dunbobbin [Tue, 3 Nov 2020 18:54:57 +0000 (18:54 +0000)]
Fix - [Clang] Add the ability to map DLL storage class to visibility

415f7ee883 had a silly typo introduced when I inlined some
code into a loop from its own function.

Original commit message:

For PlayStation we offer source code compatibility with
Microsoft's dllimport/export annotations; however, our file
format is based on ELF.

To support this we translate from DLL storage class to ELF
visibility at the end of codegen in Clang.

Other toolchains have used similar strategies (e.g. see the
documentation for this ARM toolchain:

https://developer.arm.com/documentation/dui0530/i/migrating-from-rvct-v3-1-to-rvct-v4-0/changes-to-symbol-visibility-between-rvct-v3-1-and-rvct-v4-0)

This patch adds the ability to perform this translation. Options
are provided to support customizing the mapping behaviour.

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

4 years agoAdd loop distribution to the LTO pipeline
Sanne Wouda [Wed, 21 Oct 2020 11:01:59 +0000 (11:01 +0000)]
Add loop distribution to the LTO pipeline

The LoopDistribute pass is missing from the LTO pipeline, so
-enable-loop-distribute has no effect during post-link. The pre-link
loop distribution doesn't seem to survive the LTO pipeline either.

With this patch (and -flto -mllvm -enable-loop-distribute) we see a 43%
uplift on SPEC 2006 hmmer for AArch64. The rest of SPECINT 2006 is
unaffected.

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

4 years agoPrecommit LTO pipeline test
Sanne Wouda [Wed, 21 Oct 2020 19:27:47 +0000 (19:27 +0000)]
Precommit LTO pipeline test

4 years agoReturn actual type from SBType::GetArrayElementType
Andy Yankovsky [Tue, 3 Nov 2020 18:32:42 +0000 (10:32 -0800)]
Return actual type from SBType::GetArrayElementType

SBType::GetArrayElementType should return the actual type, not the
canonical type (e.g. int32_t, not the underlying int).

Added a test case to validate the new behavior. I also ran all other
tests on Linux (ninja check-lldb), they all pass.

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

4 years ago[WebAssembly] Implement ref.null
Andy Wingo [Tue, 3 Nov 2020 18:46:23 +0000 (10:46 -0800)]
[WebAssembly] Implement ref.null

This patch adds a new "heap type" operand kind to the WebAssembly MC
layer, used by ref.null. Currently the possible values are "extern" and
"func"; when typed function references come, though, this operand may be
a type index.

Note that the "heap type" production is still known as "refedtype" in
the draft proposal; changing its name in the spec is
ongoing (https://github.com/WebAssembly/reference-types/issues/123).

The register form of ref.null is still untested.

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

4 years ago[HIP] Math Headers to use type promotion
Aaron En Ye Shi [Wed, 28 Oct 2020 17:51:55 +0000 (17:51 +0000)]
[HIP] Math Headers to use type promotion

Similar to libcxx implementation of cmath function
overloads, use type promotion templates to determine
return types of multi-argument math functions.

Fixes: SWDEV-256825

Reviewed By: tra, yaxunl

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

4 years ago[HIP] Use argv[0] as the default choice for the Executable name.
Artem Belevich [Thu, 29 Oct 2020 22:19:06 +0000 (15:19 -0700)]
[HIP] Use argv[0] as the default choice for the Executable name.

The path produced by getMainExecutable() may not be the right one when the files are installed in
a symlinked tree and when the real location of llvm-objdump is in a different directory.

Given that clang-offload-bundler is invoked by clang, the driver already does the job figuring out
the right path (e.g. it pays attention to -no-canonical-prefixes).
Offload bundler should use it, instead of trying to figure out the path on its
own.

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

4 years ago[CUDA] Allow local static variables with target attributes.
Artem Belevich [Fri, 25 Sep 2020 23:25:27 +0000 (16:25 -0700)]
[CUDA] Allow local static variables with target attributes.

While CUDA documentation claims that such variables are not allowed[1], NVCC has
been accepting them since CUDA-10.0[2] and some headers in CUDA-11 rely on this
working.

1. https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#static-variables-function
2. https://godbolt.org/z/zsodzc

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

4 years ago[GVN] small improvements to comments
Jameson Nash [Tue, 3 Nov 2020 18:17:52 +0000 (13:17 -0500)]
[GVN] small improvements to comments

4 years ago[crashlog] Modularize parser
Jonas Devlieghere [Tue, 3 Nov 2020 18:21:00 +0000 (10:21 -0800)]
[crashlog] Modularize parser

Instead of parsing the crashlog in one big loop, use methods that
correspond to the different parsing modes.

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

4 years agoCleanup namespace comment to fix clang-tidy warning. NFCI.
Simon Pilgrim [Tue, 3 Nov 2020 18:13:21 +0000 (18:13 +0000)]
Cleanup namespace comment to fix clang-tidy warning. NFCI.

4 years ago[DAG] computeKnownBits - Move ISD::SRA handling into KnownBits::ashr
Simon Pilgrim [Tue, 3 Nov 2020 18:09:15 +0000 (18:09 +0000)]
[DAG] computeKnownBits - Move ISD::SRA handling into KnownBits::ashr

As discussed on D90527, we should be trying to move shift handling functionality into KnownBits to avoid code duplication in SelectionDAG/GlobalISel/ValueTracking.

4 years ago[RISCV] Add missing patterns for rotr with immediate for Zbb/Zbp extensions.
Craig Topper [Tue, 3 Nov 2020 17:33:06 +0000 (09:33 -0800)]
[RISCV] Add missing patterns for rotr with immediate for Zbb/Zbp extensions.

DAGCombine doesn't canonicalize rotl/rotr with immediate so we
need patterns for both.

Remove the custom matcher for rotl to RORI and just use a SDNodeXForm
to convert the immediate instead. Doing this gives priority to the
rev32/rev16 versions of grevi over rori since an explicit immediate
is more precise than any immediate. I also added rotr patterns for
rev32/rev16. And removed the (or (shl), (shr)) patterns that should be
combined to rotl by DAG combine.

There is at least one other grev pattern that probably needs a
another rotr pattern, but we need more test coverage first.

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

4 years ago[DAG] computeKnownBits - Move (most) ISD::SRL handling into KnownBits::lshr
Simon Pilgrim [Tue, 3 Nov 2020 17:30:17 +0000 (17:30 +0000)]
[DAG] computeKnownBits - Move (most) ISD::SRL handling into KnownBits::lshr

As discussed on D90527, we should be be trying to move shift handling functionality into KnownBits to avoid code duplication in SelectionDAG/GlobalISel/ValueTracking.

The refactor to use the KnownBits fixed/min/max constant helpers allows us to hit a couple of cases that we were missing before.

We still need the getValidMinimumShiftAmountConstant case as KnownBits doesn't handle per-element vector cases.

4 years ago[AMDGPU] Regenerate load i16 tests to use update_llc_test_checks.py script. NFCI.
Simon Pilgrim [Tue, 3 Nov 2020 16:50:18 +0000 (16:50 +0000)]
[AMDGPU] Regenerate load i16 tests to use update_llc_test_checks.py script. NFCI.

Necessary for upcoming KnownBits::lshr support.

4 years ago[libc++] Move <memory> helpers outside of std::allocator_traits
Louis Dionne [Tue, 3 Nov 2020 17:05:55 +0000 (12:05 -0500)]
[libc++] Move <memory> helpers outside of std::allocator_traits

They don't really belong as members of allocator_traits.

4 years ago[crashlog] Move crash log parsing into its own class
Jonas Devlieghere [Tue, 3 Nov 2020 04:29:32 +0000 (20:29 -0800)]
[crashlog] Move crash log parsing into its own class

Move crash log parsing out of the CrashLog class and into its own class
and add more tests.

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

4 years agoMake test/tools/llvm-dlltool/tool-name.test pass, and make it run
Nico Weber [Tue, 3 Nov 2020 16:55:22 +0000 (11:55 -0500)]
Make test/tools/llvm-dlltool/tool-name.test pass, and make it run

The test hasn't run since it was added in D71302.

4 years ago[NFC][AMDGPU] Minor editorial improvements to AMDGPUUsage.rst
Tony [Tue, 3 Nov 2020 02:14:45 +0000 (02:14 +0000)]
[NFC][AMDGPU] Minor editorial improvements to AMDGPUUsage.rst

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

4 years ago[compiler-rt][profile][AIX]: Enable compiler-rt profile build on AIX
etiotto [Tue, 3 Nov 2020 16:44:18 +0000 (11:44 -0500)]
[compiler-rt][profile][AIX]: Enable compiler-rt profile build on AIX

This patch adds support for building the compiler-rt profile library on AIX.

Reviewed by: phosek

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

4 years agoRevert "[PowerPC] Extend folding RLWINM + RLWINM to post-RA."
Esme-Yi [Tue, 3 Nov 2020 16:34:02 +0000 (16:34 +0000)]
Revert "[PowerPC] Extend folding RLWINM + RLWINM to post-RA."

This reverts commit 119ab2181e6ed823849c93d55af8e989c28c9f3c.

4 years ago[AMDGPU] Add gfx1033 target
Tim Renouf [Fri, 30 Oct 2020 08:21:12 +0000 (08:21 +0000)]
[AMDGPU] Add gfx1033 target

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

Change-Id: If2650fc7f31bbdd49c76e74a9ca8e3734d769761

4 years ago[AMDGPU] Add gfx90c target
Tim Renouf [Tue, 6 Oct 2020 17:23:59 +0000 (18:23 +0100)]
[AMDGPU] Add gfx90c target

This differentiates the Ryzen 4000/4300/4500/4700 series APUs that were
previously included in gfx909.

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

Change-Id: Ia901a7157eb2f73ccd9f25dbacec38427312377d

4 years ago[lldb] [Process/FreeBSDRemote] Fix "Fix attaching via lldb-server"
Michał Górny [Tue, 3 Nov 2020 14:00:58 +0000 (15:00 +0100)]
[lldb] [Process/FreeBSDRemote] Fix "Fix attaching via lldb-server"

One of the changes seems to have been lost in rebase.  Reapply.

4 years ago[openmp][openacc][NFC] Simplify access and validation of DirectiveBase information
Valentin Clement [Tue, 3 Nov 2020 16:12:14 +0000 (11:12 -0500)]
[openmp][openacc][NFC] Simplify access and validation of DirectiveBase information

This patch adds some helper in the DirectiveLanguage wrapper to initialize it from
the RecordKeeper and validate the records. This simplify arguments in lots of function
since only the DirectiveLanguge is passed.

Reviewed By: kiranchandramohan

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

4 years ago[CostModel] fix cost calc bug for sadd/ssub with overflow
Sanjay Patel [Tue, 3 Nov 2020 15:41:52 +0000 (10:41 -0500)]
[CostModel] fix cost calc bug for sadd/ssub with overflow

As noted in D90554, there's an opcode typo in using an easily
misused cost model API: getCmpSelInstrCost(). Beyond that, the
assumed sequence of ops is questionable, but that would be
another patch.

My guess is that the x86 test diffs show that we are probably
wrong both before and after this change, so there will be no
practical difference.
As an example, I tried this test which shows a cost of '7'
either way:

  define <4 x i32> @sadd(<4 x i32> %va, <4 x i32> %vb) {
    %V4I32  = call {<4 x i32>, <4 x i1>}  @llvm.sadd.with.overflow.v4i32(<4 x i32> %va, <4 x i32> %vb)
    %ov = extractvalue {<4 x i32>, <4 x i1>} %V4I32, 1
    %r = extractvalue {<4 x i32>, <4 x i1>} %V4I32, 0
    %z = select <4 x i1> %ov, <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32> %r
    ret <4 x i32> %z
  }

  $ llc -o - sadd.ll -mattr=avx
        vpaddd  %xmm1, %xmm0, %xmm2
        vpcmpgtd        %xmm2, %xmm0, %xmm0
        vpxor   %xmm0, %xmm1, %xmm0
        vblendvps       %xmm0, LCPI0_0(%rip), %xmm2, %xmm0a

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

4 years agoFix GCC error: specialization of 'template<class LeafTy> struct llvm::LinearPolyBaseT...
Hans Wennborg [Tue, 3 Nov 2020 15:55:12 +0000 (16:55 +0100)]
Fix GCC error: specialization of 'template<class LeafTy> struct llvm::LinearPolyBaseTypeTraits' in different namespace

4 years ago[OpenMP][Tools] clang-format Archer (NFC)
Joachim Protze [Tue, 3 Nov 2020 15:31:50 +0000 (16:31 +0100)]
[OpenMP][Tools] clang-format Archer (NFC)

4 years ago[SVE][InstCombine] Improve specificity of InstCombine TypeSize test
Joe Ellis [Tue, 3 Nov 2020 15:24:41 +0000 (15:24 +0000)]
[SVE][InstCombine] Improve specificity of InstCombine TypeSize test

The test was using -O2, where -instcombine will suffice.

Reviewed By: sdesmalen

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

4 years ago[AMDGPU] Fix ds_read2/write2 with unaligned offsets
Jay Foad [Mon, 2 Nov 2020 13:05:15 +0000 (13:05 +0000)]
[AMDGPU] Fix ds_read2/write2 with unaligned offsets

These instructions use a scaled offset. We were wrongly selecting them
even when the required offset was not a multiple of the scale factor.

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

4 years ago[libcxx] Error out if __libcpp_mbsrtowcs_l fails in __time_get_storage
Martin Storsjö [Mon, 28 Oct 2019 21:46:34 +0000 (23:46 +0200)]
[libcxx] Error out if __libcpp_mbsrtowcs_l fails in __time_get_storage

If __libcpp_mbsrtowcs_l outputs zero wchar_t's for week days or
month names (due to errors in the locale function setup), these are
matched all the time in __time_get_storage::__analyze, ending up in
an infinite loop, allocating more memory until killed.

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

4 years ago[libcxx] [libcxxabi] Set flags for visibility when statically linking libcxxabi into...
Martin Storsjö [Fri, 23 Oct 2020 07:54:02 +0000 (10:54 +0300)]
[libcxx] [libcxxabi] Set flags for visibility when statically linking libcxxabi into libcxx for windows

Previously, these had to be set manually when building each of the
projects standalone, in order to get proper symbol visibility when
combining the two libraries.

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

4 years ago[lldb/Utility] Add unit tests for RegisterValue::GetScalarValue
Pavel Labath [Mon, 7 Sep 2020 07:33:58 +0000 (09:33 +0200)]
[lldb/Utility] Add unit tests for RegisterValue::GetScalarValue

Buggy cases are commented out.

Also sneak in a modernization of a RegisterValue constructor.

4 years ago[Docs][FileCheck] Small fix.
Mircea Trofin [Tue, 3 Nov 2020 15:08:51 +0000 (07:08 -0800)]
[Docs][FileCheck] Small fix.

4 years agomake the AsmPrinterHandler array public
Jameson Nash [Tue, 3 Nov 2020 13:54:51 +0000 (08:54 -0500)]
make the AsmPrinterHandler array public

This lets external consumers customize the output, similar to how
AssemblyAnnotationWriter lets the caller define callbacks when printing
IR. The array of handlers already existed, this just cleans up the code
so that it can be exposed publically.

Replaces https://reviews.llvm.org/D74158

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

4 years ago[ADT] Add SmallVector::pop_back_n
Nathan James [Tue, 3 Nov 2020 14:57:08 +0000 (14:57 +0000)]
[ADT] Add SmallVector::pop_back_n

Adds a method called pop_back_n to SmallVector.
This is more readable and less error prone than the alternatives of using
```lang=c++
Vector.resize(Vector.size() - N);
Vector.erase(Vector.end() - N, Vector.end());
for (unsigned I = 0;I<N;++I) Vector.pop_back();
```

Reviewed By: dblaikie

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

4 years ago[SLP][X86][Test] Extend test coverage for PR47629
Anton Afanasyev [Tue, 3 Nov 2020 14:40:41 +0000 (17:40 +0300)]
[SLP][X86][Test] Extend test coverage for PR47629

Add two cases for `<i32 x 8>`. Precommit for PR47629 and D90445. NFC

4 years ago[AMDGPU] Precommit globalisel tests for ds_read2_b64 with large offset
Jay Foad [Tue, 3 Nov 2020 14:24:44 +0000 (14:24 +0000)]
[AMDGPU] Precommit globalisel tests for ds_read2_b64 with large offset

4 years ago[ASTMatchers] Made isExpandedFromMacro Polymorphic
Nathan James [Tue, 3 Nov 2020 14:36:50 +0000 (14:36 +0000)]
[ASTMatchers] Made isExpandedFromMacro Polymorphic

Made the isExpandedFromMacro matcher work on Stmt's, TypeLocs and Decls in line with the other macro expansion matchers.
Also tweaked it to take a `std::string` instead of a `StringRef`.
This prevents potential use-after-free bugs if the matcher is created with a string thats destroyed before the matcher finishes matching.

Reviewed By: aaron.ballman

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

4 years ago[DAG] computeKnownBits - Move (most) ISD::SHL handling into KnownBits::shl
Simon Pilgrim [Tue, 3 Nov 2020 13:49:00 +0000 (13:49 +0000)]
[DAG] computeKnownBits - Move (most) ISD::SHL handling into KnownBits::shl

As discussed on D90527, we should be be trying to move shift handling functionality into KnownBits to avoid code duplication in SelectionDAG/GlobalISel/ValueTracking.

The refactor to use the KnownBits fixed/min/max constant helpers allows us to hit a couple of cases that we were missing before.

We still need the getValidMinimumShiftAmountConstant case as KnownBits doesn't handle per-element vector cases.

4 years ago[gn build] Port 1667d23e585
LLVM GN Syncbot [Tue, 3 Nov 2020 13:58:51 +0000 (13:58 +0000)]
[gn build] Port 1667d23e585

4 years ago[gn build] (manually) port 1af3cb5424d
Nico Weber [Tue, 3 Nov 2020 13:58:23 +0000 (08:58 -0500)]
[gn build] (manually) port 1af3cb5424d

4 years ago[AMDGPU] Specify a triple to avoid codegen changes depending on host OS
Jay Foad [Tue, 3 Nov 2020 13:31:59 +0000 (13:31 +0000)]
[AMDGPU] Specify a triple to avoid codegen changes depending on host OS

4 years ago[mlir][spirv] Support for a few more decorations in (de)serialization
Lei Zhang [Tue, 3 Nov 2020 13:10:56 +0000 (08:10 -0500)]
[mlir][spirv] Support for a few more decorations in (de)serialization

Reviewed By: mravishankar

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

4 years ago[x86] update cost table comments for maxnum; NFC
Sanjay Patel [Tue, 3 Nov 2020 12:55:55 +0000 (07:55 -0500)]
[x86] update cost table comments for maxnum; NFC

Follow-up suggested in D90613.

4 years ago[CUDA][HIP] Fix linkage for -fgpu-rdc
Yaxun (Sam) Liu [Wed, 28 Oct 2020 14:44:21 +0000 (10:44 -0400)]
[CUDA][HIP] Fix linkage for -fgpu-rdc

Currently for explicit template function instantiation in CUDA/HIP device
compilation clang emits instantiated kernel with external linkage
and instantiated device function with internal linkage.

This is fine for -fno-gpu-rdc since there is only one TU.

However this causes duplicate symbols for kernels for -fgpu-rdc if
the same instantiation happen in multiple TU. Or missing symbols
if a device function calls an explicitly instantiated template function
in a different TU.

To make explicit template function instantiation work for
-fgpu-rdc we need to follow the C++ linkage paradigm, i.e.
use weak_odr linkage.

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

4 years ago[InstCombine] Perform C-(X+C2) --> (C-C2)-X transform before using Negator
Roman Lebedev [Tue, 3 Nov 2020 12:32:31 +0000 (15:32 +0300)]
[InstCombine] Perform  C-(X+C2) --> (C-C2)-X  transform before using Negator

In particular, it makes it fire for C=0, because negator doesn't want
to perform that fold since in general it's not beneficial.

4 years ago[InstCombine] Negator: - (C - %x) --> %x - C (PR47997)
Roman Lebedev [Tue, 3 Nov 2020 10:34:38 +0000 (13:34 +0300)]
[InstCombine] Negator: - (C - %x) --> %x - C (PR47997)

This relaxes one-use restriction on that `sub` fold,
since apparently the addition of Negator broke
preexisting `C-(C2-X) --> X+(C-C2)` (with C=0) fold.

4 years ago[NFC][InstCombine] Negator: add test coverage for `(?? - (%y + C))` pattern (PR47997)
Roman Lebedev [Tue, 3 Nov 2020 11:06:42 +0000 (14:06 +0300)]
[NFC][InstCombine] Negator: add test coverage for `(?? - (%y + C))` pattern (PR47997)

4 years ago[NFC][InstCombine] Negator: add test coverage for `(?? - (C - %y))` pattern (PR47997)
Roman Lebedev [Tue, 3 Nov 2020 11:04:36 +0000 (14:04 +0300)]
[NFC][InstCombine] Negator: add test coverage for `(?? - (C - %y))` pattern (PR47997)

4 years ago[NFC][InstCombine] Add test coverage for PR47997
Roman Lebedev [Tue, 3 Nov 2020 10:18:20 +0000 (13:18 +0300)]
[NFC][InstCombine] Add test coverage for PR47997

4 years ago[SCCP] Handle bitcast of vector constants.
Florian Hahn [Tue, 3 Nov 2020 10:32:38 +0000 (10:32 +0000)]
[SCCP] Handle bitcast of vector constants.

Vectors where all elements have the same known constant range are treated as a
single constant range in the lattice. When bitcasting such vectors, there is a
mis-match between the width of the lattice value (single constant range) and
the original operands (vector). Go to overdefined in that case.

Fixes PR47991.

4 years ago[ARM] Remove unused variable. NFC
David Green [Tue, 3 Nov 2020 12:58:10 +0000 (12:58 +0000)]
[ARM] Remove unused variable. NFC

4 years ago[OpenMP][libomptarget][Tests] fix failing test
Joachim Protze [Tue, 3 Nov 2020 11:31:05 +0000 (12:31 +0100)]
[OpenMP][libomptarget][Tests] fix failing test

D88149 updated `omp_get_initial_device` behavior to conform with OpenMP 5.1.
omp_get_initial_device() == omp_get_num_devices()

4 years ago[OpenMP][OMPT][NFC] Fix flaky test
Joachim Protze [Mon, 2 Nov 2020 15:43:12 +0000 (16:43 +0100)]
[OpenMP][OMPT][NFC] Fix flaky test

As reported by @ronlieb, the test shows intermittent fails.
The test failed, if the dependent task was already finished, when the depending
task was to be created. We have other tests to check for the dependences pair.

4 years ago[OpenMP][Tool] Handle detached tasks in Archer
Joachim Protze [Fri, 30 Oct 2020 08:36:07 +0000 (09:36 +0100)]
[OpenMP][Tool] Handle detached tasks in Archer

Since detached tasks are supported by clang and the OpenMP runtime, Archer
must expect to receive the corresponding callbacks.

This patch adds support to interpret the synchronization semantics of
omp_fulfill_event and cleans up the handling of task switches.

4 years agoRevert "[CodeGen] [WinException] Only produce handler data at the end of the function...
Hans Wennborg [Tue, 3 Nov 2020 12:01:55 +0000 (13:01 +0100)]
Revert "[CodeGen] [WinException] Only produce handler data at the end of the function if needed"

This caused an explosion in ICF times during linking on Windows when libfuzzer
instrumentation is enabled. For a small binary we see ICF time go from ~0 to
~10 s. For a large binary it goes from ~1 s to forevert (I gave up after 30
minutes).

See comment on the code review.

> If we are going to write handler data (that is written as variable
> length data following after the unwind info in .xdata), we need to
> emit the handler data immediately, but for cases where no such
> info is going to be written, skip emitting it right away. (Unwind
> info for all remaining functions that hasn't gotten it emitted
> directly is emitted at the end.)
>
> This does slightly change the ordering of sections (triggering a
> bunch of updates to DebugInfo/COFF tests), but the change should be
> benign.
>
> This also matches GCC's assembly output, which doesn't output
> .seh_handlerdata unless it actually is needed.
>
> For ARM64, the unwind info can be packed into the runtime function
> entry itself (leaving no data in the .xdata section at all), but
> that can only be done if there's no follow-on data in the .xdata
> section. If emission of the unwind info is triggered via
> EmitWinEHHandlerData (or the .seh_handlerdata directive), which
> implicitly switches to the .xdata section, there's a chance of the
> caller wanting to pass further data there, so the packed format
> can't be used in that case.
>
> Differential Revision: https://reviews.llvm.org/D87448

This reverts commit 36c64af9d7f97414d48681b74352c9684077259b.

4 years ago[JITLink][ELF] Implement R_X86_64_PLT32 relocations
Stefan Gränitz [Tue, 3 Nov 2020 12:05:38 +0000 (12:05 +0000)]
[JITLink][ELF] Implement R_X86_64_PLT32 relocations

Basic implementation for call and jmp branches with 32 bit offset. Branches to local targets produce
Branch32 edges that are resolved like a regular PCRel32 relocations. Branches to external (undefined)
targets produce Branch32ToStub edges and go through a PLT entry by default. If the target happens to
get resolved within the 32 bit range from the callsite, the edge is relaxed during post-allocation
optimization. There is a test for each of these cases.

Reviewed By: lhames

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

4 years ago[clang-tidy] adding "--config-file=<file-path>" to specify custom config file.
Hiral Oza [Tue, 3 Nov 2020 10:11:44 +0000 (10:11 +0000)]
[clang-tidy] adding "--config-file=<file-path>" to specify custom config file.

Let clang-tidy to read config from specified file.
Example:
$ clang-tidy --config-file=/some/path/myTidyConfig --list-checks --
...this will read config from '/some/path/myTidyConfig'.

ClangTidyMain.cpp reads ConfigFile into string and then assigned read data to 'Config' i.e. makes like '--config' code flow internally.

May speed-up tidy runtime since now it will just look-up <file-path>
instead of searching ".clang-tidy" in parent-dir(s).

Directly specifying config path helps setting build dependencies.

Thanks to @DmitryPolukhin for valuable suggestion. This patch now propose
change only in ClangTidyMain.cpp.

Reviewed By: DmitryPolukhin

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

4 years agoFix 'default label in switch which covers all enumeration values' warning
serge-sans-paille [Tue, 3 Nov 2020 11:57:44 +0000 (12:57 +0100)]
Fix 'default label in switch which covers all enumeration values' warning

4 years ago[ARM] Treat memcpy/memset/memmove as call instructions for low overhead loops
David Green [Tue, 3 Nov 2020 11:53:09 +0000 (11:53 +0000)]
[ARM] Treat memcpy/memset/memmove as call instructions for low overhead loops

If an instruction will be lowered to a call there is no advantage of
using a low overhead loop as the LR register will need to be spilled and
reloaded around the call, and the low overhead will end up being
reverted. This teaches our hardware loop lowering that these memory
intrinsics will be calls under certain situations.

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

4 years ago[ARM] Low overhead loop memcpy lowering test. NFC
David Green [Tue, 3 Nov 2020 11:44:50 +0000 (11:44 +0000)]
[ARM] Low overhead loop memcpy lowering test. NFC

4 years ago[AArch64][SVE] NFC: Guard all SVE tests for TypeSize warnings.
Sander de Smalen [Tue, 3 Nov 2020 10:25:06 +0000 (10:25 +0000)]
[AArch64][SVE] NFC: Guard all SVE tests for TypeSize warnings.

This patch adds a bunch of CHECK lines to guard against implicit
conversions of TypeSize -> uint64_t occuring in code-paths that previously
were safe for scalable vectors.