platform/upstream/llvm.git
3 years ago[libc] Fix the overflow check condition of ldexp.
Siva Chandra Reddy [Wed, 18 Nov 2020 15:30:29 +0000 (07:30 -0800)]
[libc] Fix the overflow check condition of ldexp.

Targeted tests have been added.

Reviewed By: lntue

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

3 years ago[NFC][TFUtils] also include output specs lookup logic in loadOutputSpecs
Mircea Trofin [Thu, 19 Nov 2020 04:54:04 +0000 (20:54 -0800)]
[NFC][TFUtils] also include output specs lookup logic in loadOutputSpecs

The lookup logic is also reusable.

Also refactored the API to return the loaded vector - this makes it more
clear what state it is in in the case of error (as it won't be
returned).

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

3 years ago[Transforms] Use llvm::is_contained (NFC)
Kazu Hirata [Thu, 19 Nov 2020 04:42:22 +0000 (20:42 -0800)]
[Transforms] Use llvm::is_contained (NFC)

3 years ago[NFC][TFUtils] Extract out the output spec loader
Mircea Trofin [Thu, 19 Nov 2020 00:16:10 +0000 (16:16 -0800)]
[NFC][TFUtils] Extract out the output spec loader

It's generic for the 'development mode', not specific to the inliner
case.

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

3 years ago[RISCV] Add MemOperand to the instruction created by storeRegToStackSlot/loadRegFromS...
Craig Topper [Thu, 19 Nov 2020 02:23:55 +0000 (18:23 -0800)]
[RISCV] Add MemOperand to the instruction created by storeRegToStackSlot/loadRegFromStackSlot

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

3 years ago[mlir][Pass] Only enable/disable CrashRecovery once
River Riddle [Thu, 19 Nov 2020 02:49:23 +0000 (18:49 -0800)]
[mlir][Pass] Only enable/disable CrashRecovery once

This prevents potential problems that occur when multiple pass managers register crash recovery contexts.

3 years ago[mlir] Add support for referencing a SymbolRefAttr in a SideEffectInstance
River Riddle [Thu, 19 Nov 2020 02:31:40 +0000 (18:31 -0800)]
[mlir] Add support for referencing a SymbolRefAttr in a SideEffectInstance

This allows for operations that exclusively affect symbol operations to better describe their side effects.

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

3 years ago[X86][AArch64][RISCV] Pre-commit negated abs test case. NFC.
Kai Luo [Thu, 19 Nov 2020 02:22:09 +0000 (02:22 +0000)]
[X86][AArch64][RISCV] Pre-commit negated abs test case. NFC.

3 years ago[trace][intel-pt] Scaffold the 'thread trace start | stop' commands
Walter Erquinigo [Tue, 27 Oct 2020 04:22:06 +0000 (21:22 -0700)]
[trace][intel-pt] Scaffold the 'thread trace start | stop' commands

Depends on D90490.

The stop command is simple and invokes the new method Trace::StopTracingThread(thread).

On the other hand, the start command works by delegating its implementation to a CommandObject provided by the Trace plugin. This is necessary because each trace plugin needs different options for this command. There's even the chance that a Trace plugin can't support live tracing, but instead supports offline decoding and analysis, which means that "thread trace dump instructions" works but "thread trace start" doest. Because of this and a few other reasons, it's better to have each plugin provide this implementation.

Besides, I'm using the GetSupportedTraceType method introduced in D90490 to quickly infer what's the trace plug-in that works for the current process.

As an implementation note, I moved CommandObjectIterateOverThreads to its header so that I can use it from the IntelPT plugin. Besides, the actual start and stop logic for intel-pt is not part of this diff.

Reviewed By: clayborg

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

3 years ago[clang-tidy] Extend bugprone-string-constructor-check to std::string_view.
Chris Kennelly [Sat, 7 Nov 2020 21:38:30 +0000 (16:38 -0500)]
[clang-tidy] Extend bugprone-string-constructor-check to std::string_view.

This allows for matching the constructors std::string has in common with
std::string_view.

Reviewed By: aaron.ballman

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

3 years agoSupport: Avoid SmallVector::assign with a range from to-be-replaced vector in Windows...
Duncan P. N. Exon Smith [Thu, 19 Nov 2020 01:53:34 +0000 (17:53 -0800)]
Support: Avoid SmallVector::assign with a range from to-be-replaced vector in Windows GetExecutableName

This code wasn't valid, and 5abf76fbe37380874a88cc9aa02164800e4e10f3
started asserting. This is a speculative fix since I don't have a
Windows machine handy.

3 years agoADT: Add assertions to SmallVector::insert, etc., for reference invalidation
Duncan P. N. Exon Smith [Fri, 13 Nov 2020 23:29:32 +0000 (18:29 -0500)]
ADT: Add assertions to SmallVector::insert, etc., for reference invalidation

2c196bbc6bd897b3dcc1d87a3baac28e1e88df41 asserted that
`SmallVector::push_back` doesn't invalidate the parameter when it needs
to grow. Do the same for `resize`, `append`, `assign`, `insert`, and
`emplace_back`.

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

3 years ago[mlir][sparse] remove a few rewriting failures
Aart Bik [Wed, 18 Nov 2020 23:35:57 +0000 (15:35 -0800)]
[mlir][sparse] remove a few rewriting failures

Rationale:
Make sure preconditions are tested already during verfication.
Currently, the only way a sparse rewriting rule can fail is if
(1) the linalg op does not have sparse annotations, or
(2) a yet to be handled operation is encounted inside the op

Reviewed By: penpornk

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

3 years ago[WebAssembly] Support fp reg class in r constraint
snek [Wed, 18 Nov 2020 18:23:01 +0000 (10:23 -0800)]
[WebAssembly] Support fp reg class in r constraint

Patch by snek

Reviewed By: aheejin

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

3 years agoAdded GDB pretty printer for StringMap
Moritz Sichert [Wed, 18 Nov 2020 23:36:06 +0000 (15:36 -0800)]
Added GDB pretty printer for StringMap

Reviewed By: csigg, dblaikie

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

3 years ago[hwasan] Fix Thread reuse (try 2).
Evgenii Stepanov [Thu, 12 Nov 2020 23:14:48 +0000 (15:14 -0800)]
[hwasan] Fix Thread reuse (try 2).

HwasanThreadList::DontNeedThread clobbers Thread::next_,
Breaking the freelist. As a result, only the top of the freelist ever
gets reused, and the rest of it is lost.

Since the Thread object with its associated ring buffer is only 8Kb, this is
typically only noticable in long running processes, such as fuzzers.

Fix the problem by switching from an intrusive linked list to a vector.

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

3 years ago[NPM] Remove -enable-npm-optnone flag
Arthur Eubanks [Wed, 18 Nov 2020 22:21:24 +0000 (14:21 -0800)]
[NPM] Remove -enable-npm-optnone flag

It has been on by default for a couple months without complaint.

Reviewed By: asbirlea

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

3 years ago[YAMLIO] Support non-null-terminated inputs
Scott Linder [Mon, 16 Nov 2020 19:05:06 +0000 (19:05 +0000)]
[YAMLIO] Support non-null-terminated inputs

In some places the parser guards against dereferencing `End`, while in
others it relies on the presence of a trailing `'\0'` to elide checks.

Add the remaining guards needed to ensure the parser never attempts to
dereference `End`, making it safe to not require a null-terminated input
buffer.

Update the parser fuzzer harness so that it tests with buffers that are
guaranteed to be non-null-terminated, null-terminated, and 1-terminated,
additionally ensuring the result of the parse is the same in each case.

Some of the regression tests were written by inspection, and some are
cases caught by the fuzzer which required additional fixes in the
parser.

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

3 years ago[YAMLIO] Add a generic YAML fuzzer harness
Scott Linder [Mon, 16 Nov 2020 14:44:35 +0000 (14:44 +0000)]
[YAMLIO] Add a generic YAML fuzzer harness

This is essentially a clone of the existing fuzzer added in D50839, but
for the whole parser Streamer, and currently only testing for sanitizer
violations.

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

3 years ago[VE] Add vmv intrinsic instructions
Kazushi (Jam) Marukawa [Sat, 14 Nov 2020 22:58:17 +0000 (07:58 +0900)]
[VE] Add vmv intrinsic instructions

Add vmv intrinsic instructions and regression tests.

Reviewed By: simoll

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

3 years ago[MachO] Update embedded part of ObjectFileMachO for Mangled API change
Jonas Devlieghere [Wed, 18 Nov 2020 22:46:26 +0000 (14:46 -0800)]
[MachO] Update embedded part of ObjectFileMachO for Mangled API change

Mangled::GetName and Mangled::GetDemangledName no longer take any
arguments.

3 years ago[tsan] Add pthread_cond_clockwait interceptor
Vitaly Buka [Wed, 18 Nov 2020 07:43:08 +0000 (23:43 -0800)]
[tsan] Add pthread_cond_clockwait interceptor

Disable the test on old systems.
pthread_cond_clockwait is supported by glibc-2.30.
It also supported by Android api 30 even though we
do not run tsan on Android.

Fixes https://github.com/google/sanitizers/issues/1259

Reviewed By: dvyukov

3 years ago[gn build] (manually) merge f0785c1f7ac
Nico Weber [Wed, 18 Nov 2020 22:17:01 +0000 (17:17 -0500)]
[gn build] (manually) merge f0785c1f7ac

3 years ago[mlir][Affine] Refactor affine fusion code in pass to utilities
Diego Caballero [Wed, 18 Nov 2020 21:24:39 +0000 (13:24 -0800)]
[mlir][Affine] Refactor affine fusion code in pass to utilities

Refactoring/clean-up step needed to add support for producer-consumer fusion
with multi-store producer loops and, in general, to implement more general
loop fusion strategies in Affine. It introduces the following changes:
  - AffineLoopFusion pass now uses loop fusion utilities more broadly to compute
    fusion legality (canFuseLoops utility) and perform the fusion transformation
    (fuseLoops utility).
  - Loop fusion utilities have been extended to deal with AffineLoopFusion
    requirements and assumptions while preserving both loop fusion utilities and
    AffineLoopFusion current functionality within a unified implementation.
    'FusionStrategy' has been introduced for this purpose and, in the future, it
    will allow us to have a single loop fusion core implementation that will produce
    different fusion outputs depending on the strategy used.
  - Improve separation of concerns for legality and profitability analysis:
    'isFusionProfitable' no longer filters out illegal scenarios that 'canFuse'
    didn't detect, or the other way around. 'canFuse' now takes loop dependences
    into account to determine the fusion loop depth (producer-consumer fusion only).
  - As a result, maximal fusion now doesn't require any profitability analysis.
  - Slices are now computed only once and reused across the legality, profitability
    and fusion transformation steps (producer-consumer).
  - Refactor some utilities and remove redundant copies of them.

This patch is NFCI and should preserve the existing functionality of both the
AffineLoopFusion pass and the affine fusion utilities.

Reviewed By: andydavis1, bondhugula

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

3 years agoFix assert on valid due to incorrect assumption that a field name must
Richard Smith [Wed, 18 Nov 2020 22:03:14 +0000 (14:03 -0800)]
Fix assert on valid due to incorrect assumption that a field name must
be unique in its scope.

3 years ago[RISCV] Use register class VR for V instruction operands directly.
Hsiangkai Wang [Wed, 18 Nov 2020 13:22:03 +0000 (21:22 +0800)]
[RISCV] Use register class VR for V instruction operands directly.

@tangxingxin1008 found a bug that regard vadd.vv v1, v3, a0 as a valid V
instruction. We should remove the VRegAsmOperand operand class and use
VR register class directly.

Patched by: tangxingxin1008, Hsiangkai
Differential Revision: https://reviews.llvm.org/D91712

3 years ago[libc++] Clarify how we pick the typeinfo comparison
Louis Dionne [Mon, 16 Nov 2020 23:13:43 +0000 (18:13 -0500)]
[libc++] Clarify how we pick the typeinfo comparison

This commit makes it clear that the typeinfo comparison implementation
is automatically selected by default, and that the CMake option only
overrides the value. This has been a source of confusion and bugs ever
since we've introduced complexity in that area, so I'm trying to simplify
it while still allowing for some control on the implementation.

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

3 years ago[flang] Correct handling of null pointer initializers
peter klausler [Tue, 17 Nov 2020 21:15:34 +0000 (13:15 -0800)]
[flang] Correct handling of null pointer initializers

Fortran defines "null-init" null pointer initializers as
being function references, syntactically, that have to resolve
to calls to the intrinsic function NULL() with no actual
arguments.

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

3 years ago[flang] Improve error message on bad LOGICAL compare operations
Peter Steinfeld [Wed, 18 Nov 2020 20:38:29 +0000 (12:38 -0800)]
[flang] Improve error message on bad LOGICAL compare operations

When comparing LOGICAL operands using ".eq." or ".ne." we were not
guiding users to the ".eqv." and ".neqv." operations.

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

3 years agoMCExpr::evaluateAsRelocatableImpl : allow evaluation of non-VK_None MCSymbolRefExpr...
Fangrui Song [Wed, 18 Nov 2020 21:52:33 +0000 (13:52 -0800)]
MCExpr::evaluateAsRelocatableImpl : allow evaluation of non-VK_None MCSymbolRefExpr when MCAsmLayout is available

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4acf8c78e659833be8be047ba2f8561386a11d4b
(1994) introduced this behavior:
if a fixup symbol is equated to an expression with an undefined symbol, convert
the fixup to be against the target symbol. glibc relies on this behavior to perform
assembly level indirection

```
asm("memcpy = __GI_memcpy"); // from sysdeps/generic/symbol-hacks.h

...
  // call memcpy@PLT
  // The relocation references __GI_memcpy in GNU as, but memcpy in MC (without the patch)
  memcpy (...);
```

(1) It complements `extern __typeof(memcpy) memcpy asm("__GI_memcpy");` The frontend asm label does not redirect synthesized memcpy in the middle-end. (See D88712 for details)
(2) `asm("memcpy = __GI_memcpy");` is in every translation unit, but the memcpy declaration may not be visible in the translation unit where memcpy is synthesized.

MC already redirects `memcpy = __GI_memcpy; call memcpy` but not `memcpy = __GI_memcpy; call memcpy@plt`.
This patch fixes the latter by allowing MCExpr::evaluateAsRelocatableImpl to
evaluate a non-VK_None MCSymbolRefExpr, which is only done after the layout is available.

GNU as allows `memcpy = __GI_memcpy+1; call memcpy@PLT` which seems nonsensical, so we don't allow it.

`MC/PowerPC/pr38945.s` `NUMBER = 0x6ffffff9; cmpwi 8,NUMBER@l` requires the
`symbol@l` form in AsmMatcher, so evaluation needs to be deferred. This is the
place whether future simplification may be possible.

Note, if we suppress the VM_None evaluation when MCAsmLayout is nullptr, we may
lose the `invalid reassignment of non-absolute variable` diagnostic
(`ARM/thumb_set-diagnostics.s` and `MC/AsmParser/variables-invalid.s`).
We know that this diagnostic is troublesome in some cases
(https://github.com/ClangBuiltLinux/linux/issues/1008), so we can consider
making simplification in the future.

Reviewed By: jyknight

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

3 years ago[NPM] Add implicit basic-aa before other AA
Arthur Eubanks [Wed, 18 Nov 2020 21:44:06 +0000 (13:44 -0800)]
[NPM] Add implicit basic-aa before other AA

This matches the legacy AA infra and fixes
llvm/test/ANalysis/TypeBasedAliasAnalysis/precedence.ll under NPM.

3 years ago[GWP-ASan] Port tests to Fuchsia
Kostya Kortchinsky [Mon, 16 Nov 2020 23:34:14 +0000 (15:34 -0800)]
[GWP-ASan] Port tests to Fuchsia

This modifies the tests so that they can be run on Fuchsia:
- add the necessary includes for `set`/`vector` etc
- do the few modifications required to use zxtest instead og gtest

`backtrace.cpp` requires stacktrace support that Fuchsia doesn't have
yet, and `enable_disable.cpp` currently uses `fork()` which Fuchsia
doesn't support yet. I'll revisit this later.

I chose to use `harness.h` to hold my "platform-specific" include and
namespace, and using this header in tests rather than `gtest.h`,
which I am open to change if someone would rather go another direction.

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

3 years ago[libcxx] Port to NuttX (https://nuttx.apache.org) RTOS
Xiang Xiao [Wed, 18 Nov 2020 21:16:18 +0000 (16:16 -0500)]
[libcxx] Port to NuttX (https://nuttx.apache.org) RTOS

Since NuttX conform to POSIX standard, the code need to add is very simple.

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

3 years agoRevert "Revert "Revert "Expand existing loopsink testing to also test loopsinking...
Jamie Schmeiser [Wed, 18 Nov 2020 21:07:16 +0000 (16:07 -0500)]
Revert "Revert "Revert "Expand existing loopsink testing to also test loopsinking using new pass manager and fix LICM bug."""

This reverts commit e29292969b92aa15afba734d4f6863fc405f087c.

This apparently causes a regression in compile time (ie, it slows down).

3 years ago[OpenMP] Add Support for Mapping Names in Libomptarget RTL
Joseph Huber [Wed, 18 Nov 2020 20:38:25 +0000 (15:38 -0500)]
[OpenMP] Add Support for Mapping Names in Libomptarget RTL

Summary:
This patch adds basic support for priting the source location and names for the mapped variables. This patch does not support names for custom mappers. This is based on D89802.

Reviewers: jdoerfert

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

3 years ago[PowerPC] Add peephole to remove redundant accumulator prime/unprime instructions
Baptiste Saleil [Wed, 18 Nov 2020 20:58:28 +0000 (14:58 -0600)]
[PowerPC] Add peephole to remove redundant accumulator prime/unprime instructions

In some situations, the compiler may insert an accumulator prime instruction and
an accumulator unprime instruction with no use of that accumulator between the two.
That's for example the case when we store an accumulator after assembling it or
restoring it. This patch adds a peephole to remove these prime and unprime instructions.

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

3 years ago[NFC][Reassociate] Delay checking isLoadCombineCandidate() until after ShouldConvertO...
Roman Lebedev [Wed, 18 Nov 2020 20:18:36 +0000 (23:18 +0300)]
[NFC][Reassociate] Delay checking isLoadCombineCandidate() until after ShouldConvertOrWithNoCommonBitsToAdd() but before haveNoCommonBitsSet()

This appears to improve -O3 compile-time performance somewhat:
https://llvm-compile-time-tracker.com/compare.php?from=87369c626114ae17f4c637635c119e6de0856a9a&to=c04b8271e1609b0dfb20609b40844b0c4324517e&stat=instructions
It doesn't look like delaying it until after haveNoCommonBitsSet() is better:
https://llvm-compile-time-tracker.com/compare.php?from=c04b8271e1609b0dfb20609b40844b0c4324517e&to=b2943d450eaf41b5f76d2dc7350f0a279f64cd99&stat=instructions

3 years ago[NFC][AMDGPU] Remove some generic pointers in memory-legalizer tests
Scott Linder [Wed, 18 Nov 2020 20:52:17 +0000 (20:52 +0000)]
[NFC][AMDGPU] Remove some generic pointers in memory-legalizer tests

These tests implicitly depend on the target supporting generic pointers,
so to prepare for testing them on GFX6 (which lacks FLAT) remove the
dependency where possible.

Reviewed By: rampitec

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

3 years ago[BasicAA] Generalize base offset modulus handling
Nikita Popov [Sun, 8 Nov 2020 08:48:38 +0000 (09:48 +0100)]
[BasicAA] Generalize base offset modulus handling

The GEP aliasing implementation currently has two pieces of code
that solve two different subsets of the same basic problem: If you
have GEPs with offsets 4*x + 0 and 4*y + 1 (assuming access size 1),
then they do not alias regardless of whether x and y are the same.

One implementation is in aliasSameBasePointerGEPs(), which looks at
this in a limited structural way. It requires both GEP base pointers
to be exactly the same, then (optionally) a number of equal indexes,
then an unknown index, then a non-equal index into a struct. This
set of limitations works, but it's overly restrictive and hides the
core property we're trying to exploit.

The second implementation is part of aliasGEP() itself and tries to
find a common modulus in the scales, so it can then check that the
constant offset doesn't overlap under modular arithmetic. The second
implementation has the right idea of what the general problem is,
but effectively only considers power of two factors in the scales
(while aliasSameBasePointerGEPs also works with non-pow2 struct sizes.)

What this patch does is to adjust the aliasGEP() implementation to
instead find the largest common factor in all the scales (i.e. the GCD)
and use that as the modulus.

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

3 years ago[test] Fix eliminate-callsite-inline.ll under NPM
Arthur Eubanks [Wed, 18 Nov 2020 20:39:39 +0000 (12:39 -0800)]
[test] Fix eliminate-callsite-inline.ll under NPM

The NPM inliner does not remove arbitrary unused internal functions, and
that is not the point of this test.

3 years ago[test] Fix remaining GVN tests under NPM
Arthur Eubanks [Wed, 18 Nov 2020 20:31:55 +0000 (12:31 -0800)]
[test] Fix remaining GVN tests under NPM

Some used analyses are optional but were relied upon in tests, the
legacy PM runs them in a different order than the NPM.

3 years agoRevert "Revert "Expand existing loopsink testing to also test loopsinking using new...
Jamie Schmeiser [Wed, 18 Nov 2020 20:33:02 +0000 (15:33 -0500)]
Revert "Revert "Expand existing loopsink testing to also test loopsinking using new pass manager and fix LICM bug.""

This reverts commit 562addba652e8bdabe49f9123fd92c21b7a0d640.

Reverted change too quickly, the failing test cases passed on the next build.
So reverting revert (to include the changes).

3 years ago[ConstraintElimination] Decompose add nuw/sub nuw.
Florian Hahn [Wed, 18 Nov 2020 11:25:39 +0000 (11:25 +0000)]
[ConstraintElimination] Decompose add nuw/sub nuw.

Make use of the more flexible constraint handling added in
a8a79c90699a7ae9dee07daf7281cbbd592bf6ea to decompose add nuw/sub nuw.

3 years ago[OpenMP] Add Passing in Original Declaration Names To Mapper API
Joseph Huber [Fri, 13 Nov 2020 18:06:41 +0000 (13:06 -0500)]
[OpenMP] Add Passing in Original Declaration Names To Mapper API

Summary:
This patch adds support for passing in the original delcaration name in the source file to the libomptarget runtime. This will allow the runtime to provide more intelligent debugging messages. This patch takes the original expression parsed from the OpenMP map / update clause and provides a textual representation if it was explicitly mapped, otherwise it takes the name of the variable declaration as a fallback. The information in passed to the runtime in a global array of strings that matches the existing ident_t source location strings using ";name;filename;column;row;;"

Reviewers: jdoerfert

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

3 years ago[Inline] Fix incorrectly dropped noalias metadata
Nikita Popov [Wed, 18 Nov 2020 20:08:54 +0000 (21:08 +0100)]
[Inline] Fix incorrectly dropped noalias metadata

This is the same fix as 23aeadb89df38406dc4d929d08286f7ce31040eb,
just for CloneScopedAliasMetadata rather than PropagateCallSiteMetadata.

In this case the previous outcome was incorrectly dropped metadata,
as it was not part of the computed metadata map.

The real change in the test is that the first load now retains
metadata, the rest of the changes are due to changes in metadata
numbering.

3 years ago[Inline] Expand test to show dropped metadata (NFC)
Nikita Popov [Wed, 18 Nov 2020 20:01:56 +0000 (21:01 +0100)]
[Inline] Expand test to show dropped metadata (NFC)

The metadata from the %c load gets dropped.

3 years agoRevert "Expand existing loopsink testing to also test loopsinking using new pass...
Jamie Schmeiser [Wed, 18 Nov 2020 20:17:53 +0000 (15:17 -0500)]
Revert "Expand existing loopsink testing to also test loopsinking using new pass manager and fix LICM bug."

This reverts commit d4ba28bddc89a14885218b9eaa4fbf6654c2a5bd.

3 years agoRevert "[tsan] Add pthread_cond_clockwait interceptor"
Wolfgang Pieb [Wed, 18 Nov 2020 18:15:43 +0000 (10:15 -0800)]
Revert "[tsan] Add pthread_cond_clockwait interceptor"

This reverts commit 16eb853ffdd1a1ad7c95455b7795c5f004402e46.

The test is failing on some Linux build bots. See the review for
an example.

3 years ago[modules] Fix crash in call to `FunctionDecl::setPure()`
Andrew Gallagher [Wed, 18 Nov 2020 19:54:34 +0000 (11:54 -0800)]
[modules] Fix crash in call to `FunctionDecl::setPure()`

In some cases, when deserializing a `CXXMethodDecl` of a `CXXSpecializationTemplateDecl`,
the call to `FunctionDecl::setPure()` happens before the `DefinitionData` member has been
populated (which appears to happen lower down in a `mergeRedeclarable` call), causing a
crash (https://reviews.llvm.org/P8228).

This diff fixes this by deferring the `FunctionDecl::setPure()` till after the `DefinitionData` has
been filled in.

Reviewed By: lxfind

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

3 years ago[Inline] Fix incorrect noalias metadata application (PR48209)
Nikita Popov [Wed, 18 Nov 2020 19:48:45 +0000 (20:48 +0100)]
[Inline] Fix incorrect noalias metadata application (PR48209)

The VMap also contains a mapping from Argument => Instruction,
where the instruction is part of the original function, not the
inlined one. The code was assuming that all the instructions in
the VMap were inlined.

This was a pre-existing problem for the loop access metadata, but
was extended to the more common noalias metadata by
27f647d117087ca11959e232e6443f4aee31e966, thus causing miscompiles.

There is a similar assumption inside CloneAliasScopeMetadata(), so
that one likely needs to be fixed as well.

3 years ago[Inline] Add test for PR48209 (NFC)
Nikita Popov [Wed, 18 Nov 2020 19:45:40 +0000 (20:45 +0100)]
[Inline] Add test for PR48209 (NFC)

The test shows noalias metadata being incorrectly applied to the
instruction producing the argument for the call.

3 years ago[libc][NFC][Obvious] Remove few unnecessary pieces from ilogb tests.
Siva Chandra Reddy [Wed, 18 Nov 2020 19:02:24 +0000 (11:02 -0800)]
[libc][NFC][Obvious] Remove few unnecessary pieces from ilogb tests.

3 years agoExpand existing loopsink testing to also test loopsinking using new pass manager...
Jamie Schmeiser [Wed, 18 Nov 2020 19:08:42 +0000 (14:08 -0500)]
Expand existing loopsink testing to also test loopsinking using new pass manager and fix LICM bug.
Summary:
Expand existing loopsink testing to also test loopsinking using new pass
manager.  Enable memoryssa for loopsink with new pass manager.  This
combination exposed a bug that was previously fixed for loopsink
without memoryssa.  When sinking an instruction into a loop, the source
block may not be part of the loop but still needs to be checked for
pointer invalidation.  This is the fix for bugzilla #39695 (PR 54659)
expanded to also work with memoryssa.

Respond to review comments.  Enable Memory SSA in legacy Loop Sink pass
under EnableMSSALoopDependency option control.  Update tests accordingly.

Respond to review comments.  Add options controlling whether memoryssa is
used for loop sink, defaulting to off.  Expand testing based on these
options.

Respond to review comments.  Properly indicated preserved analyses.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: asbirlea (Alina Sbirlea)
Differential Revision: https://reviews.llvm.org/D90249

3 years ago[BasicAA] Remove assert in AA evaluator
Nikita Popov [Wed, 18 Nov 2020 18:06:32 +0000 (19:06 +0100)]
[BasicAA] Remove assert in AA evaluator

As reported in https://reviews.llvm.org/D91383#2401825, this
assert breaks external -aa-eval tests. We'll have to fix this
case before re-enabling it.

3 years ago[GWP-ASan] Respect GWP_ASAN_DEFAULT_ENABLED compile-time macro
Roland McGrath [Wed, 18 Nov 2020 17:29:30 +0000 (09:29 -0800)]
[GWP-ASan] Respect GWP_ASAN_DEFAULT_ENABLED compile-time macro

If the containing allocator build uses -DGWP_ASAN_DEFAULT_ENABLED=false
then the option will default to false.  For e.g. Scudo, this is simpler
and more efficient than using -DSCUDO_DEFAULT_OPTIONS=... to set gwp-asan
options that have to be parsed from the string at startup.

Reviewed By: hctim

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

3 years ago[MLIR][SPIRV] Rename `spv._reference_of` to `spv.mlir.referenceof`
ergawy [Wed, 18 Nov 2020 17:43:06 +0000 (12:43 -0500)]
[MLIR][SPIRV] Rename `spv._reference_of` to `spv.mlir.referenceof`

This commit does the renaming mentioned in the title in order to bring
'spv' dialect closer to the MLIR naming conventions.

Reviewed By: antiagainst

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

3 years ago[clang-tidy] Allow `TransformerClangTidyCheck` clients to set the rule directly.
Yitzhak Mandelbaum [Mon, 16 Nov 2020 14:30:21 +0000 (14:30 +0000)]
[clang-tidy] Allow `TransformerClangTidyCheck` clients to set the rule directly.

Adds support for setting the `Rule` field. In the process, refactors the code that accesses that field and adds a constructor that doesn't require a rule argument.

This feature is needed by checks that must set the rule *after* the check class
is constructed. For example, any check that maintains state to be accessed from
the rule needs this support. Since the object's fields are not initialized when
the superclass constructor is called, they can't be (safely) captured by a rule
passed to the existing constructor.  This patch allows constructing the check
superclass fully before setting the rule.

As a driveby fix, removed the "optional" from the rule, since rules are just a
set of cases, so empty rules are evident.

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

3 years agoRevert "[build] normalize components dependencies"
serge-sans-paille [Wed, 18 Nov 2020 18:19:36 +0000 (19:19 +0100)]
Revert "[build] normalize components dependencies"

This reverts commit c6ef6e1690d517b3401ea06b1fe46871eb67434d.

Basically, publicly linked libraries have a different semantic than components,
which link libraries privately.

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

3 years ago[NFC][LoopIdiom] Left-shift-until-bittest: revisit test coverage
Roman Lebedev [Wed, 18 Nov 2020 17:53:19 +0000 (20:53 +0300)]
[NFC][LoopIdiom] Left-shift-until-bittest: revisit test coverage

3 years agoRevert "Revert "[clangd] Implement textDocument/implementation (Xref layer)""
Utkarsh Saxena [Wed, 18 Nov 2020 17:13:11 +0000 (18:13 +0100)]
Revert "Revert "[clangd] Implement textDocument/implementation (Xref layer)""

This reverts commit 0016ab6f3632968e52eb83de021908f0c94bbb10.

Fix: Consume error from Expected<T>.

3 years ago[VP] Non-signalling llvm.vp.* intrinsics are speculatable
Simon Moll [Wed, 18 Nov 2020 16:51:46 +0000 (17:51 +0100)]
[VP] Non-signalling llvm.vp.* intrinsics are speculatable

This is specifically required by the upcoming ExpandVectorPredication
pass (D78203) to recognize llvm.vp.* intrinsics that may ignore their
predicates.

3 years agolld/MachO: Move MachOOptTable to DriverUtils.cpp, remove DriverUtils.h
Nico Weber [Wed, 18 Nov 2020 17:31:47 +0000 (12:31 -0500)]
lld/MachO: Move MachOOptTable to DriverUtils.cpp, remove DriverUtils.h

This makes lld/MachO look more like lld/COFF and lld/ELF, as discussed
in D91640.

3 years ago[AMDGPU] Fix v3f16 interaction with image store workaround
Sebastian Neubauer [Thu, 5 Nov 2020 14:09:56 +0000 (15:09 +0100)]
[AMDGPU] Fix v3f16 interaction with image store workaround

In some cases, the wrong amount of registers was reserved.

Also enable more v3f16 tests.

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

3 years ago[libc++] Implements multiline regex support.
Mark de Wever [Wed, 18 Nov 2020 17:09:13 +0000 (18:09 +0100)]
[libc++] Implements multiline regex support.

This resolves LWG2503.

3 years agoRevert "[clangd] Implement textDocument/implementation (Xref layer)"
Utkarsh Saxena [Wed, 18 Nov 2020 17:04:20 +0000 (18:04 +0100)]
Revert "[clangd] Implement textDocument/implementation (Xref layer)"

This reverts commit 43243208fa6fafe8b91e42c82bc56db9d99f76d3.

3 years agoHazardRecognizer - Fix definition/declaration argument name mismatches. NFCI.
Simon Pilgrim [Wed, 18 Nov 2020 16:45:25 +0000 (16:45 +0000)]
HazardRecognizer - Fix definition/declaration argument name mismatches. NFCI.

Consistently use SUnit *SU (or drop the argname entirely if not used like the other HazardRecognizer methods).

Silences cppcheck warnings.

3 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Wed, 18 Nov 2020 16:23:04 +0000 (16:23 +0000)]
Fix unused variable warning. NFCI.

We're just performing a null pointer check, we don't need the actual variable.

3 years ago[SystemZ][NFC] Group SystemZ tests in SystemZ folder
Abhina Sreeskantharajan [Wed, 18 Nov 2020 16:48:28 +0000 (11:48 -0500)]
[SystemZ][NFC] Group SystemZ tests in SystemZ folder

This patch creates a SystemZ folder in clang/test/CodeGen to contain systemz-related lit tests.

Reviewed By: muiez

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

3 years ago[OpenMP] [DOCS] Update OMP5.1 feature status table [NFC]
dreachem [Wed, 18 Nov 2020 16:43:43 +0000 (10:43 -0600)]
[OpenMP] [DOCS] Update OMP5.1 feature status table [NFC]

Adding features in OpenMP 5.1 specification, as documented in feature change history, to the 5.1 table. I alphabetized the rows of the table according to the category. For deprecating master construct, I just used 'other' as the category.

Reviewed By: jdoerfert

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

3 years agolld: Make tests depend on llvm-symbolizer after bc98034040
Nico Weber [Wed, 18 Nov 2020 16:42:46 +0000 (11:42 -0500)]
lld: Make tests depend on llvm-symbolizer after bc98034040

Fixes test failures when building just `check-lld` in a clean build dir.

3 years ago[llvm] fix global_downgraded_to_static test
Mikhail Goncharov [Wed, 18 Nov 2020 16:19:03 +0000 (17:19 +0100)]
[llvm] fix global_downgraded_to_static test

after 9aa789820027 https://reviews.llvm.org/D90930

3 years ago[NFC] Use [MC]Register for Hexagon target
Gaurav Jain [Thu, 5 Nov 2020 03:10:29 +0000 (19:10 -0800)]
[NFC] Use [MC]Register for Hexagon target

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

3 years ago[clangd] Implement textDocument/implementation (Xref layer)
Utkarsh Saxena [Wed, 18 Nov 2020 10:57:36 +0000 (11:57 +0100)]
[clangd] Implement textDocument/implementation (Xref layer)

Xref layer changes for textdocument/implementation (https://microsoft.github.io/language-server-protocol/specification#textDocument_implementation)

This currently shows all functions (implementations) that overrides a virtual function.

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

3 years agoSpeculativeExecution: Allow speculating more instruction types
Piotr Sobczak [Wed, 18 Nov 2020 09:01:25 +0000 (10:01 +0100)]
SpeculativeExecution: Allow speculating more instruction types

Support more instructions in SpeculativeExecution pass:
- ExtractValue
- InsertValue
- Trunc
- Freeze

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

3 years ago[DAGCombiner] Precommit Sext Tests for D91589
Simon Pilgrim [Wed, 18 Nov 2020 15:55:52 +0000 (15:55 +0000)]
[DAGCombiner] Precommit Sext Tests for D91589

Patch by: @laytonio (Layton Kifer)

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

3 years ago[OPENMP]Fix PR48174: compile-time crash with target enter data on a global struct.
Alexey Bataev [Tue, 17 Nov 2020 21:55:59 +0000 (13:55 -0800)]
[OPENMP]Fix PR48174:  compile-time crash with target enter data on a global struct.

The compiler should treat array subscript with base pointer as a first
pointer in complex data, it is used only for member expression with base
pointer.

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

3 years ago[libc][obvious] Fix fdim[f|l] signatures in stdc spec.
Siva Chandra Reddy [Wed, 18 Nov 2020 15:28:51 +0000 (07:28 -0800)]
[libc][obvious] Fix fdim[f|l] signatures in stdc spec.

3 years ago[AMDGPU] Fix and extend vccz workarounds
Jay Foad [Tue, 17 Nov 2020 11:52:52 +0000 (11:52 +0000)]
[AMDGPU] Fix and extend vccz workarounds

We have workarounds for two different cases where vccz can get out of
sync with the value in vcc. This fixes them in two ways:

1. Fix the case where the def of vcc was in a previous basic block, by
pessimistically assuming that vccz might be incorrect at a basic block
boundary.

2. Fix the handling of pre-existing waitcnt instructions by calling
generateWaitcntInstBefore before examining ScoreBrackets to determine
whether there's an outstanding smem read operation.

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

3 years ago[Reassociate] Don't convert add-like-or's into add's if they appear to be part of...
Roman Lebedev [Wed, 18 Nov 2020 14:21:04 +0000 (17:21 +0300)]
[Reassociate] Don't convert add-like-or's into add's if they appear to be part of load-combining idiom

As Wei Mi is reporting in post-commit review
  https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20201116/853479.html
teaching -reassociate about add-like-or's (70472f3) results in breaking apart
load widening patterns, and reassociating them.

For now, simply exclude any such `or` that appears to be a root of
load widening idiom from the or->add transformation.

Note that the heuristic is greedy, it doesn't ensure that loads
can *actually* be widened into a single load.

3 years ago[NFC][Reassociate] Add patterns where `or` is part of load reduction idiom
Roman Lebedev [Wed, 18 Nov 2020 14:14:26 +0000 (17:14 +0300)]
[NFC][Reassociate] Add patterns where `or` is part of load reduction idiom

As Wei Mi is reporting in post-commit review:
  https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20201116/853479.html
teaching -reassociate about add-like-or's (70472f3) results in breaking apart
load widening patterns, and reassociating them.

While that's great, it prevents the actual load widening in backend,
and that is not good. We should have load widening in middle-end,
but for now we should at least not regress the naive patterns..

3 years ago[AST] Enhance the const expression evaluator to support error-dependent exprs.
Haojian Wu [Wed, 18 Nov 2020 14:48:06 +0000 (15:48 +0100)]
[AST] Enhance the const expression evaluator to support error-dependent exprs.

Fix a crash when evaluating a constexpr function which contains
recovery-exprs. https://bugs.llvm.org/show_bug.cgi?id=46837

Would be nice to have constant expression evaluator support general template
value-dependent expressions, but it requires more work.

This patch is a good start I think, to handle the error-only
value-dependent expressions.

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

3 years ago[X86] Add broadcast merge test case for PR48215
Simon Pilgrim [Wed, 18 Nov 2020 14:06:19 +0000 (14:06 +0000)]
[X86] Add broadcast merge test case for PR48215

3 years agoFix unused variables in release build
Mikhail Goncharov [Wed, 18 Nov 2020 14:10:57 +0000 (15:10 +0100)]
Fix unused variables in release build

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

3 years ago[AMDGPU] Rename pseudo S_WAITCNT_IDLE to S_WAIT_IDLE. NFC.
Jay Foad [Wed, 18 Nov 2020 14:03:43 +0000 (14:03 +0000)]
[AMDGPU] Rename pseudo S_WAITCNT_IDLE to S_WAIT_IDLE. NFC.

3 years ago[ConstraintElimination] Refactor constraint extraction (NFC).
Florian Hahn [Tue, 17 Nov 2020 17:38:19 +0000 (17:38 +0000)]
[ConstraintElimination] Refactor constraint extraction (NFC).

This patch generalizes the extraction of a constraint for a given
condition. It allows decompose to return a vector of c * X pairs, which
allows de-composing multiple instructions in the future.

It also adds more clarifying comments.

3 years ago[clangd] Remove the trailing "." in add-using message.
Haojian Wu [Wed, 18 Nov 2020 13:43:15 +0000 (14:43 +0100)]
[clangd] Remove the trailing "." in add-using message.

to be consistent witih other code actions.

Reviewed By: adamcz

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

3 years ago[SystemZ] Use ISD::ABS opcode during isel.
Jonas Paulsson [Wed, 18 Nov 2020 10:40:18 +0000 (11:40 +0100)]
[SystemZ] Use ISD::ABS opcode during isel.

The SystemZISD::IABS node is no longer needed since ISD::ABS can be used
instead.

Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D91697

3 years ago[lldb][NFC] Don't let Process inherit from UserID
Raphael Isemann [Wed, 18 Nov 2020 13:30:06 +0000 (14:30 +0100)]
[lldb][NFC] Don't let Process inherit from UserID

I noticed that Process is inheriting from UserID to store its PID value. This patch
replaces this with a dedicated field in the Process class. This is NFC, but has some
small effects on the code using Process:
* `GetID()` now returns a `lldb::pid_t` like all other process code instead of `lldb::user_id_t`. Both are typedefs for `uint64_t`, so no change in behaviour.
* The equality operators defined for UserID no longer accept Process instances.
* Removes the inherited method `Process::Clear()` which didn't actually clear anything beside the PID value.

We maybe should also remove the getters/setters to `S/GetPID` or something like that. I can update all the code for that
in a follow-up NFC commit.

Reviewed By: labath

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

3 years ago[ARM][LowOverheadLoops] Merge VCMP and VPST across VPT blocks
Sam Tebbs [Fri, 6 Nov 2020 13:35:35 +0000 (13:35 +0000)]
[ARM][LowOverheadLoops] Merge VCMP and VPST across VPT blocks

This patch adds support for combining a VPST with a dangling VCMP from a
previous VPT block.

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

3 years agoFix typo for hasAnyOverloadedOperatorName; NFC
Keishi Hattori [Wed, 18 Nov 2020 12:48:59 +0000 (07:48 -0500)]
Fix typo for hasAnyOverloadedOperatorName; NFC

3 years agoRemove unportable test
Stephen Kelly [Wed, 18 Nov 2020 12:40:52 +0000 (12:40 +0000)]
Remove unportable test

The default content of translation unit varies too much between
platforms.

3 years agoAdd sysroot/lib to library search path of baremetal toolchain.
Hafiz Abid Qadeer [Wed, 18 Nov 2020 12:16:40 +0000 (12:16 +0000)]
Add sysroot/lib to library search path of baremetal toolchain.

Baremetal toolchain is not adding sysroot/lib to the library
search path. This is forcing the user to do it manually. This commit
fixes this shortcoming by adding the sysroot/lib to library search path
if sysroot is not empty.

Reviewed By: jroelofs

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

3 years ago[SLP] Use the minimum alignment of the load bundle when forming a masked.gather
Benjamin Kramer [Wed, 18 Nov 2020 11:50:24 +0000 (12:50 +0100)]
[SLP] Use the minimum alignment of the load bundle when forming a masked.gather

Instead of the first load. That works when vectorizing contiguous loads,
but not for gathers.

Fixes a miscompile introduced in fcad8d3635cff61a2749dcef94c0d51fa1e3e413.

3 years ago[Matrix] Adjust matrix pointer type for inline asm arguments.
Florian Hahn [Wed, 18 Nov 2020 11:32:45 +0000 (11:32 +0000)]
[Matrix] Adjust matrix pointer type for inline asm arguments.

Matrix types in memory are represented as arrays, but accessed through
vector pointers, with the alignment specified on the access operation.

For inline assembly, update pointer arguments to use vector pointers.
Otherwise there will be a mis-match if the matrix is also an
input-argument which is represented as vector.

Reviewed By: nickdesaulniers

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

3 years ago[sanitizer] Fix typo in log messages
Seonghyun Park [Wed, 18 Nov 2020 11:40:45 +0000 (03:40 -0800)]
[sanitizer] Fix typo in log messages

Fix typo in log messages

Reviewed By: vitalybuka

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

3 years ago[lldb] Fix a couple of remote llgs tests
David Spickett [Tue, 17 Nov 2020 11:56:45 +0000 (11:56 +0000)]
[lldb] Fix a couple of remote llgs tests

init_llgs_test no longer takes an argument
but these two were not updated.

Also fix some mistakes in TestAutoInstallMainExecutable
to get it passing again.

Reviewed By: JDevlieghere, labath

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

3 years ago[IndVars] Support different types of ExitCount when optimizing exit conds
Max Kazantsev [Wed, 18 Nov 2020 10:56:34 +0000 (17:56 +0700)]
[IndVars] Support different types of ExitCount when optimizing exit conds

In some cases we can handle IV and iter count of different types. It's a typical situation
after IV have been widened. This patch adds support for such cases, when legal.

Differential Revision: https://reviews.llvm.org/D88528
Reviewed By: skatkov

3 years ago[clang][cli] Port Migrator option flags to new option parsing system
Jan Svoboda [Wed, 18 Nov 2020 09:10:17 +0000 (10:10 +0100)]
[clang][cli] Port Migrator option flags to new option parsing system

Depends on D83406

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[lldb] [test] Un-XFAIL tests on freebsd/i386
Michał Górny [Tue, 17 Nov 2020 18:06:33 +0000 (19:06 +0100)]
[lldb] [test] Un-XFAIL tests on freebsd/i386

Restrict i386-specific XFAIL on a few tests to non-FreeBSD systems,
as they pass on FreeBSD.

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

3 years ago[lldb] [test] Un-XFAIL TestMultipleDebuggers.py
Michał Górny [Tue, 17 Nov 2020 11:04:13 +0000 (12:04 +0100)]
[lldb] [test] Un-XFAIL TestMultipleDebuggers.py

This test is flaky, and for the time being we do not mark them as XFAIL.