platform/upstream/llvm.git
3 years agoReduce the number of memory allocations when displaying
Momchil Velikov [Mon, 7 Sep 2020 15:16:52 +0000 (16:16 +0100)]
Reduce the number of memory allocations when displaying
a warning about clobbering reserved registers (NFC).

Also address some minor inefficiencies and style issues.

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

3 years ago[analyzer][StdLibraryFunctionsChecker] Have proper weak dependencies
Gabor Marton [Mon, 7 Sep 2020 15:15:15 +0000 (17:15 +0200)]
[analyzer][StdLibraryFunctionsChecker] Have proper weak dependencies

We want the generice StdLibraryFunctionsChecker to report only if there
are no specific checkers that would handle the argument constraint for a
function.

Note, the assumptions are still evaluated, even if the arguement
constraint checker is set to not report. This means that the assumptions
made in the generic StdLibraryFunctionsChecker should be an
over-approximation of the assumptions made in the specific checkers. But
most importantly, the assumptions should not contradict.

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

3 years ago[flang] Spelling and format edits to README.txt. NFC.
Richard Barton [Mon, 7 Sep 2020 15:33:55 +0000 (16:33 +0100)]
[flang] Spelling and format edits to README.txt. NFC.

3 years ago[analyzer][StdLibraryFunctionsChecker] Add POSIX pthread handling functions
Gabor Marton [Thu, 23 Jul 2020 14:57:16 +0000 (16:57 +0200)]
[analyzer][StdLibraryFunctionsChecker] Add POSIX pthread handling functions

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

3 years ago[flang] Fix link to old repo location in doxygen mainpage. NFC.
Richard Barton [Mon, 7 Sep 2020 15:31:12 +0000 (16:31 +0100)]
[flang] Fix link to old repo location in doxygen mainpage. NFC.

3 years agoAntiDepBreaker.h - remove unnecessary ScheduleDAG.h include. NFCI.
Simon Pilgrim [Mon, 7 Sep 2020 15:39:42 +0000 (16:39 +0100)]
AntiDepBreaker.h - remove unnecessary ScheduleDAG.h include. NFCI.

3 years ago[Sparc] Add reduced funnel shift test case for PR47303
Simon Pilgrim [Mon, 7 Sep 2020 15:17:31 +0000 (16:17 +0100)]
[Sparc] Add reduced funnel shift test case for PR47303

3 years ago[X86][SSE] Don't use LowerVSETCCWithSUBUS for unsigned compare with +ve operands...
Simon Pilgrim [Mon, 7 Sep 2020 15:11:40 +0000 (16:11 +0100)]
[X86][SSE] Don't use LowerVSETCCWithSUBUS for unsigned compare with +ve operands (PR47448)

We already simplify the unsigned comparisons if we've found the operands are non-negative, but we were still calling LowerVSETCCWithSUBUS which resulted in the PR47448 regressions.

3 years ago[X86][SSE] Add test cases for PR47448
Simon Pilgrim [Mon, 7 Sep 2020 14:53:15 +0000 (15:53 +0100)]
[X86][SSE] Add test cases for PR47448

3 years ago[X86] Replace UpgradeX86AddSubSatIntrinsics with UpgradeX86BinaryIntrinsics generic...
Simon Pilgrim [Mon, 7 Sep 2020 14:31:54 +0000 (15:31 +0100)]
[X86] Replace UpgradeX86AddSubSatIntrinsics with UpgradeX86BinaryIntrinsics generic helper. NFCI.

Feed the Intrinsic::ID value directly instead of via the IsSigned/IsAddition bool flags.

3 years ago[InstCombine] erase instructions leading up to unreachable
Sanjay Patel [Mon, 7 Sep 2020 14:26:42 +0000 (10:26 -0400)]
[InstCombine] erase instructions leading up to unreachable

Normal dead code elimination ignores assume intrinsics, so we fail to
delete assumes that are not meaningful (and potentially worse if they
cause conflicts with other assumptions).

The motivating example in https://llvm.org/PR47416 suggests that we
might have problems upstream from here (difference between C and C++),
but this should be a cheap way to make sure we remove more dead code.

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

3 years ago[MLIR][Shape] Merge `shape` to `std`/`scf` lowerings.
Frederik Gossen [Mon, 7 Sep 2020 13:58:01 +0000 (13:58 +0000)]
[MLIR][Shape] Merge `shape` to `std`/`scf` lowerings.

Merge the two lowering passes because they are not useful by themselves. The new
pass lowers to `std` and `scf` is considered an auxiliary dialect.

See also
https://llvm.discourse.group/t/conversions-with-multiple-target-dialects/1541/12

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

3 years agoFollow up of rG5f1cad4d296a, slightly reduced test case. NFC.
Sjoerd Meijer [Mon, 7 Sep 2020 13:51:39 +0000 (14:51 +0100)]
Follow up of rG5f1cad4d296a, slightly reduced test case. NFC.

3 years ago[X86] Auto upgrade SSE/AVX PABS intrinsics to generic Intrinsic::abs
Simon Pilgrim [Mon, 7 Sep 2020 14:07:26 +0000 (15:07 +0100)]
[X86] Auto upgrade SSE/AVX PABS intrinsics to generic Intrinsic::abs

Minor followup to D87101, we were expanding this to a neg+icmp+select pattern like we were in CGBuiltin

3 years ago[X86][SSE] Use llvm.abs.* vector intrinsics instead of old (deprecated) SSE/AVX intri...
Simon Pilgrim [Mon, 7 Sep 2020 13:16:38 +0000 (14:16 +0100)]
[X86][SSE] Use llvm.abs.* vector intrinsics instead of old (deprecated) SSE/AVX intrinsics for combine tests

This also allows us to extend testing to SSE2+ targets

3 years ago[mlir] Take ValueRange instead of ArrayRef<Value> in StructuredIndexed
Alex Zinenko [Fri, 4 Sep 2020 08:00:52 +0000 (10:00 +0200)]
[mlir] Take ValueRange instead of ArrayRef<Value> in StructuredIndexed

This was likely overlooked when ValueRange was first introduced. There is no
reason why StructuredIndexed needs specifically an ArrayRef so use ValueRange
for better type compatibility with the rest of the APIs.

Reviewed By: nicolasvasilache, mehdi_amini

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

3 years ago[NFC][PowerPC] Add tests in constants-i64.ll.
Esme-Yi [Mon, 7 Sep 2020 13:14:00 +0000 (13:14 +0000)]
[NFC][PowerPC] Add tests in constants-i64.ll.

3 years ago[llvm-readobj] - Remove code duplication when printing dynamic relocations. NFCI.
Georgii Rymar [Mon, 7 Sep 2020 12:52:51 +0000 (15:52 +0300)]
[llvm-readobj] - Remove code duplication when printing dynamic relocations. NFCI.

LLVM style code can be simplified to avoid the duplication of logic
related to printing dynamic relocations.

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

3 years ago[KillTheDoctor/CMake] Add missing keyword PRIVATE in target_link_libraries
Daniel Muñoz [Mon, 7 Sep 2020 13:00:31 +0000 (16:00 +0300)]
[KillTheDoctor/CMake] Add missing keyword PRIVATE in target_link_libraries

Add PRIVATE keyword in target_link_libraries to prevent CMake Error on Windows.

While trying to compile llvm/clang on Windows, the following CMake error occurred. The reason is a missing PUBLIC/PRIVATE/INTERFACE keyword in target_link_libraries.

`
CMake Error at utils/KillTheDoctor/CMakeLists.txt:5 (target_link_libraries):
  The keyword signature for target_link_libraries has already been used with
  the target "KillTheDoctor".  All uses of target_link_libraries with a
  target must be either all-keyword or all-plain.

  The uses of the keyword signature are here:

   * cmake/modules/AddLLVM.cmake:771 (target_link_libraries)
`

Reviewed By: tambre

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

3 years ago[X86][SSE] Move llvm.x86.ssse3.pabs.*.128 intrinsics to ssse3-intrinsics-x86-upgrade.ll
Simon Pilgrim [Mon, 7 Sep 2020 12:53:35 +0000 (13:53 +0100)]
[X86][SSE] Move llvm.x86.ssse3.pabs.*.128 intrinsics to ssse3-intrinsics-x86-upgrade.ll

These have been auto upgraded for some time so this is just a tidyup.

3 years ago[X86] Update SSE/AVX ABS intrinsics to emit llvm.abs.* (PR46851)
Simon Pilgrim [Mon, 7 Sep 2020 12:44:35 +0000 (13:44 +0100)]
[X86] Update SSE/AVX ABS intrinsics to emit llvm.abs.* (PR46851)

We're now getting close to having the necessary analysis/combines etc. for the new generic llvm.abs.* intrinsics.

This patch updates the SSE/AVX ABS vector intrinsics to emit the generic equivalents instead of the icmp+sub+select code pattern.

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

3 years ago[gn build] Port 23f700c785a
LLVM GN Syncbot [Mon, 7 Sep 2020 12:51:23 +0000 (12:51 +0000)]
[gn build] Port 23f700c785a

3 years agoRevert "[clang] Prevent that Decl::dump on a CXXRecordDecl deserialises further decla...
Raphael Isemann [Mon, 7 Sep 2020 12:50:13 +0000 (14:50 +0200)]
Revert "[clang] Prevent that Decl::dump on a CXXRecordDecl deserialises further declarations."

This reverts commit 0478720157f6413fad7595b8eff9c70d2d99b637. This probably
doesn't work when forcing deserialising while dumping (which the ASTDumper
optionally supports).

3 years agoRevert "[MLIR][Shape] Merge `shape` to `std`/`scf` lowerings."
David Truby [Mon, 7 Sep 2020 12:37:05 +0000 (13:37 +0100)]
Revert "[MLIR][Shape] Merge `shape` to `std`/`scf` lowerings."

This reverts commit 15acdd75439b402e993ebe0dbf8eb02e9b88bbdc.

3 years ago[llvm-readobj/elf] - Generalize the code for printing dynamic relocations. NFCI.
Georgii Rymar [Mon, 7 Sep 2020 12:30:38 +0000 (15:30 +0300)]
[llvm-readobj/elf] - Generalize the code for printing dynamic relocations. NFCI.

Currently we have 2 large `printDynamicRelocations` methods that
have a very similar code for GNU/LLVM styles.

This patch removes the duplication and renames them to `printDynamicReloc`
for consistency.

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

3 years agoMachineStableHash.h - remove MachineInstr.h include. NFC.
Simon Pilgrim [Mon, 7 Sep 2020 12:20:34 +0000 (13:20 +0100)]
MachineStableHash.h - remove MachineInstr.h include. NFC.

Use forward declarations and move the include to MachineStableHash.cpp

3 years ago[X86] Replace EmitX86AddSubSatExpr with EmitX86BinaryIntrinsic generic helper. NFCI.
Simon Pilgrim [Mon, 7 Sep 2020 12:19:00 +0000 (13:19 +0100)]
[X86] Replace EmitX86AddSubSatExpr with EmitX86BinaryIntrinsic generic helper. NFCI.

Feed the Intrinsic::ID value directly instead of via the IsSigned/IsAddition bool flags.

3 years ago[SelectionDAG] memcpy expansion of const volatile struct ignores const zero
Simon Wallis [Mon, 7 Sep 2020 12:21:27 +0000 (13:21 +0100)]
[SelectionDAG] memcpy expansion of const volatile struct ignores const zero

In getMemcpyLoadsAndStores(), a memcpy where the source is a zero constant is expanded to a MemOp::Set instead of a MemOp::Copy, even when the memcpy is volatile.
This is incorrect.

The fix is to add a check for volatile, and expand to MemOp::Copy in the volatile case.

Reviewed By: chill

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

3 years ago[InstCombine] add test with more unreachable insts; NFC
Sanjay Patel [Mon, 7 Sep 2020 11:03:48 +0000 (07:03 -0400)]
[InstCombine] add test with more unreachable insts; NFC

Goes with D87149

3 years ago[InstCombine] give a name to an intermediate value for easier tracking; NFC
Sanjay Patel [Mon, 7 Sep 2020 10:53:40 +0000 (06:53 -0400)]
[InstCombine] give a name to an intermediate value for easier tracking; NFC

As noted in PR47430, we probably want to conditionally include 'nsw'
here anyway, so we are going to need to fill out the optional args.

3 years ago[MLIR] Fix Win test due to partial order of CHECK directives
Nicolas Vasilache [Mon, 7 Sep 2020 10:05:57 +0000 (06:05 -0400)]
[MLIR] Fix Win test due to partial order of CHECK directives

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

3 years ago[MLIR][Shape] Merge `shape` to `std`/`scf` lowerings.
Frederik Gossen [Mon, 7 Sep 2020 12:09:43 +0000 (12:09 +0000)]
[MLIR][Shape] Merge `shape` to `std`/`scf` lowerings.

Merge the two lowering passes because they are not useful by themselves. The new
pass lowers to `std` and `scf` is considered an auxiliary dialect.

See also
https://llvm.discourse.group/t/conversions-with-multiple-target-dialects/1541/12

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

3 years agoLegalizeTypes.h - remove orphan SplitVSETCC declaration. NFCI.
Simon Pilgrim [Mon, 7 Sep 2020 12:10:55 +0000 (13:10 +0100)]
LegalizeTypes.h - remove orphan SplitVSETCC declaration. NFCI.

The implementation no longer exists

3 years ago[llvm-readobj/elf] - Introduce Relocation<ELFT> helper.
Georgii Rymar [Fri, 4 Sep 2020 12:25:36 +0000 (15:25 +0300)]
[llvm-readobj/elf] - Introduce Relocation<ELFT> helper.

It removes templating for Elf_Rel[a] handling that we
introduced earlier and introduces a helper class instead.

It was briefly discussed in D87087, which showed,
why having templates is probably not ideal for the generalization
of dumpers code.

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

3 years agoX86AvoidStoreForwardingBlocks.cpp - use unsigned for Opcode values. NFCI.
Simon Pilgrim [Mon, 7 Sep 2020 11:56:27 +0000 (12:56 +0100)]
X86AvoidStoreForwardingBlocks.cpp - use unsigned for Opcode values. NFCI.

Fixes clang-tidy cppcoreguidelines-narrowing-conversions warnings.

3 years ago[X86][AVX] Use lowerShuffleWithPERMV in shuffle combining to support non-VLX targets
Simon Pilgrim [Mon, 7 Sep 2020 11:50:32 +0000 (12:50 +0100)]
[X86][AVX] Use lowerShuffleWithPERMV in shuffle combining to support non-VLX targets

lowerShuffleWithPERMV allows us to use the ZMM variants for 128/256-bit variable shuffles on non-VLX AVX512 targets.

This is another step towards shuffle combining through between vector widths - we still end up with an annoying regression (combine_vpermilvar_vperm2f128_zero_8f32) but we're going in the right direction....

3 years ago[obj2yaml] Add support for dumping the .debug_str section.
Xing GUO [Mon, 7 Sep 2020 11:44:46 +0000 (19:44 +0800)]
[obj2yaml] Add support for dumping the .debug_str section.

This patch adds support for dumping the .debug_str section to obj2yaml.

Reviewed By: jhenderson

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

3 years ago[MLIR][Standard] Add `dynamic_tensor_from_elements` operation
Frederik Gossen [Mon, 7 Sep 2020 11:41:27 +0000 (11:41 +0000)]
[MLIR][Standard] Add `dynamic_tensor_from_elements` operation

With `dynamic_tensor_from_elements` tensor values of dynamic size can be
created. The body of the operation essentially maps the index space to tensor
elements.

Declare SCF operations in the `scf` namespace to avoid name clash with the new
`std.yield` operation. Resolve ambiguities between `linalg/shape/std/scf.yield`
operations.

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

3 years ago[SCEV] Refactor isHighCostExpansionHelper
Sam Parker [Mon, 7 Sep 2020 10:54:05 +0000 (11:54 +0100)]
[SCEV] Refactor isHighCostExpansionHelper

To enable the cost of constants, the helper function has been
reorganised:
- A struct has been introduced to hold SCEV operand information so
  that we know the user of the operand, as well as the operand index.
  The Worklist now uses instead instead of a bare SCEV.
- The costing of each SCEV, and collection of its operands, is now
  performed in a helper function.

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

3 years ago[gn build] Port 0478720157f
LLVM GN Syncbot [Mon, 7 Sep 2020 10:32:22 +0000 (10:32 +0000)]
[gn build] Port 0478720157f

3 years ago[clang] Prevent that Decl::dump on a CXXRecordDecl deserialises further declarations.
Raphael Isemann [Mon, 7 Sep 2020 09:23:39 +0000 (11:23 +0200)]
[clang] Prevent that Decl::dump on a CXXRecordDecl deserialises further declarations.

Decl::dump is primarily used for debugging to visualise the current state of a
declaration. Usually Decl::dump just displays the current state of the Decl and
doesn't actually change any of its state, however since commit
457226e02a6e8533eaaa864a3fd7c8eeccd2bf58 the method actually started loading
additional declarations from the ExternalASTSource. This causes that calling
Decl::dump during a debugging session now actually does permanent changes to the
AST and will cause the debugged program run to deviate from the original run.

The change that caused this behaviour is the addition of
`hasConstexprDestructor` (which is called from the TextNodeDumper) which
performs a lookup into the current CXXRecordDecl to find the destructor. All
other similar methods just return their respective bit in the DefinitionData
(which obviously doesn't have such side effects).

This just changes the node printer to emit "unknown_constexpr" in case a
CXXRecordDecl is dumped that could potentially call into the ExternalASTSource
instead of the usually empty string/"constexpr". For CXXRecordDecls that can
safely be dumped the old behaviour is preserved

Reviewed By: bruno

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

3 years ago[gn build] Port 81aa66f65f5
LLVM GN Syncbot [Mon, 7 Sep 2020 10:25:26 +0000 (10:25 +0000)]
[gn build] Port 81aa66f65f5

3 years ago[X86] Unbreak the build after 22fa6b20d92e
Benjamin Kramer [Mon, 7 Sep 2020 10:24:30 +0000 (12:24 +0200)]
[X86] Unbreak the build after 22fa6b20d92e

3 years ago[X86] getFauxShuffleMask - handle insert_subvector(zero, sub, C)
Simon Pilgrim [Mon, 7 Sep 2020 10:10:40 +0000 (11:10 +0100)]
[X86] getFauxShuffleMask - handle insert_subvector(zero, sub, C)

Directly use SM_SentinelZero elements if we're (widening)inserting into a zero vector.

3 years ago[X86][AVX] Add extra vperm2f128+vpermilvar combine coverage
Simon Pilgrim [Mon, 7 Sep 2020 09:58:53 +0000 (10:58 +0100)]
[X86][AVX] Add extra vperm2f128+vpermilvar combine coverage

The existing test /should/ reduce to a vmovaps (concat xmm with zero upper).

3 years ago[X86] Use Register instead of unsigned. NFCI.
Simon Pilgrim [Mon, 7 Sep 2020 09:49:29 +0000 (10:49 +0100)]
[X86] Use Register instead of unsigned. NFCI.

Fixes llvm-prefer-register-over-unsigned clang-tidy warnings.

3 years ago[NFC][PowerPC] Add tests for `mul` with big constants.
Esme-Yi [Mon, 7 Sep 2020 09:45:47 +0000 (09:45 +0000)]
[NFC][PowerPC] Add tests for `mul` with big constants.

3 years ago[X86] Use Register instead of unsigned. NFCI.
Simon Pilgrim [Mon, 7 Sep 2020 09:30:53 +0000 (10:30 +0100)]
[X86] Use Register instead of unsigned. NFCI.

Fixes llvm-prefer-register-over-unsigned clang-tidy warnings.

3 years ago[X86] Use Register instead of unsigned. NFCI.
Simon Pilgrim [Mon, 7 Sep 2020 09:28:01 +0000 (10:28 +0100)]
[X86] Use Register instead of unsigned. NFCI.

Fixes llvm-prefer-register-over-unsigned clang-tidy warning.

3 years ago[Ignore Expressions][NFC] Refactor to better use `IgnoreExpr.h` and nits
Eduardo Caldas [Mon, 31 Aug 2020 16:03:31 +0000 (16:03 +0000)]
[Ignore Expressions][NFC] Refactor to better use `IgnoreExpr.h` and nits

This change groups
* Rename: `ignoreParenBaseCasts` -> `IgnoreParenBaseCasts` for uniformity
* Rename: `IgnoreConversionOperator` -> `IgnoreConversionOperatorSingleStep` for uniformity
* Inline `IgnoreNoopCastsSingleStep` into a lambda inside `IgnoreNoopCasts`
* Refactor `IgnoreUnlessSpelledInSource` to make adequate use of `IgnoreExprNodes`

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

3 years agoExtract infrastructure to ignore intermediate expressions into `clang/AST/IgnoreExpr.h`
Eduardo Caldas [Fri, 28 Aug 2020 11:52:54 +0000 (11:52 +0000)]
Extract infrastructure to ignore intermediate expressions into `clang/AST/IgnoreExpr.h`

Rationale:
This allows users to use `IgnoreExprNodes` and `Ignore*SingleStep` outside of
`clang/AST/Expr.cpp`.

Minor:
Rename `IgnoreImp...SingleStep`  into `IgnoreImplicit...SingleStep`.

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

3 years ago[mlir][Vector] Revisit VectorToSCF.
Nicolas Vasilache [Fri, 4 Sep 2020 15:43:00 +0000 (11:43 -0400)]
[mlir][Vector] Revisit VectorToSCF.

Vector to SCF conversion still had issues due to the interaction with the natural alignment derived by the LLVM data layout. One traditional workaround is to allocate aligned. However, this does not always work for vector sizes that are non-powers of 2.

This revision implements a more portable mechanism where the intermediate allocation is always a memref of elemental vector type. AllocOp is extended to use the natural LLVM DataLayout alignment for non-scalar types, when the alignment is not specified in the first place.

An integration test is added that exercises the transfer to scf.for + scalar lowering with a 5x5 transposition.

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

3 years ago[OpenMP][AMDGPU] Use DS_Max_Warp_Number instead of WARPSIZE
Pushpinder Singh [Thu, 3 Sep 2020 11:57:46 +0000 (07:57 -0400)]
[OpenMP][AMDGPU] Use DS_Max_Warp_Number instead of WARPSIZE

The size of worker_rootS should have been DS_Max_Warp_Number.
This reduces memory usage by deviceRTL on AMDGPU from around 2.3GB
to around 770MB.

Reviewed By: JonChesterfield, jdoerfert

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

3 years ago[clang-format] Correctly parse function declarations with TypenameMacros
Alex Richardson [Mon, 7 Sep 2020 08:29:56 +0000 (09:29 +0100)]
[clang-format] Correctly parse function declarations with TypenameMacros

When using the always break after return type setting:
Before:
SomeType funcdecl(LIST(uint64_t));
After:
SomeType
funcdecl(LIST(uint64_t));"

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Parse __underlying_type(T) as a type
Alex Richardson [Mon, 7 Sep 2020 08:29:40 +0000 (09:29 +0100)]
[clang-format] Parse __underlying_type(T) as a type

Before: MACRO(__underlying_type(A) * a);
After:  MACRO(__underlying_type(A) *a);

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Fix formatting of _Atomic() qualifier
Alex Richardson [Tue, 1 Sep 2020 17:09:07 +0000 (18:09 +0100)]
[clang-format] Fix formatting of _Atomic() qualifier

Before: _Atomic(uint64_t) * a;
After: _Atomic(uint64_t) *a;

This treats _Atomic the same as the the TypenameMacros and decltype. It
also allows some cleanup by removing checks whether the token before a
paren is kw_decltype and instead checking for TT_TypeDeclarationParen.
While touching this code also extend the decltype test cases to also check
for typeof() and _Atomic(T).

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Check that */& after typename macros are pointers/references
Alex Richardson [Mon, 7 Sep 2020 08:26:47 +0000 (09:26 +0100)]
[clang-format] Check that */& after typename macros are pointers/references

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Handle typename macros inside cast expressions
Alex Richardson [Mon, 7 Sep 2020 08:26:16 +0000 (09:26 +0100)]
[clang-format] Handle typename macros inside cast expressions

Before: x = (STACK_OF(uint64_t)) & a;
After:  x = (STACK_OF(uint64_t))&a;

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Allow configuring list of macros that map to attributes
Alex Richardson [Mon, 7 Sep 2020 08:26:05 +0000 (09:26 +0100)]
[clang-format] Allow configuring list of macros that map to attributes

This adds a `AttributeMacros` configuration option that causes certain
identifiers to be parsed like a __attribute__((foo)) annotation.
This is motivated by our CHERI C/C++ fork which adds a __capability
qualifier for pointer/reference. Without this change clang-format parses
many type declarations as multiplications/bitwise-and instead.
I initially considered adding "__capability" as a new clang-format keyword,
but having a list of macros that should be treated as attributes is more
flexible since it can be used e.g. for static analyzer annotations or other language
extensions.

Example: std::vector<foo * __capability> -> std::vector<foo *__capability>

Depends on D86775 (to apply cleanly)

Reviewed By: MyDeveloperDay, jrtc27

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

3 years ago[SimplifyCFG] Consider cost of combining predicates.
Sam Parker [Mon, 7 Sep 2020 08:08:07 +0000 (09:08 +0100)]
[SimplifyCFG] Consider cost of combining predicates.

Modify FoldBranchToCommonDest to consider the cost of inserting
instructions when attempting to combine predicates to fold blocks.
The threshold can be controlled via a new option:
-simplifycfg-branch-fold-threshold which defaults to '2' to allow
the insertion of a not and another logical operator.

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

3 years ago[GlobalISel] Extend not_cmp_fold to work on conditional expressions
Jay Foad [Thu, 27 Aug 2020 13:26:38 +0000 (14:26 +0100)]
[GlobalISel] Extend not_cmp_fold to work on conditional expressions

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

3 years ago[ARM][CostModel] CodeSize costs for i1 arith ops
Sam Parker [Tue, 25 Aug 2020 11:17:24 +0000 (12:17 +0100)]
[ARM][CostModel] CodeSize costs for i1 arith ops

When optimising for size, make the cost of i1 logical operations
relatively expensive so that optimisations don't try to combine
predicates.

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

3 years ago[DWARFYAML] Make the debug_addr section optional.
Xing GUO [Mon, 7 Sep 2020 08:16:38 +0000 (16:16 +0800)]
[DWARFYAML] Make the debug_addr section optional.

This patch makes the debug_addr section optional. When an empty
debug_addr section is specified, yaml2obj only emits a section header
for it.

Reviewed By: jhenderson

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

3 years agoAdd BinaryFormat/ELFRelocs/CSKY.def to LLVM modulemap
Raphael Isemann [Mon, 7 Sep 2020 08:14:22 +0000 (10:14 +0200)]
Add BinaryFormat/ELFRelocs/CSKY.def to LLVM modulemap

3 years ago[KnownBits] Implement accurate unsigned and signed max and min
Jay Foad [Wed, 2 Sep 2020 15:01:48 +0000 (16:01 +0100)]
[KnownBits] Implement accurate unsigned and signed max and min

Use the new implementation in ValueTracking, SelectionDAG and
GlobalISel.

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

3 years ago[cmake] Fix build of attribute plugin example on Windows
Kristina Bessonova [Mon, 7 Sep 2020 08:03:32 +0000 (10:03 +0200)]
[cmake] Fix build of attribute plugin example on Windows

Seems '${cmake_2_8_12_PRIVATE}' was removed a long time ago, so it should
be just PRIVATE keyword here.

Reviewed By: john.brawn

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

3 years ago[CMake][TableGen] Remove dead CMake version checks
Raul Tambre [Sat, 5 Sep 2020 15:05:14 +0000 (18:05 +0300)]
[CMake][TableGen] Remove dead CMake version checks

LLVM requires CMake 3.13.4, so remove version checks that are dead code.

Reviewed By: phosek

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

3 years ago[CMake][OpenMP] Remove old dead CMake code
Raul Tambre [Sat, 5 Sep 2020 15:11:34 +0000 (18:11 +0300)]
[CMake][OpenMP] Remove old dead CMake code

LLVM requires CMake 3.13.4 so remove code behind checks for an older version.

Reviewed By: phosek

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

3 years ago[CMake][Polly] Remove dead CMake code
Raul Tambre [Sat, 5 Sep 2020 15:15:32 +0000 (18:15 +0300)]
[CMake][Polly] Remove dead CMake code

LLVM requires CMake 3.13.4 so remove code behind checks for an older version.

Reviewed By: phosek

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

3 years ago[CMake][TableGen] Simplify code by using list(TRANSFORM)
Raul Tambre [Sat, 5 Sep 2020 15:21:05 +0000 (18:21 +0300)]
[CMake][TableGen] Simplify code by using list(TRANSFORM)

LLVM requires CMake 3.13.4 so now we can simplify the code.

Reviewed By: phosek

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

3 years ago[scan-view] Explicitly use utf-8 in send_string
Tomas Rix [Mon, 7 Sep 2020 07:10:15 +0000 (09:10 +0200)]
[scan-view] Explicitly use utf-8 in send_string

send_patched_file decodes with utf-8.
The default encoder for python 2 is ascii.

So it is necessary to also change send_string to use utf-8.

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

3 years ago[Sparc] Select the UltraSPARC instruction set with the external assembler
Brad Smith [Mon, 7 Sep 2020 06:27:11 +0000 (02:27 -0400)]
[Sparc] Select the UltraSPARC instruction set with the external assembler

Select the UltraSPARC instruction set with the external assembler on
Linux / FreeBSD / OpenBSD, matches GCC.

3 years agoExtend PyConcreteType to support intermediate base classes.
Stella Laurenzo [Sun, 6 Sep 2020 19:16:40 +0000 (12:16 -0700)]
Extend PyConcreteType to support intermediate base classes.

* Resolves todos from D87091.
* Also modifies PyConcreteAttribute to follow suite (should be useful for ElementsAttr and friends).
* Adds a test to ensure that the ShapedType base class functions as expected.

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

3 years agoMove NativeRegisterContextLinux/RegisterContextPOSIX*_arm to RegisterInfoAndSetInterface
Muhammad Omair Javaid [Mon, 7 Sep 2020 03:38:43 +0000 (08:38 +0500)]
Move NativeRegisterContextLinux/RegisterContextPOSIX*_arm to RegisterInfoAndSetInterface

This patch removes register set definitions and other redundant code from
NativeRegisterContextLinux/RegisterContextPOSIX*_arm. Register sets are now
moved under RegisterInfosPOSIX_arm which now uses RegisterInfoAndSetInterface.
This is similar to what we earlier did for AArch64.

Reviewed By: labath

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

3 years agoWhen dumping results of StackLifetime, it will print the following
dongAxis [Mon, 7 Sep 2020 03:43:16 +0000 (11:43 +0800)]
When dumping results of StackLifetime, it will print the following
log:

BB  [7, 8): begin {}, end {}, livein {}, liveout {}
BB  [1, 2): begin {}, end {}, livein {}, liveout {}
...

But it is not convenient to know what the basic block is.
So I add the basic block name to it.

Reviewed By: vitalybuka
TestPlan: check-llvm
Differential Revision: https://reviews.llvm.org/D87152

3 years agoMove targetHasSVE function to lldbtest.py
Muhammad Omair Javaid [Mon, 7 Sep 2020 03:35:56 +0000 (08:35 +0500)]
Move targetHasSVE function to lldbtest.py

targetHasSVE helper function was added to test for availability of SVE support
by connected platform. We now intend to use this function in other testcases
and I am moving it to a generic location in lldbtest.py to allow usage by
other upcoming testcases.

Reviewed By: labath

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

3 years ago[ELF] Add a new e_machine value EM_CSKY and add some CSKY relocation types
Zi Xuan Wu [Wed, 2 Sep 2020 09:02:17 +0000 (17:02 +0800)]
[ELF] Add a new e_machine value EM_CSKY and add some CSKY relocation types

This is the split part of D86269, which add a new ELF machine flag called EM_CSKY and related relocations.
Some target-specific flags and tests for csky can be added in follow-up patches later.

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

3 years ago[machinesink] add testcase for more sinking - NFC
Chen Zheng [Mon, 7 Sep 2020 01:14:14 +0000 (21:14 -0400)]
[machinesink] add testcase for more sinking - NFC

3 years ago[WebAssembly] Fix incorrect assumption of simple value types
Thomas Lively [Sun, 6 Sep 2020 22:42:21 +0000 (15:42 -0700)]
[WebAssembly] Fix incorrect assumption of simple value types

Fixes PR47375, in which an assertion was triggering because
WebAssemblyTargetLowering::isVectorLoadExtDesirable was improperly
assuming the use of simple value types.

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

3 years ago[PowerPC] Implement Vector Expand Mask builtins in LLVM/Clang
Amy Kwan [Thu, 3 Sep 2020 17:33:53 +0000 (12:33 -0500)]
[PowerPC] Implement Vector Expand Mask builtins in LLVM/Clang

This patch implements the vec_expandm function prototypes in altivec.h in order
to utilize the vector expand with mask instructions introduced in Power10.

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

3 years ago[asan_symbolize] Pass --demangle/--no-demangle instead of --demangle={True,False}
Fangrui Song [Sun, 6 Sep 2020 21:44:36 +0000 (14:44 -0700)]
[asan_symbolize] Pass --demangle/--no-demangle instead of --demangle={True,False}

`--demangle={True,False}` were accepted but disallowed after llvm-symbolizer's switch to OptTable.
(`--demangle={true,false}` were temporarily supported but they are case sensitive.)

3 years ago[ValueTracking] Avoid known bits fallback for non-zero get check (NFCI)
Nikita Popov [Sun, 6 Sep 2020 21:14:05 +0000 (23:14 +0200)]
[ValueTracking] Avoid known bits fallback for non-zero get check (NFCI)

The known bits fall back will never be able to infer a non-null
value here, so don't bother.

3 years ago[compiler-rt] Implement __clear_cache() on OpenBSD/arm
Brad Smith [Sun, 6 Sep 2020 19:54:24 +0000 (15:54 -0400)]
[compiler-rt] Implement __clear_cache() on OpenBSD/arm

3 years ago[DSE,MemorySSA] Add a few additional debug messages.
Florian Hahn [Sun, 6 Sep 2020 19:14:58 +0000 (20:14 +0100)]
[DSE,MemorySSA] Add a few additional debug messages.

3 years ago[mlir] Add Shaped Type, Tensor Type and MemRef Type to python bindings.
zhanghb97 [Sun, 6 Sep 2020 18:37:16 +0000 (11:37 -0700)]
[mlir] Add Shaped Type, Tensor Type and MemRef Type to python bindings.

Based on the PyType and PyConcreteType classes, this patch implements the bindings of Shaped Type, Tensor Type and MemRef Type subclasses.
The Tensor Type and MemRef Type are bound as ranked and unranked separately.
This patch adds the ***GetChecked C API to make sure the python side can get a valid type or a nullptr.
Shaped type is not a kind of standard types, it is the base class for vectors, memrefs and tensors, this patch binds the PyShapedType class as the base class of Vector Type, Tensor Type and MemRef Type subclasses.

Reviewed By: stellaraccident

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

3 years agoThread safety analysis: Improve documentation for scoped capabilities
Aaron Puchert [Sun, 6 Sep 2020 18:35:02 +0000 (20:35 +0200)]
Thread safety analysis: Improve documentation for scoped capabilities

They are for more powerful than the current documentation implies, this
adds

* adopting a lock,
* deferring a lock,
* manually unlocking the scoped capability,
* relocking the scoped capability, possibly in a different mode,
* try-relocking the scoped capability.

Also there is now a generic explanation how attributes on scoped
capabilities work. There has been confusion in the past about how to
annotate them (see e.g. PR33504), hopefully this clears things up.

Reviewed By: aaron.ballman

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

3 years agoThread safety analysis: Test and document release_generic_capability
Aaron Puchert [Sun, 6 Sep 2020 18:34:32 +0000 (20:34 +0200)]
Thread safety analysis: Test and document release_generic_capability

The old locking attributes had a generic release, but as it turns out
the capability-based attributes have it as well.

Reviewed By: aaron.ballman

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

3 years ago[SmallVector] Move error handling out of line
Benjamin Kramer [Sun, 6 Sep 2020 16:05:24 +0000 (18:05 +0200)]
[SmallVector] Move error handling out of line

This reduces duplication and avoids emitting ice cold code into every
instance of grow().

3 years ago[X86][AVX] lowerShuffleWithPERMV - adjust binary shuffle masks to account for widenin...
Simon Pilgrim [Sun, 6 Sep 2020 13:52:06 +0000 (14:52 +0100)]
[X86][AVX] lowerShuffleWithPERMV - adjust binary shuffle masks to account for widening on non-VLX targets

rGabd33bf5eff2 enabled us to pad 128/256-bit shuffles to 512-bit on non-VLX targets, but wasn't updating binary shuffles to account for the new vector width.

3 years ago[ARM] Remove -O3 from mve intrinsic tests. NFC
David Green [Sun, 6 Sep 2020 12:19:55 +0000 (13:19 +0100)]
[ARM] Remove -O3 from mve intrinsic tests. NFC

3 years ago[ARM] Regenerate tests. NFC
David Green [Sun, 6 Sep 2020 11:51:43 +0000 (12:51 +0100)]
[ARM] Regenerate tests. NFC

3 years agoAdd proper move ctor/move assign to APValue. NFCI.
Benjamin Kramer [Sun, 6 Sep 2020 11:02:11 +0000 (13:02 +0200)]
Add proper move ctor/move assign to APValue. NFCI.

Swapping 64 bytes to make a move isn't cheap.

3 years ago[InstSimplify] Fold degenerate abs of abs form
Nikita Popov [Sat, 5 Sep 2020 19:30:55 +0000 (21:30 +0200)]
[InstSimplify] Fold degenerate abs of abs form

This addresses the remaining issue from D87188. Due to a series of
folds, we may end up with abs-of-abs represented as
x == 0 ? -abs(x) : abs(x). Rather than recognizing this as a special
abs pattern and doing an abs-of-abs fold on it afterwards,
I'm directly folding this to one of the select operands in InstSimplify.

The general pattern falls into the "select with operand replaced"
category, but that fold is not powerful enough to recognize that
both hands of the select are the same for value zero.

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

3 years ago[Asan] Cleanup atomic usage in allocator
Vitaly Buka [Sun, 6 Sep 2020 07:07:14 +0000 (00:07 -0700)]
[Asan] Cleanup atomic usage in allocator

There are no know bugs related to this, still it may fix some latent ones.
Main concerns with preexisting code:
1. Inconsistent atomic/non-atomic access to the same field.
2. Assumption that bitfield chunk_state is always the first byte without
    even taking into account endianness.

Reviewed By: morehouse

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

3 years agoRevert "[Asan] Cleanup atomic usage in allocator"
Vitaly Buka [Sun, 6 Sep 2020 06:41:25 +0000 (23:41 -0700)]
Revert "[Asan] Cleanup atomic usage in allocator"

Crashes on PPC

This reverts commit eb87e1dbcfdf15c0711146ff3e6b2e1e40c8863a.

3 years ago[GlobalISel] Disable the indexed loads combine completely unless forced. NFC.
Amara Emerson [Sun, 6 Sep 2020 04:00:15 +0000 (21:00 -0700)]
[GlobalISel] Disable the indexed loads combine completely unless forced. NFC.

The post-index matcher, before it queries the target legality, walks uses
of some instructions which in pathological cases can be massive. Since
no targets actually support indexed loads yet, disable this to stop wasting
compile time on something which is going to fail anyway.

3 years ago[Asan] Cleanup atomic usage in allocator
Vitaly Buka [Sun, 6 Sep 2020 02:06:27 +0000 (19:06 -0700)]
[Asan] Cleanup atomic usage in allocator

There are no know bugs related to this, still it may fix some latent ones.
Main concerns with preexisting code:
1. Inconsistent atomic/non-atomic access to the same field.
2. Assumption that bitfield chunk_state is always the first byte without
    even taking into account endianness.

Reviewed By: morehouse

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

3 years ago[NFC][Asan] Fix clang-tidy warning
Vitaly Buka [Sun, 6 Sep 2020 02:09:41 +0000 (19:09 -0700)]
[NFC][Asan] Fix clang-tidy warning

3 years ago[NFC][Asan] Move free_tid from ChunkHeader
Vitaly Buka [Sat, 5 Sep 2020 23:52:48 +0000 (16:52 -0700)]
[NFC][Asan] Move free_tid from ChunkHeader

The goal to make chunk_state atomic, but we can't pack it with
free_tid on Windows.

3 years ago[AMDGPU] Remove the dead spill slots while spilling FP/BP to memory
vnalamot [Sun, 6 Sep 2020 01:30:36 +0000 (07:00 +0530)]
[AMDGPU] Remove the dead spill slots while spilling FP/BP to memory

During the PEI pass, the dead TargetStackID::SGPRSpill spill slots
are not being removed while spilling the FP/BP to memory.

Fixes: SWDEV-250393

Reviewed By: arsenm

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