platform/upstream/llvm.git
3 years agoReapply "OpaquePtr: Turn inalloca into a type attribute"
Matt Arsenault [Sun, 28 Mar 2021 17:05:17 +0000 (13:05 -0400)]
Reapply "OpaquePtr: Turn inalloca into a type attribute"

This reverts commit 20d5c42e0ef5d252b434bcb610b04f1cb79fe771.

3 years ago[InstCombine] sink min/max intrinsics with common op after select
Sanjay Patel [Sun, 28 Mar 2021 16:23:57 +0000 (12:23 -0400)]
[InstCombine] sink min/max intrinsics with common op after select

This is another step towards parity with cmp+select min/max idioms.

See D98152.

3 years ago[InstCombine] add tests for select of min/max intrinsics; NFC
Sanjay Patel [Sun, 28 Mar 2021 14:17:05 +0000 (10:17 -0400)]
[InstCombine] add tests for select of min/max intrinsics; NFC

3 years agoRevert "OpaquePtr: Turn inalloca into a type attribute"
Nico Weber [Sun, 28 Mar 2021 17:02:52 +0000 (13:02 -0400)]
Revert "OpaquePtr: Turn inalloca into a type attribute"

This reverts commit 4fefed65637ec46c8c2edad6b07b5569ac61e9e5.
Broke check-clang everywhere.

3 years ago[RISCV][Clang] Update new overloading rules for RVV intrinsics.
Zakk Chen [Mon, 22 Mar 2021 14:51:52 +0000 (07:51 -0700)]
[RISCV][Clang] Update new overloading rules for RVV intrinsics.

RVV intrinsics has new overloading rule, please see
https://github.com/riscv/rvv-intrinsic-doc/commit/82aac7dad4c6c1c351ed5b17ca6007c395843ed7

Changed:
1. Rename `generic` to `overloaded` because the new rule is not using C11 generic.
2. Change HasGeneric to HasNoMaskedOverloaded because all masked operations
   support overloading api.
3. Add more overloaded tests due to overloading rule changed.

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

3 years ago[Orc][examples] Add missing dependency to OrcShared in LLJITWithRemoteDebugging
Stefan Gränitz [Sun, 28 Mar 2021 15:48:28 +0000 (17:48 +0200)]
[Orc][examples] Add missing dependency to OrcShared in LLJITWithRemoteDebugging

3 years ago[Orc][examples] Add LLJITWithRemoteDebugging example
Stefan Gränitz [Fri, 26 Mar 2021 17:57:47 +0000 (18:57 +0100)]
[Orc][examples] Add LLJITWithRemoteDebugging example

3 years agoAArch64/GlobalISel: Remove IR section from test
Matt Arsenault [Sat, 27 Mar 2021 14:39:27 +0000 (10:39 -0400)]
AArch64/GlobalISel: Remove IR section from test

3 years agoOpaquePtr: Turn inalloca into a type attribute
Matt Arsenault [Sat, 6 Mar 2021 18:23:57 +0000 (13:23 -0500)]
OpaquePtr: Turn inalloca into a type attribute

I think byval/sret and the others are close to being able to rip out
the code to support the missing type case. A lot of this code is
shared with inalloca, so catch this up to the others so that can
happen.

3 years ago[clang-format] Fix aligning with linebreaks
Björn Schäpers [Wed, 10 Mar 2021 21:08:07 +0000 (22:08 +0100)]
[clang-format] Fix aligning with linebreaks

Breaking a string literal or a function calls arguments with
AlignConsecutiveDeclarations or AlignConsecutiveAssignments did misalign
the continued line. E.g.:

void foo() {
  int myVar = 5;
  double x  = 3.14;
  auto str  = "Hello"
            "World";
}

or

void foo() {
  int    myVar = 5;
  double x = 3.14;
  auto   str = "Hello"
             "World";
}

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

3 years ago[LV] Mark a few more cost-model members as const (NFC).
Florian Hahn [Sun, 28 Mar 2021 13:57:45 +0000 (14:57 +0100)]
[LV] Mark a few more cost-model members as const (NFC).

3 years agoUpdate the documentation for recent changes to statement attributes.
Aaron Ballman [Sun, 28 Mar 2021 13:52:13 +0000 (09:52 -0400)]
Update the documentation for recent changes to statement attributes.

Adds more information about automated diagnostic reporting for statement
attributes and adds a bit more documentation about statement attributes
in general.

3 years ago[BasicAA] Handle gep with unknown sizes earlier (NFCI)
Nikita Popov [Sun, 28 Mar 2021 11:06:52 +0000 (13:06 +0200)]
[BasicAA] Handle gep with unknown sizes earlier (NFCI)

If the sizes of both memory locations are unknown, we can only
perform a check on the underlying objects. There's no point in
going through GEP decomposition in this case.

3 years ago[SelDag] Add isIntOrFPConstant helper function.
Florian Hahn [Sun, 28 Mar 2021 11:48:58 +0000 (12:48 +0100)]
[SelDag] Add isIntOrFPConstant helper function.

This patch adds a new isIntOrFPConstant  helper function to check if a
SDValue is a integer of FP constant. This pattern is used in various
places.

There also are places that incorrectly just check for integer constants,
e.g. D99384, so hopefully this helper will help people avoid that issue.

Reviewed By: RKSimon

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

3 years ago[clang-tidy] Simplify readability checks to not need ignoring* matchers
Stephen Kelly [Tue, 9 Mar 2021 23:06:14 +0000 (23:06 +0000)]
[clang-tidy] Simplify readability checks to not need ignoring* matchers

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

3 years ago[Driver] Simplify mips multilib path and fix comments. NFC
Fangrui Song [Sun, 28 Mar 2021 07:30:38 +0000 (00:30 -0700)]
[Driver] Simplify mips multilib path and fix comments. NFC

3 years ago[lldb] Fix capitalization in CMake status message
Jonas Devlieghere [Sun, 28 Mar 2021 04:39:01 +0000 (21:39 -0700)]
[lldb] Fix capitalization in CMake status message

s/LLDB Tests/LLDB tests/

3 years ago[RISCV] Add vfabs.v pseudo instruction.
Hsiangkai Wang [Sat, 27 Mar 2021 11:40:09 +0000 (19:40 +0800)]
[RISCV] Add vfabs.v pseudo instruction.

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

3 years ago[OCaml][Test] Fix and enable debuginfo.ml test
Vaivaswatha Nagaraj [Sun, 28 Mar 2021 00:55:39 +0000 (06:25 +0530)]
[OCaml][Test] Fix and enable debuginfo.ml test

`get_or_create_type_array` was used on a non-type MDNode.
Add interface for `get_or_create_array` and use that instead.

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

3 years ago[test] Add UNSUPPORTED: system-windows to linux-ld.c
Fangrui Song [Sat, 27 Mar 2021 23:46:30 +0000 (16:46 -0700)]
[test] Add UNSUPPORTED: system-windows to linux-ld.c

We should have a test verifying / \ for Windows but have such a long
test specifically for Linux cross compilation suffer from Windows \
is too troublesome.

3 years ago[X86] Regenerate a bunch of tests to pick up @PLT
Craig Topper [Sat, 27 Mar 2021 23:41:04 +0000 (16:41 -0700)]
[X86] Regenerate a bunch of tests to pick up @PLT

I'm prepping another patch to the same tests and this just adds
noise to my diff.

3 years ago[Driver] Remove an incorrect library path for multilib
Fangrui Song [Sat, 27 Mar 2021 23:36:21 +0000 (16:36 -0700)]
[Driver] Remove an incorrect library path for multilib

This is incorrect (adding a path with unrelated libraries) but benign in practice because previous paths take precedence.

3 years ago[Driver] Remove an unneeded multiarch library path which ends with ../../..
Fangrui Song [Sat, 27 Mar 2021 22:46:06 +0000 (15:46 -0700)]
[Driver] Remove an unneeded multiarch library path which ends with ../../..

Neither vanilla nor Debian GCC has the patch, which usually duplicates $sysroot/usr/lib.

3 years ago[RISCV] Add a pattern for (sext_inreg (mul (and X, 0xffffffff), (and Y, 0xffffffff...
Craig Topper [Sat, 27 Mar 2021 22:33:39 +0000 (15:33 -0700)]
[RISCV] Add a pattern for (sext_inreg (mul (and X, 0xffffffff), (and Y, 0xffffffff)), i32) to suppress MULW formation

We have a special pattern for
(mul (and X, 0xffffffff), (and Y, 0xffffffff)), to optimize the
ANDs to shift. But if a sext_inreg coms first, we'll form a MULW
and limit the effectiveness of the special match. So this patch
adds a larger pattern to suppress the MULW formation by emitting
a sext.w and then the same output we use for the
(mul (and X, 0xffffffff), (and Y, 0xffffffff)). This should all
get CSEd.

This is the issue I was trying to fix with D99029, but that affected
many more tests.

3 years ago[BasicAA] Refactor linear expression decomposition
Nikita Popov [Sat, 27 Mar 2021 15:23:35 +0000 (16:23 +0100)]
[BasicAA] Refactor linear expression decomposition

The current linear expression decomposition handles zext/sext by
decomposing the casted operand, and then checking NUW/NSW flags
to determine whether the extension can be distributed. This has
some disadvantages:

First, it is not possible to perform a partial decomposition. If
we have zext((x + C1) +<nuw> C2) then we will fail to decompose
the expression entirely, even though it would be safe and
profitable to decompose it to zext(x + C1) +<nuw> zext(C2)

Second, we may end up performing unnecessary decompositions,
which will later be discarded because they lack nowrap flags
necessary for extensions.

Third, correctness of the code is not entirely obvious: At a high
level, we encounter zext(x -<nuw> C) in the form of a zext on the
linear expression x + (-C) with nuw flag set. Notably, this case
must be treated as zext(x) + -zext(C) rather than zext(x) + zext(-C).
The code handles this correctly by speculatively zexting constants
to the final bitwidth, and performing additional fixup if the
actual extension turns out to be an sext. This was not immediately
obvious to me.

This patch inverts the approach: An ExtendedValue represents a
zext(sext(V)), and linear expression decomposition will try to
decompose V further, either by absorbing another sext/zext into the
ExtendedValue, or by distributing zext(sext(x op C)) over a binary
operator with appropriate nsw/nuw flags. At each step we can
determine whether distribution is legal and abort with a partial
decomposition if not. We also know which extensions we need to
apply to constants, and don't need to speculate or fixup.

3 years ago[libcxx] rearranges all concept tests
Christopher Di Bella [Mon, 22 Mar 2021 19:39:35 +0000 (19:39 +0000)]
[libcxx] rearranges all concept tests

moves tests into directories matching their stable names so that the
tests can reflect the concept name

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

3 years agoDeduplicate branches and adjust comment [NFC]
Aaron Puchert [Sat, 27 Mar 2021 21:50:22 +0000 (22:50 +0100)]
Deduplicate branches and adjust comment [NFC]

Currently we want to allow calling non-const methods even when only a
shared lock is held, because -Wthread-safety-reference is already quite
sensitive and not all code is const-correct. Even if it is, this might
require users to add std::as_const around the implicit object argument.

See D52395 for a discussion.

Fixes PR46963.

3 years ago[LV] Fix formatting from 2f9d68c3f12a.
Florian Hahn [Sat, 27 Mar 2021 21:29:53 +0000 (21:29 +0000)]
[LV] Fix formatting from 2f9d68c3f12a.

3 years ago[LV] Mark some methods as const (NFC).
Florian Hahn [Sat, 27 Mar 2021 21:27:05 +0000 (21:27 +0000)]
[LV] Mark some methods as const (NFC).

Mark a few methods as const, as they do not modify any state.

3 years ago[CMake] Use write_basic_package_version_file for LLVM
Alex Reinking [Sat, 27 Mar 2021 20:23:53 +0000 (20:23 +0000)]
[CMake] Use write_basic_package_version_file for LLVM

Use the CMake 3.13 features of CMakeConfigPackageHelpers to generate
LLVMConfigVersion.cmake with proper architecture detection, major+minor
version matching, etc.

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

3 years ago[sanitizer] Define MAP_NORESERVE to 0 and hide mremap for FreeBSD
Fangrui Song [Sat, 27 Mar 2021 19:18:58 +0000 (12:18 -0700)]
[sanitizer] Define MAP_NORESERVE to 0 and hide mremap for FreeBSD

3 years ago[MLIR][STD] Fold trunci (zexti).
KareemErgawy-TomTom [Sat, 27 Mar 2021 18:40:10 +0000 (19:40 +0100)]
[MLIR][STD] Fold trunci (zexti).

This patch folds the following pattern:

```
  %arg0 = ...
  %0 = zexti %arg0 : i1 to i8
  %1 = trunci %0 : i8 to i1
```

into just `%arg0`.

Reviewed By: mehdi_amini

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

3 years ago[gn build] rewrap a comment to 80 cols
Nico Weber [Sat, 27 Mar 2021 16:50:33 +0000 (12:50 -0400)]
[gn build] rewrap a comment to 80 cols

3 years ago[clang][cli] Round-trip cc1 arguments in assert builds
Jan Svoboda [Sat, 27 Mar 2021 15:54:51 +0000 (16:54 +0100)]
[clang][cli] Round-trip cc1 arguments in assert builds

This patch enables cc1 argument round-trip for assert builds. It can be disabled by building clang with `-DCLANG_ROUND_TRIP_CC1_ARGS=OFF`.

This will be committed only if we reach consensus in https://lists.llvm.org/pipermail/cfe-dev/2021-February/067714.html.

Reviewed By: dexonsmith

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

3 years ago[X86][SSE] foldShuffleOfHorizOp - remove broadcast handling.
Simon Pilgrim [Sat, 27 Mar 2021 15:09:15 +0000 (15:09 +0000)]
[X86][SSE] foldShuffleOfHorizOp - remove broadcast handling.

Remove VBROADCAST/MOVDDUP/splat-shuffle handling from foldShuffleOfHorizOp

This can all be handled by canonicalizeShuffleMaskWithHorizOp along as we check that the HADD/SUB are only used once (to prevent infinite loops on slow-horizop targets which will try to reuse the nodes again followed by a post-hop shuffle).

3 years ago[FileCheck] Try to fix buildbot failures caused by c7c542e8f306
Joel E. Denny [Sat, 27 Mar 2021 15:03:10 +0000 (11:03 -0400)]
[FileCheck] Try to fix buildbot failures caused by c7c542e8f306

For example,

<https://lab.llvm.org/buildbot/#/builders/132/builds/3929>

has this diagnostic:

```
/opt/gcc/9.3.0/snos/include/g++/bits/stl_tree.h:780:8: error: static assertion failed: comparison object must be invocable as const
  780 |        is_invocable_v<const _Compare&, const _Key&, const _Key&>,
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

3 years ago[FileCheck] Fix -dump-input per-pattern diagnostic indexing
Joel E. Denny [Fri, 26 Mar 2021 21:32:12 +0000 (17:32 -0400)]
[FileCheck] Fix -dump-input per-pattern diagnostic indexing

In input dump annotations, `check:2'1` indicates diagnostic 1 for the
`CHECK` directive on check file line 2.  Without this patch,
`-dump-input` computes the diagnostic index with the assumption that
FileCheck *consecutively* produces all diagnostics for the same
pattern.  Already, that can be a false assumption, as in the examples
below.  Moreover, it seems like a brittle assumption as FileCheck
evolves.  Finally, it actually complicates the implementation even if
it makes it slightly more efficient.

This patch avoids that assumption.  Examples below show results after
applying this patch.  Before applying this patch, `'N` is omitted
throughout these examples because the implementation doesn't notice
there's more than one diagnostic per pattern.

First, `CHECK-LABEL` violates the assumption because `CHECK-LABEL`
tries to match twice, and other directives can match in between:

```
$ cat check
CHECK: foobar
CHECK-LABEL: foobar

$ FileCheck -vv check < input |& tail -8
<<<<<<
           1: text
           2: foobar
label:2'0     ^~~~~~
check:1       ^~~~~~
label:2'1           X error: no match found
           3: text
>>>>>>
```

Second, `--implicit-check-not` is obviously processed many times among
other directives:

```
$ cat check
CHECK: foo
CHECK: foo

$ FileCheck -vv -dump-input=always -implicit-check-not=foo \
            check < input |& tail -16
<<<<<<
            1: text
not:imp1'0     X~~~~
            2: foo
check:1        ^~~
not:imp1'1        X
            3: text
not:imp1'1     ~~~~~
            4: foo
check:2        ^~~
not:imp1'2        X
            5: text
not:imp1'2     ~~~~~
            6:
eof:2          ^
>>>>>>
```

Reviewed By: thopre, jhenderson

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

3 years ago[BasicAA] Correct handle implicit sext in decomposition
Nikita Popov [Sat, 27 Mar 2021 14:15:47 +0000 (15:15 +0100)]
[BasicAA] Correct handle implicit sext in decomposition

While explicit sext instructions were handled correctly, the
implicit sext that occurs if the offset is smaller than the
pointer size blindly assumed that sext(X * Scale + Offset) is the
same as sext(X) * Scale + Offset, which is obviously not correct.

Fix this by extracting the code that handles linear expression
extension and reusing it for the implicit sext as well.

3 years ago[BasicAA] Clarify entry values of GetLinearExpression() (NFC)
Nikita Popov [Sat, 27 Mar 2021 11:58:46 +0000 (12:58 +0100)]
[BasicAA] Clarify entry values of GetLinearExpression() (NFC)

A number of variables need to be correctly initialized on entry
to GetLinearExpression() for the implementation to behave reasonably.

The fact that SExtBits can currenlty be non-zero on entry is a bug,
as demonstrated by the added test: For implicit sexts by the GEP,
we do currently skip legality checks.

3 years ago[BasicAA] Bail out earlier for invalid shift amount
Nikita Popov [Sat, 27 Mar 2021 11:32:31 +0000 (12:32 +0100)]
[BasicAA] Bail out earlier for invalid shift amount

Currently, we'd produce an incorrect decomposition, because we
already recursively called GetLinearExpression(), so the Scale=1,
Offset=0 will not necessarily be relative to the shl itself.

Now, this doesn't actually matter for functional correctness,
because such a shift is poison anyway, so its okay to return
an incorrect decomposition. It's still unnecessarily confusing
though, and we can easily avoid this by checking the bitwidth
earlier.

3 years ago[BasicAA] Retain shl nowrap flags in GetLinearExpression()
Nikita Popov [Sat, 27 Mar 2021 11:11:25 +0000 (12:11 +0100)]
[BasicAA] Retain shl nowrap flags in GetLinearExpression()

Nowrap flags between mul and shl differ in that mul nsw allows
multiplication of 1 * INT_MIN, while shl nsw does not. This means
that it is always fine to transfer shl nowrap flags to muls, but
not necessarily the other way around. In this case the NUW/NSW
results refer to mul/add operations, so it's fine to retain the
flags from the shl.

3 years ago[X86][SSE] combineX86ShuffleChain - attempt to recognise 'hidden' identity shuffles
Simon Pilgrim [Sat, 27 Mar 2021 11:09:30 +0000 (11:09 +0000)]
[X86][SSE] combineX86ShuffleChain - attempt to recognise 'hidden' identity shuffles

See if the combined shuffle mask is equivalent to an identity shuffle, typically this is due to repeated LHS/RHS ops in horiz-ops, but isTargetShuffleEquivalent might see other patterns as well.

This is another small step towards getting rid of foldShuffleOfHorizOp and relying on canonicalizeShuffleMaskWithHorizOp and generic shuffle combining.

3 years agoMake FoldBranchToCommonDest poison-safe by default
Juneyoung Lee [Sat, 27 Mar 2021 08:12:20 +0000 (17:12 +0900)]
Make FoldBranchToCommonDest poison-safe by default

This is a small patch to make FoldBranchToCommonDest poison-safe by default.
After fc3f0c9c, only two syntactic changes are needed to fix unit tests.
This does not cause any assembly difference in testsuite as well (-O3, X86-64 Manjaro).

Reviewed By: nikic

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

3 years ago[x86] prevent crashing while matching pmaddwd
Sanjay Patel [Sat, 27 Mar 2021 09:24:52 +0000 (05:24 -0400)]
[x86] prevent crashing while matching pmaddwd

This could crash in 2 ways: either one or both of
the input vectors could be a different size than
the math ops.

https://llvm.org/PR49716

3 years ago[mlir] Register Linalg passes in C API and Python Bindings
Alex Zinenko [Fri, 26 Mar 2021 18:04:36 +0000 (19:04 +0100)]
[mlir] Register Linalg passes in C API and Python Bindings

Provide a registration mechanism for Linalg dialect-specific passes in C
API and Python bindings. These are being built into the dialect library
but exposed in separate headers (C) or modules (Python).

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

3 years ago[IRCE] Use m_LogicalAnd
Juneyoung Lee [Sat, 27 Mar 2021 06:22:17 +0000 (15:22 +0900)]
[IRCE] Use m_LogicalAnd

This is a minor fix to use m_LogicalAnd.
This allows IRCE to recognize select form of and conditions as well.

3 years ago[sanitizer] Temporarily switch ppc64 to the _dl_get_tls_static_info implementation
Fangrui Song [Sat, 27 Mar 2021 06:21:47 +0000 (23:21 -0700)]
[sanitizer] Temporarily switch ppc64 to the _dl_get_tls_static_info implementation

sanitizer-ppc64le-linux is good while clang-ppc64le-linux has test
failures due to GetStaticTlsRange(addr, size) set *addr is 0.

3 years ago[lldb] Fix TestAppleSimulatorOSType for older watchOS SDKs
Jonas Devlieghere [Sat, 27 Mar 2021 03:27:14 +0000 (20:27 -0700)]
[lldb] Fix TestAppleSimulatorOSType for older watchOS SDKs

Older watchOS SDKs *only* support i386 so we can't use x86_64/arm64
unconditionally.

3 years agodocs: Adding Google representative to the security group
George Burgess IV [Wed, 24 Mar 2021 00:34:42 +0000 (17:34 -0700)]
docs: Adding Google representative to the security group

This adds me as a Google representative for the LLVM security group.

This was proposed, discussed, and voted on in the differential revision
linked below; please see it for more information.

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

3 years ago[lldb] Stop using i386 for the watchOS simulator
Jonas Devlieghere [Sat, 27 Mar 2021 00:08:29 +0000 (17:08 -0700)]
[lldb] Stop using i386 for the watchOS simulator

This keeps breaking on my machine. It's time to move on.

3 years ago[RISCV] Merge FMulAdd and FMulSub scheduler classes to a single FMA scheduler class...
Craig Topper [Fri, 26 Mar 2021 23:37:15 +0000 (16:37 -0700)]
[RISCV] Merge FMulAdd and FMulSub scheduler classes to a single FMA scheduler class. NFC

It's unlikely that FMADD and FMSUB would have different scheduling
information so merge them.

Reviewed By: HsiangKai

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

3 years ago[CSSPGO][NFC] Fix a debug dump issue.
Hongtao Yu [Fri, 26 Mar 2021 20:18:26 +0000 (13:18 -0700)]
[CSSPGO][NFC] Fix a debug dump issue.

During context promotion, intermediate nodes that are on a call path but do not come with a profile can be promoted together with their parent nodes. Do not print sample context string for such nodes since they do not have profile.

Reviewed By: wenlei

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

3 years ago[OpenMP] Reset async stream properly upon failure
Joseph Huber [Fri, 26 Mar 2021 20:50:34 +0000 (16:50 -0400)]
[OpenMP] Reset async stream properly upon failure

Summary:
If the call to `synchronize` fails, it will currently block the stream indefinitely if execution is continued from this point. Additionally, if the program exits it will trigger an assertion on the non-null value of the async queue and prevent the runtime from printing debugging information.

Reviewers: jdoerfert

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

3 years ago[mlir] Remove unneeded ShapeFunctionLibraryTerminatorOp
Jacques Pienaar [Fri, 26 Mar 2021 23:03:51 +0000 (16:03 -0700)]
[mlir] Remove unneeded ShapeFunctionLibraryTerminatorOp

Now that NoTerminator is possible this op can be removed/it was only
needed structurally before. NFC.

3 years ago[lldb] Remove UpdateISAToDescriptorMapFromMemory
Jonas Devlieghere [Fri, 26 Mar 2021 22:27:19 +0000 (15:27 -0700)]
[lldb] Remove UpdateISAToDescriptorMapFromMemory

Remove UpdateISAToDescriptorMapFromMemory because it's dead code.

3 years agoAdd a missing file header comment, NFC.
Chris Lattner [Fri, 26 Mar 2021 22:34:04 +0000 (15:34 -0700)]
Add a missing file header comment, NFC.

3 years ago[lldb] Add consistency between reading the dynamic and shared cache class info
Jonas Devlieghere [Fri, 26 Mar 2021 21:50:46 +0000 (14:50 -0700)]
[lldb] Add consistency between reading the dynamic and shared cache class info

This adds the consistency I promised in D99315 between how we read the
class info from the Objective-C runtime and the shared cache. (NFC)

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

3 years ago[lld-macho] Add time tracing for LTO
Jez Ng [Thu, 25 Mar 2021 04:57:39 +0000 (00:57 -0400)]
[lld-macho] Add time tracing for LTO

The test is similar to the one used for LLD-ELF.

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

3 years ago[lld-macho] Fix parsing of --time-trace-{granularity,file}
Jez Ng [Thu, 25 Mar 2021 01:05:26 +0000 (21:05 -0400)]
[lld-macho] Fix parsing of --time-trace-{granularity,file}

Summary: We needed to use `Joined` instead of `Flag`. This wasn't caught
because the relevant test that was copied from LLD-ELF was still
invoking LLD-ELF instead of LLD-MachO...

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

3 years ago[lld-macho] Support -no_function_starts
Jez Ng [Mon, 22 Mar 2021 21:38:52 +0000 (17:38 -0400)]
[lld-macho] Support -no_function_starts

Pretty simple code-wise. Also threw in some refactoring:

* Put the functionStartSection under Writer instead of InStruct, since
  it doesn't need to be accessed outside of Writer
* Adjusted the test to put all files under the temp dir instead of at
  the top-level
* Added some CHECK-LABELs to make it clearer where the function starts
  data is

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

3 years ago[RISCV] Add scheduler classes for the Zba and Zbb extensions.
Craig Topper [Fri, 26 Mar 2021 21:15:27 +0000 (14:15 -0700)]
[RISCV] Add scheduler classes for the Zba and Zbb extensions.

I've used IALU for the simplest operations from Zbb:
min, minu, max, maxu, sext.b, sext.h, zext.h, andn, orn, xnor

I've put add.uw in IALU32 and slli.uw in ShiftImm32.

Remaining instructions have received new classes.
All 3 sh*add are grouped together. sh*add.uw are grouped together.
Rotate left and right are together. Everything else got their own
class containing one instruction.

I think what I have here is the minimum granularity we need. I
could be convinced that we need more classes.

Reviewed By: evandro

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

3 years ago[NFC][OCaml] Resolve a couple more compilation warnings
Josh Berdine [Fri, 26 Mar 2021 15:19:01 +0000 (15:19 +0000)]
[NFC][OCaml] Resolve a couple more compilation warnings

Followup to: 0b1dc49ca38a [NFC][OCaml] Resolve const and unsigned compilation warnings

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

3 years ago[SystemZ][z/OS] Save strings for CC_PRINT env vars
Sean Perry [Fri, 26 Mar 2021 20:37:29 +0000 (16:37 -0400)]
[SystemZ][z/OS] Save strings for CC_PRINT env vars

The contents of the string returned by getenv() is not guaranteed across calls to getenv(). The code to handle the CC_PRINT etc env vars calls getenv() and saves the results in just a char *. The string returned by getenv() needs to be copied and saved. Switching the type of the strings from char * to std::string will do this and manage the alloated memory.

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

3 years agoRevert "[ArgPromotion] Copy additional metadata for loads."
Nikita Popov [Fri, 26 Mar 2021 20:32:32 +0000 (21:32 +0100)]
Revert "[ArgPromotion] Copy additional metadata for loads."

This reverts commit 166620a4f01f10e688428caf132a147c0acc9183.

A miscompile has been reported in https://reviews.llvm.org/D93927#2653480
and following.

3 years ago[lldb] Support lazily named classes in the Objective-C classes
Jonas Devlieghere [Fri, 26 Mar 2021 19:07:46 +0000 (12:07 -0700)]
[lldb] Support lazily named classes in the Objective-C classes

Generic classes in Swift have their name instantiated on request, since
the vast majority never need it, and it just wastes time and memory.
This results in LLDB being unable to determine the dynamic type of these
Swift objects.

The main issues is that lazily named classes are not added to the
gdb_objc_realized_classes hashtable. This means the class count in the
table doesn't change when a class is realized and LLDB doesn't know it
needs to re-parse the class info. But even if it did, the classes are
not in the hash table.

The first change in this patch is that we read
objc_debug_realized_class_generation_count and re-parse the class info
when the count changes.

The second change in this patch is that we use
objc_copyRealizedClassList (if available) to get all realized classes
from the runtime.

Unfortunately, objc_copyRealizedClassList calls _dyld_objc_class_count
in its implementation. As we know, the Objective-C parsing code might
get called before dyld is fully initialized, resulting in crashes or
even a stranded lock. Therefore we only use objc_copyRealizedClassList
when we know it's safe to do so by checking libSystemInitialized in
dyld_all_image_infos.

As a result, it's possible that the first time we read the Objective-C
runtime we are forced to use gdb_objc_realized_classes. This should be
fine, as there should be no lazily named classes at this point.
Subsequent queries will detect the change in realized class generation
count and use objc_copyRealizedClassList.

This patch keeps the old behavior when objc_copyRealizedClassList or
objc_debug_realized_class_generation_count are not available.

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

3 years ago[libcxxabi] Use cxx-headers target to consume libcxx headers
Petr Hosek [Wed, 10 Mar 2021 19:21:41 +0000 (11:21 -0800)]
[libcxxabi] Use cxx-headers target to consume libcxx headers

Rather than including libc++ include dir, use the cxx-headers target.

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

3 years agoRename the 'concept' variable in SymbolInterfaces.td
Sameer Rahmani [Fri, 26 Mar 2021 20:15:06 +0000 (20:15 +0000)]
Rename the 'concept' variable in  SymbolInterfaces.td

`concept` is a reserved keyword in C++20, it can't be used as a variable name.
Here is an example of the failure:

```
      auto *concept = getInterfaceFor(op);
            ^
include/mlir/IR/SymbolInterfaces.h.inc:156:12: error: expected expression [clang-diagnostic-error]
      if (!concept)
           ^
```

Reviewed By: mehdi_amini

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

3 years ago[ConstraintElimination] Only strip casts preserving the representation.
Florian Hahn [Fri, 26 Mar 2021 17:59:32 +0000 (17:59 +0000)]
[ConstraintElimination] Only strip casts preserving the representation.

Things like addrspacecast may not be no-ops, so we should not look
through them.

3 years ago[OpenCL][Docs] Minor update about C++ for OpenCL in UsersManual.
Anastasia Stulova [Fri, 26 Mar 2021 19:23:58 +0000 (19:23 +0000)]
[OpenCL][Docs] Minor update about C++ for OpenCL in UsersManual.

3 years ago[ValueTracking] Handle shl pair in isKnownNonEqual()
Nikita Popov [Fri, 26 Mar 2021 19:16:57 +0000 (20:16 +0100)]
[ValueTracking] Handle shl pair in isKnownNonEqual()

Handle (x << s) != (y << s) where x != y and the shifts are
non-wrapping. Once again, this establishes parity with the
corresponing mul fold that already exists. The shift case is
more powerful because we don't need to guard against multiplies
by zero.

3 years ago[ValueTracking] Handle shl in isKnownNonEqual()
Nikita Popov [Fri, 26 Mar 2021 19:12:55 +0000 (20:12 +0100)]
[ValueTracking] Handle shl in isKnownNonEqual()

This handles the pattern X != X << C for non-zero X and C and a
non-overflowing shift. This establishes parity with the corresponing
fold for multiplies.

3 years ago[ValueTracking] Add tests for non equal shifts (NFC)
Nikita Popov [Fri, 26 Mar 2021 19:06:51 +0000 (20:06 +0100)]
[ValueTracking] Add tests for non equal shifts (NFC)

3 years ago[Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts
Giorgis Georgakoudis [Fri, 26 Mar 2021 12:58:05 +0000 (05:58 -0700)]
[Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts

IR values convert to check prefix FileCheck variables for IR checks. For example, nameless values, e.g., %0, convert to check prefix TMP FileCheck variables, e.g., [[TMP0:%.*]]. This check prefix may clash with named values that have the same name and that causes auto-generated tests to fail. Currently a warning is emitted to change the names of the IR values but this is not always possible, if for example they are generated by clang. Manual intervention to fix the FileCheck variable names is too tedious. This patch add a parameter to prefix conflicting FileCheck variable names with a user-provided string to automate the process.

Reviewed By: jdoerfert

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

3 years ago[mlir] fix -Wsign-compare in memref unit tests
Alex Zinenko [Fri, 26 Mar 2021 18:37:05 +0000 (19:37 +0100)]
[mlir] fix -Wsign-compare in memref unit tests

3 years ago[lsan][test] Enable many_tls_keys_pthread.cpp and disable swapcontext.cpp/fork_and_le...
Fangrui Song [Fri, 26 Mar 2021 18:26:08 +0000 (11:26 -0700)]
[lsan][test] Enable many_tls_keys_pthread.cpp and disable swapcontext.cpp/fork_and_leak.cpp

With D98926, many_tls_keys_pthread.cpp appears to be working.

On glibc 2.30-0ubuntu2, swapcontext.cpp and Linux/fork_and_leak.cpp work fine
but they strangely fail on clang-cmake-aarch64-full
(https://lab.llvm.org/buildbot/#/builders/7/builds/2240).
Disable them for now.

Note: check-lsan was recently enabled on AArch64 in D98985. A test takes
10+ seconds. We should figure out the bottleneck.

3 years ago[ConstraintElimination] Add additional pointercast tests.
Florian Hahn [Fri, 26 Mar 2021 17:47:54 +0000 (17:47 +0000)]
[ConstraintElimination] Add additional pointercast tests.

Add coverage for pointercasts other than bitcast. addrspacecast are not
handled properly at the moment.

3 years ago[SLP] use dyn_cast instead of isa + cast; NFC
Sanjay Patel [Fri, 26 Mar 2021 17:52:01 +0000 (13:52 -0400)]
[SLP] use dyn_cast instead of isa + cast; NFC

3 years ago[Orc][examples] Factor out make_error from parseExampleModule (NFC)
Stefan Gränitz [Fri, 26 Mar 2021 17:43:29 +0000 (18:43 +0100)]
[Orc][examples] Factor out make_error from parseExampleModule (NFC)

3 years ago[Orc][examples] Fix copy/paste issues in comments and inclue guards (NFC)
Stefan Gränitz [Wed, 17 Mar 2021 13:22:41 +0000 (14:22 +0100)]
[Orc][examples] Fix copy/paste issues in comments and inclue guards (NFC)

3 years ago[ValueTracking] Handle non-zero shl recurrence
Nikita Popov [Fri, 26 Mar 2021 17:39:06 +0000 (18:39 +0100)]
[ValueTracking] Handle non-zero shl recurrence

In this case we don't care about the step at all, and only require
that the starting value is non-zero.

3 years ago[ValueTracking] Add tests for non-zero shl recurrences (NFC)
Nikita Popov [Fri, 26 Mar 2021 17:35:38 +0000 (18:35 +0100)]
[ValueTracking] Add tests for non-zero shl recurrences (NFC)

3 years ago[ValueTracking] Handle non-zero add/mul recurrences more precisely
Nikita Popov [Fri, 26 Mar 2021 17:14:30 +0000 (18:14 +0100)]
[ValueTracking] Handle non-zero add/mul recurrences more precisely

This is mainly for clarity: It doesn't make sense to do any
negative/positive checks when dealing with a nuw add/mul. These
only make sense to nsw add/mul.

3 years ago[ValueTracking] Add more non-zero add/mul recurrence tests (NFC)
Nikita Popov [Fri, 26 Mar 2021 17:10:56 +0000 (18:10 +0100)]
[ValueTracking] Add more non-zero add/mul recurrence tests (NFC)

3 years ago[OCaml][DebugInfo][Test] Disable debuginfo tests as they fail on some machines
Vaivaswatha Nagaraj [Fri, 26 Mar 2021 17:25:31 +0000 (22:55 +0530)]
[OCaml][DebugInfo][Test] Disable debuginfo tests as they fail on some machines

3 years ago[X86][AVX] combineHorizOpWithShuffle - improve SHUFFLE(HOP(LOSUBVECTOR(X),HISUBVECTOR...
Simon Pilgrim [Fri, 26 Mar 2021 16:15:19 +0000 (16:15 +0000)]
[X86][AVX] combineHorizOpWithShuffle - improve SHUFFLE(HOP(LOSUBVECTOR(X),HISUBVECTOR(X))) folding

Peek through bitcasts to find subvector splits and use getTargetShuffleInputs to decode target shuffles as well as ShuffleVectorSDNode

3 years ago[OCaml][Test] Do not use Option, expand using match
Vaivaswatha Nagaraj [Fri, 26 Mar 2021 17:09:58 +0000 (22:39 +0530)]
[OCaml][Test] Do not use Option, expand using match

Option seems to be unsupported on the buildbot version
of OCaml. So expand the statements using a match.

Fixes buildbot failure due to
https://github.com/llvm/llvm-project/commit/c244cd72172ca8941f9f67fc183ade8afcd61c17

3 years ago[BasicAA] Add a few more interesting modulo tests.
Florian Hahn [Fri, 26 Mar 2021 15:37:07 +0000 (15:37 +0000)]
[BasicAA] Add a few more interesting modulo tests.

3 years ago[OCaml][DebugInfo] Add tests for debug info API
Vaivaswatha Nagaraj [Fri, 26 Mar 2021 16:36:48 +0000 (22:06 +0530)]
[OCaml][DebugInfo] Add tests for debug info API

In the process of adding the tests, several bugs were
found in the implementation and interface of the API
and they were fixed.

Some utilities from the core tests (core.ml) were moved
into a separate file for reuse.

The following new functions have been added:
`dibuild_create_global_variable_expression`,
`dibuild_create_constant_value_expression` and
`llmetadata_null`. The third one already existed but
is now exposed publicly.

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

3 years ago[CMake][gRPC] Fix a typo in protobuf version variable name
Aleksandr Platonov [Fri, 26 Mar 2021 16:31:38 +0000 (19:31 +0300)]
[CMake][gRPC] Fix a typo in protobuf version variable name

Without this patch CMake log contains `Using protobuf` instead of `Using protobuf <version>`.

Reviewed By: kbobyrev

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

3 years ago[lldb] Skip TestVSCode_launch.test_progress_events on linux
Pavel Labath [Fri, 26 Mar 2021 16:23:50 +0000 (17:23 +0100)]
[lldb] Skip TestVSCode_launch.test_progress_events on linux

It's flaky everywhere, not just arm.

3 years ago[lldb] XFAIL TestGdbRemote_vContThreads on macos
Pavel Labath [Fri, 26 Mar 2021 16:23:22 +0000 (17:23 +0100)]
[lldb] XFAIL TestGdbRemote_vContThreads on macos

It seems debugserver does not implement these packets.

3 years ago[lldb] Really fix dwarf5-debug_line-file-index.s
Pavel Labath [Fri, 26 Mar 2021 16:16:53 +0000 (17:16 +0100)]
[lldb] Really fix dwarf5-debug_line-file-index.s

It's not enough the change the comment -- one has to actually change the
constant before it. :/

3 years ago[AMDGPU] Use reductions instead of scans in the atomic optimizer
Jay Foad [Fri, 19 Mar 2021 12:34:37 +0000 (12:34 +0000)]
[AMDGPU] Use reductions instead of scans in the atomic optimizer

If the result of an atomic operation is not used then it can be more
efficient to build a reduction across all lanes instead of a scan. Do
this for GFX10, where the permlanex16 instruction makes it viable. For
wave64 this saves a couple of dpp operations. For wave32 it saves one
readlane (which are generally bad for performance) and one dpp
operation.

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

3 years ago[mlir][python] NFC - Fix stale path in doc
Nicolas Vasilache [Thu, 25 Mar 2021 15:08:09 +0000 (15:08 +0000)]
[mlir][python] NFC - Fix stale path in doc

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

3 years ago[SystemZ][z/OS] exclude nasty_macros.h from check-cxx
Zbigniew Sarbinowski [Fri, 26 Mar 2021 15:02:40 +0000 (15:02 +0000)]
[SystemZ][z/OS] exclude nasty_macros.h from check-cxx

Need to exclude nasty_macros.h from check-cxx on z/OS due to conflicts within system headers.

Sample failure in `random_shuffle.depr_in_cxx14.verify.cpp` libcxx test.
```
error: 'error' diagnostics seen but not expected:
Line 1268: expected ')'
Line 1268: unknown type name 'This'
Line 1268: expected ')'
```

caused by the following  macros in `nasty_macros.h`
```
#define NASTY_MACRO This should not be expanded!!!
#define _E NASTY_MACRO
```
The name collision is observed in the following code snippet whre `_E` is being used as parameter name:
```
inline int iswalnum(wint_t _E) {return __iswalnum(_E);}
```

It is reasonable to exclude `nasty_macros.h` on z/OS similarly as it was done on Windows.

Reviewed By: #libc, ldionne

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

3 years ago[BasicAA] Add a few cases with overflows in index computations.
Florian Hahn [Fri, 26 Mar 2021 14:44:13 +0000 (14:44 +0000)]
[BasicAA] Add a few cases with overflows in index computations.

This patch adds a few test cases where currently NoAlias is returned,
but the pointers can alias if the multiply overflows while computing
a GEP index value.

3 years ago[SLP] move test for min/max crashing; NFC
Sanjay Patel [Fri, 26 Mar 2021 14:26:24 +0000 (10:26 -0400)]
[SLP] move test for min/max crashing; NFC

This was originally just an XFAIL test, but I modified it
to check output. To make that bot-friendly, I'm moving it
to the x86 dir since it specified an x86 target.

3 years ago[OpenCL] Fix AST check in address-space-templates test
Anastasia Stulova [Fri, 26 Mar 2021 14:21:23 +0000 (14:21 +0000)]
[OpenCL] Fix AST check in address-space-templates test

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

3 years ago[RISCV] Add constraint for RVV indexed loads.
Zakk Chen [Mon, 15 Mar 2021 14:22:12 +0000 (07:22 -0700)]
[RISCV] Add constraint for RVV indexed loads.

Add the constraint when destination EEW not equals the source EEW for
correctness.

The RVV spec has three register overlap rules and I implement the first
stricter constraint because the others are difficult to enforce.

Reviewed By: frasercrmck, craig.topper

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

3 years ago[SystemZ][z/OS] Ignore leading zero width bitfield alignment on z/OS target
Fanbo Meng [Fri, 26 Mar 2021 14:09:57 +0000 (10:09 -0400)]
[SystemZ][z/OS] Ignore leading zero width bitfield alignment on z/OS target

Zero length bitfield alignment is not respected if they are leading members on z/OS target.

Reviewed By: abhina.sreeskantharajan

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