platform/upstream/llvm.git
3 years ago[lldb][NFC] Add a FIXME for NameSearchContext::AddFunDecl's missing addDecl
Raphael Isemann [Tue, 10 Aug 2021 14:14:27 +0000 (16:14 +0200)]
[lldb][NFC] Add a FIXME for NameSearchContext::AddFunDecl's missing addDecl

3 years agoSet supported target for asan-use-callbacks test
Thomas Preud'homme [Fri, 6 Aug 2021 10:09:40 +0000 (11:09 +0100)]
Set supported target for asan-use-callbacks test

Explicitely set x86_64-linux-gnu as a target for asan-use-callbacks
clang test since some target do not support -fsanitize=address (e.g.
i386-pc-openbsd). Also remove redundant -fsanitize=address and move
-emit-llvm right after -S.

Reviewed By: vitalybuka

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

3 years ago[NFC] Add extra RUN line to strict reduction tests
David Sherwood [Tue, 10 Aug 2021 13:42:47 +0000 (14:42 +0100)]
[NFC] Add extra RUN line to strict reduction tests

I have added RUN lines to both:

  Transforms/LoopVectorize/AArch64/strict-fadd.ll
  Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll

to show the default behaviour is to not vectorise when the following
flag is unset:

  -force-ordered-reductions

3 years ago[clang] [hexagon] Add resource include dir
Brian Cain [Tue, 10 Aug 2021 04:03:06 +0000 (23:03 -0500)]
[clang] [hexagon] Add resource include dir

3 years agoRevert "[clangd] Support `#pragma mark` in the outline"
Florian Mayer [Tue, 10 Aug 2021 13:25:52 +0000 (14:25 +0100)]
Revert "[clangd] Support `#pragma mark` in the outline"

This reverts commit ba06ac8b45ca2ad047131fb9cc9af922cb913ea1.

3 years ago[Sema] Preserve invalid CXXCtorInitializers using RecoveryExpr in initializer
Sam McCall [Fri, 30 Apr 2021 15:21:02 +0000 (17:21 +0200)]
[Sema] Preserve invalid CXXCtorInitializers using RecoveryExpr in initializer

Before this patch, CXXCtorInitializers that don't typecheck get discarded in
most cases. In particular:

 - typos that can't be corrected don't turn into RecoveryExpr. The full expr
   disappears instead, and without an init expr we discard the node.
 - initializers that fail initialization (e.g. constructor overload resolution)
   are discarded too.

This patch addresses both these issues (a bit clunkily and repetitively, for
member/base/delegating initializers)

It does not preserve any AST nodes when the member/base can't be resolved or
other problems of that nature. That breaks invariants of CXXCtorInitializer
itself, and we don't have a "weak" RecoveryCtorInitializer like we do for Expr.

I believe the changes to diagnostics in existing tests are improvements.
(We're able to do some analysis on the non-broken parts of the initializer)

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

3 years ago[Parser] Fix attr infloop on "int x [[c"
Sam McCall [Sat, 7 Aug 2021 11:28:33 +0000 (13:28 +0200)]
[Parser] Fix attr infloop on "int x [[c"

Similar to ad2d6bbb1435cef0a048c9aed3dcf9617640f222

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

3 years ago[lldb] Add a test for user-defined objc_copyRealizedClassList_nolock
Raphael Isemann [Tue, 10 Aug 2021 12:46:54 +0000 (14:46 +0200)]
[lldb] Add a test for user-defined objc_copyRealizedClassList_nolock

LLDB evaluates some utility expression to update the Objective-C class list that
ends up calling function such as `free` or `objc_copyRealizedClassList_nolock`.
This adds a test that just tries to define our own bogus version of
`objc_copyRealizedClassList_nolock`. It just tests that LLDB doesn't crash as we
currently don't have a way to tell LLDB to look for the function in a specific
library.

Reviewed By: JDevlieghere

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

3 years ago[lldb] Add a test for potentially conflicting names for the Objective-C class update...
Raphael Isemann [Tue, 10 Aug 2021 12:38:33 +0000 (14:38 +0200)]
[lldb] Add a test for potentially conflicting names for the Objective-C class update utility expression

We recently had an issue where a user declared a `Class::free` function which
then got picked up by accident by the expression evaluator when calling
`::free`. This was due to a too lax filter in the DWARFIndex (which was fixed by
https://reviews.llvm.org/D73191 ). This broke the Objective-C utility expression
that is trying to update the Objective-C class list (which is calling `:;free`).

This adds a regression test for situations where we have a bunch of functions
defined that share the name of the global functions that this utility function
calls. None of them are actually conflicting with the global functions we are
trying to call (they are all in namespaces, objects or classes).

Reviewed By: JDevlieghere

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

3 years ago[AArch64] Correct sinking of shuffles to adds/subs
David Green [Tue, 10 Aug 2021 12:25:42 +0000 (13:25 +0100)]
[AArch64] Correct sinking of shuffles to adds/subs

This was checking extends as shuffles, where as we should be checking
the operands. This helps sink the shuffles, creating more addl/subl
instructions.

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

3 years ago[AArch64] Regenerate sink-free-instructions.ll. NFC
David Green [Tue, 10 Aug 2021 10:31:31 +0000 (11:31 +0100)]
[AArch64] Regenerate sink-free-instructions.ll. NFC

3 years agoAArch64: support @llvm.va_copy in GISel
Tim Northover [Wed, 4 Aug 2021 11:09:03 +0000 (12:09 +0100)]
AArch64: support @llvm.va_copy in GISel

3 years ago[hwasan] Fix test on x86.
Florian Mayer [Tue, 10 Aug 2021 11:50:46 +0000 (12:50 +0100)]
[hwasan] Fix test on x86.

Reviewed By: dvyukov

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

3 years ago[OpenCL] Make pipes and workgroup optional for -fdeclare-opencl-builtins
Sven van Haastregt [Tue, 10 Aug 2021 12:01:47 +0000 (13:01 +0100)]
[OpenCL] Make pipes and workgroup optional for -fdeclare-opencl-builtins

Align guards of these builtins with opencl-c.h.

3 years ago[GlobalISel] Look through truncs and extends in narrowScalarShift
Konstantin Schwarz [Thu, 8 Oct 2020 12:30:33 +0000 (14:30 +0200)]
[GlobalISel] Look through truncs and extends in narrowScalarShift

If a G_SHL is fed by a G_CONSTANT, the lower and upper bits of the source can be
shifted individually by the constant shift amount.

However in case the shift amount came from a G_TRUNC(G_CONSTANT), the generic shift legalization
code was used, producing intermediate shifts that are potentially illegal on some targets.

This change teaches narrowScalarShift to look through G_TRUNCs and G_*EXTs.

Reviewed By: paquette

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

3 years agoFix a bug in algebraic simplification, and enable the tests.
bakhtiyar [Mon, 9 Aug 2021 22:54:16 +0000 (15:54 -0700)]
Fix a bug in algebraic simplification, and enable the tests.

Reviewed By: ezhulenev

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

3 years ago[ORC-RT] Fix typo in path in f63b1bf7f49.
Lang Hames [Tue, 10 Aug 2021 11:04:44 +0000 (21:04 +1000)]
[ORC-RT] Fix typo in path in f63b1bf7f49.

rdar://81056700

3 years ago[ORC-RT] Include TLV support in x86-64 Haswell slice.
Lang Hames [Tue, 10 Aug 2021 06:10:38 +0000 (16:10 +1000)]
[ORC-RT] Include TLV support in x86-64 Haswell slice.

Darwin/MachO TLV support was only getting built into the x86_64 slice, not the
x86_64h slice. This caused errors when using the ORC runtime on Haswell
machines.

rdar://81056700

3 years ago[flang] Always create HostAssocDetails for host object symbols with UseDetails
Jean Perier [Tue, 10 Aug 2021 10:37:23 +0000 (12:37 +0200)]
[flang] Always create HostAssocDetails for host object symbols with UseDetails

https://reviews.llvm.org/D105464 did not correctly cover the case
where the symbol from the host procedure is use associated. Outside
of the mis-parsed ArrayRef case, flang was also creating a symbol with
HostAssociated details inside the internal procedure (pointing to the
use associated symbol in the host). That is what lowering expects.
This patch ensures the same logic is applied in the mis-parsed array-ref name
resolution (and the pointer target name resolution).

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

3 years ago[SimpifyCFG] Remove recursion from FoldCondBranchOnPHI. NFCI.
Carl Ritson [Tue, 10 Aug 2021 10:14:23 +0000 (19:14 +0900)]
[SimpifyCFG] Remove recursion from FoldCondBranchOnPHI. NFCI.

Avoid stack overflow errors on systems with small stack sizes
by removing recursion in FoldCondBranchOnPHI.

This is a simple change as the recursion was only iteratively
calling the function again on the same arguments.
Ideally this would be compiled to a tail call, but there is
no guarantee.

Reviewed By: lebedev.ri

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

3 years ago[IRBuilder][NFC] Clarify docs on fadd/fmul reductions
Fraser Cormack [Mon, 9 Aug 2021 10:49:46 +0000 (11:49 +0100)]
[IRBuilder][NFC] Clarify docs on fadd/fmul reductions

This patch aims to clear up any confusion in documentation for the
fadd/fmul reduction creation APIs with regards to the sequential and
unordered variations without changing the APIs themselves.

The scalar accumulator value isn't only used for sequential reduction
intrinsics so the impliciation to the contrary was dropped. Then I
thought it useful to make clear that the API always creates a sequential
reduction. And lastly a note to users on how it is possible to transform
the resulting reduction into an unordered one.

Reviewed By: craig.topper

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

3 years ago[llvm-ar] Add some test-cases for empty archives
Ben Dunbobbin [Tue, 10 Aug 2021 09:28:26 +0000 (10:28 +0100)]
[llvm-ar] Add some test-cases for empty archives

We had coverage of empty archive in our downstream testsuite.
This adds those cases upstream.

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

3 years ago[LLD][Test] Add thin archives to map file test
Ben Dunbobbin [Tue, 10 Aug 2021 09:19:54 +0000 (10:19 +0100)]
[LLD][Test] Add thin archives to map file test

This adds thin archives to the map file test.
I noticed that we had this test-case in our downstream
testsuite but it wasn't in the upstream testing.

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

3 years ago[NFC][X86] New Test Requires Asserts
Archibald Elliott [Tue, 10 Aug 2021 09:22:04 +0000 (10:22 +0100)]
[NFC][X86] New Test Requires Asserts

D105263 introduced this new test. It fails when asserts are disabled,
due to using a debug option on opt.

Reviewed By: pengfei

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

3 years ago[ARM] Change a couple of instances of LiveRegs.contains to !LiveRegs.available
David Green [Tue, 10 Aug 2021 08:53:26 +0000 (09:53 +0100)]
[ARM] Change a couple of instances of LiveRegs.contains to !LiveRegs.available

This changes a couple of calls to LiveRegs.contains to
!LiveRegs.available, one in Thumb1FrameLoweringInfo (which modifies a
test to look more correct to me, given r7 should be the frame pointer so
is not available), and another in the ARMLoadStoreOptimizer, that I
don't have a test for, it was just found by inspection.

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

3 years ago[AMDGPU] Support non-strictly stronger memory orderings in SIMemoryLegalizer
Tony Tye [Fri, 23 Jul 2021 19:38:36 +0000 (19:38 +0000)]
[AMDGPU] Support non-strictly stronger memory orderings in SIMemoryLegalizer

C++20 no longer requires the failure memory ordering to be no stronger than the
success memory ordering. Adjust assert in AMD GPU SIMemoryLegalizer, and merge
instruction memory orderings

Add common operation to merge memory orders that allows non strict memory
orderings to be combined. Use it in SIMemoryLegalizer and
MachineMemOperand::getMergedOrdering.

Reviewed By: efriedma, rampitec

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

3 years ago[hwasan] State correct PC in first error message.
Florian Mayer [Thu, 5 Aug 2021 16:25:10 +0000 (17:25 +0100)]
[hwasan] State correct PC in first error message.

We would put the return address there, rather than the fault address.

Reviewed By: eugenis

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

3 years ago[InstCombine] Add more complex folds for extractelement + stepvector
David Sherwood [Mon, 19 Jul 2021 14:18:05 +0000 (15:18 +0100)]
[InstCombine] Add more complex folds for extractelement + stepvector

I have updated cheapToScalarize to also consider the case when
extracting lanes from a stepvector intrinsic. This required removing
the existing 'bool IsConstantExtractIndex' and passing in the actual
index as a Value instead. We do this because we need to know if the
index is <= known minimum number of elements returned by the stepvector
intrinsic. Effectively, when extracting lane X from a stepvector we
know the value returned is also X.

New tests added here:

  Transforms/InstCombine/vscale_extractelement.ll

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

3 years ago[NFC] Fix typo in comment
Vitaly Buka [Tue, 10 Aug 2021 08:11:42 +0000 (01:11 -0700)]
[NFC] Fix typo in comment

3 years ago[sanitizer] Intercept sem_open/sem_unlink
Vitaly Buka [Fri, 6 Aug 2021 02:47:48 +0000 (19:47 -0700)]
[sanitizer] Intercept sem_open/sem_unlink

Without interceptor implementation may call strlen on internal
buffers causing false msan errors.

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

3 years ago[libcxx] [test] Convert an XFAIL: LIBCXX-WINDOWS-FIXME into XFAIL: msvc
Martin Storsjö [Mon, 31 May 2021 08:40:30 +0000 (08:40 +0000)]
[libcxx] [test] Convert an XFAIL: LIBCXX-WINDOWS-FIXME into XFAIL: msvc

This one already had a proper explanation why it fails, which is due to
differences by design in MSVC mode. This isn't a fixme, so degrade the
annotation to a more permanent "XFAIL: msvc" instead.

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

3 years ago[libcxx] [test] Fix the new_faligned_allocation.pass.cpp test for MSVC
Martin Storsjö [Mon, 9 Aug 2021 10:27:40 +0000 (10:27 +0000)]
[libcxx] [test] Fix the new_faligned_allocation.pass.cpp test for MSVC

Such environments do have aligned allocation functions these days, but
the RTTI type name test needs to be adjusted for the MSVC C++ ABI.

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

3 years ago[libcxx] [test] Generalize defines for skipping allocation checks
Martin Storsjö [Mon, 9 Aug 2021 10:57:55 +0000 (13:57 +0300)]
[libcxx] [test] Generalize defines for skipping allocation checks

This allows waiving the right amount of asserts on Windows and zOS.
This should supersede D107124 and D105910.

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

3 years ago[AArch64][SVE] NFC: Remove unused p0-p7 with element size predicates
Cullen Rhodes [Tue, 10 Aug 2021 07:36:06 +0000 (07:36 +0000)]
[AArch64][SVE] NFC: Remove unused p0-p7 with element size predicates

Reviewed By: paulwalker-arm

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

3 years ago[IR] Let ConstantVector::getSplat use poison instead of undef
David Sherwood [Mon, 9 Aug 2021 10:36:41 +0000 (11:36 +0100)]
[IR] Let ConstantVector::getSplat use poison instead of undef

This patch updates ConstantVector::getSplat to use poison instead
of undef when using insertelement/shufflevector to splat.

This follows on from D93793.

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

3 years ago[mlir] NFC Replace some code snippets with equivalent method calls
Tres Popp [Mon, 9 Aug 2021 11:15:31 +0000 (13:15 +0200)]
[mlir] NFC Replace some code snippets with equivalent method calls

Replace some code snippets With scf::ForOp methods. Additionally,
share a listener at one more point (although this pattern is still
not safe to roll back currently)

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

3 years ago[gn build] Port 6f7f5b54c81b
LLVM GN Syncbot [Tue, 10 Aug 2021 04:47:01 +0000 (04:47 +0000)]
[gn build] Port 6f7f5b54c81b

3 years ago[X86] AVX512FP16 instructions enabling 1/6
Wang, Pengfei [Tue, 10 Aug 2021 03:18:40 +0000 (11:18 +0800)]
[X86] AVX512FP16 instructions enabling 1/6

1. Enable FP16 type support and basic declarations used by following patches.
2. Enable new instructions VMOVW and VMOVSH.

Ref.: https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html

Reviewed By: LuoYuanke

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

3 years ago[Driver][test] Improve avr-toolchain.c
Fangrui Song [Tue, 10 Aug 2021 03:25:33 +0000 (20:25 -0700)]
[Driver][test] Improve avr-toolchain.c

Reviewed By: benshi001, mhjacobson

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

3 years ago[mlir][Analysis][NFC] Disambiguate FlatAffineConstraints constructor
Matthias Springer [Tue, 10 Aug 2021 01:33:05 +0000 (10:33 +0900)]
[mlir][Analysis][NFC] Disambiguate FlatAffineConstraints constructor

The following constructor call (and others) used to be ambiguous:

```
FlatAffineConstraints constraints(0, 0, 0);
```

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

3 years ago[mlir][Analysis] Revert D107221
Matthias Springer [Tue, 10 Aug 2021 01:16:50 +0000 (10:16 +0900)]
[mlir][Analysis] Revert D107221

This is in preparation of a larger refactoring that makes the changes in D107221 obsolete.

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

3 years ago[AIX]: Fix option processing for -b
Ettore Tiotto [Mon, 9 Aug 2021 23:52:31 +0000 (19:52 -0400)]
[AIX]: Fix option processing for -b

Code added by D106688 has a problem. It passes the option -bxyz to the system linker as -b xyz xyz (duplication of the string 'xyz' is incorrect). This patch fixes that oversight.

Reviewed by: hubert.reinterpretcast, jsji

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

3 years ago[HIP] Allow target addr space in target builtins
Anshil Gandhi [Mon, 9 Aug 2021 22:38:04 +0000 (16:38 -0600)]
[HIP] Allow target addr space in target builtins

This patch allows target specific addr space in target builtins for HIP. It inserts implicit addr
space cast for non-generic pointer to generic pointer in general, and inserts implicit addr
space cast for generic to non-generic for target builtin arguments only.

It is NFC for non-HIP languages.

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

3 years ago[gn build] Port 9d982c67ba01
LLVM GN Syncbot [Mon, 9 Aug 2021 22:10:24 +0000 (22:10 +0000)]
[gn build] Port 9d982c67ba01

3 years ago[libcxx][ranges] Add `ranges::reverse_view`.
zoecarver [Thu, 29 Jul 2021 00:11:04 +0000 (17:11 -0700)]
[libcxx][ranges] Add `ranges::reverse_view`.

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

3 years ago[libc++][NFC] Remove workaround for variadic templates in C++03
Louis Dionne [Mon, 9 Aug 2021 17:26:04 +0000 (13:26 -0400)]
[libc++][NFC] Remove workaround for variadic templates in C++03

That's not necessary anymore, since we always build the dylib with
C++11 capabilities nowadays.

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

3 years ago[AArch64][SVE][InstCombine] Unpack of a splat vector -> Scalar extend
Usman Nadeem [Fri, 6 Aug 2021 00:23:01 +0000 (17:23 -0700)]
[AArch64][SVE][InstCombine] Unpack of a splat vector -> Scalar extend

Replace vector unpack operation with a scalar extend operation.
  unpack(splat(X)) --> splat(extend(X))

If we have both, unpkhi and unpklo, for the same vector then we may
save a register in some cases, e.g:
  Hi = unpkhi (splat(X))
  Lo = unpklo(splat(X))
   --> Hi = Lo = splat(extend(X))

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

Change-Id: I77c5c201131e3a50de1cdccbdcf84420f5b2244b

3 years ago[AArch64][SVE][InstCombine] Move last{a,b} before binop if one operand is a splat...
Usman Nadeem [Wed, 28 Jul 2021 04:02:32 +0000 (21:02 -0700)]
[AArch64][SVE][InstCombine] Move last{a,b} before binop if one operand is a splat value

Move the last{a,b} operation to the vector operand of the binary instruction if
the binop's operand is a splat value. This essentially converts the binop
to a scalar operation.

Example:
    // If x and/or y is a splat value:
    lastX (binop (x, y)) --> binop(lastX(x), lastX(y))

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

Change-Id: I93ff5302f9a7972405ee0d3854cf115f072e99c0

3 years ago[lldb] [cmake] Add LLVM_LIT_ARGS override support for standalone builds
Michał Górny [Sat, 7 Aug 2021 20:06:20 +0000 (22:06 +0200)]
[lldb] [cmake] Add LLVM_LIT_ARGS override support for standalone builds

Add a LLVM_LIT_ARGS cached variable in order to make it possible
to override lit arguments when doing standalone builds.  Without that,
the user variable is ignored and the default options are always used.

Based on a similar solution found in clang.

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

3 years ago[clangd] Support `#pragma mark` in the outline
David Goldman [Mon, 12 Jul 2021 16:29:48 +0000 (12:29 -0400)]
[clangd] Support `#pragma mark` in the outline

Xcode uses `#pragma mark -` to draw a divider in the outline view
and `#pragma mark Note` to add `Note` in the outline view. For more
information, see https://nshipster.com/pragma/.

Since the LSP spec doesn't contain dividers for the symbol outline,
instead we treat `#pragma mark -` as a group with children - the
decls that come after it, implicitly terminating when the symbol's
parent ends.

The following code:

```
@implementation MyClass

- (id)init {}

- (int)foo;
@end
```

Would give an outline like

```
MyClass
        > Overrides
                    > init
        > Public Accessors
                    > foo
```

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

3 years agoCloned from CL 389610703 by 'g4 patch'.
Alexander Belyaev [Mon, 9 Aug 2021 19:48:38 +0000 (21:48 +0200)]
Cloned from CL 389610703 by 'g4 patch'.
Original change by pifon@pifon:tfrt_clean:6896:citc on 2021/08/09 05:30:17.

Ad b

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

3 years ago[mlir][sparse] add an elaborate sparse storage scheme integration test
Aart Bik [Mon, 9 Aug 2021 17:45:48 +0000 (10:45 -0700)]
[mlir][sparse] add an elaborate sparse storage scheme integration test

Looks "under the hood" of the sparse stogage schemes.
Users should typically not be interested in these details
(hey, that is why we have "sparse compilers"!) but this
test makes sure the compact contents are as expected.

Reviewed By: ThomasRaoux, bixia

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

3 years ago[lldb] [test] Skip Expr/nodefaultlib.cpp test if LD_PRELOAD Is used
Michał Górny [Sat, 7 Aug 2021 20:44:19 +0000 (22:44 +0200)]
[lldb] [test] Skip Expr/nodefaultlib.cpp test if LD_PRELOAD Is used

Some LD_PRELOAD-ed libraries tend to interact badly with --nodefaultlib,
particularly Gentoo sandbox.  Do not run this test if LD_PRELOAD is
present in the running environment.

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

3 years ago[libc++] Refactor __perfect_forward, bind_front and not_fn
Louis Dionne [Fri, 30 Jul 2021 18:38:14 +0000 (14:38 -0400)]
[libc++] Refactor __perfect_forward, bind_front and not_fn

This patch fixes the constrains on the __perfect_forward constructor
and its call operators, which were incorrect. In particular, it makes
sure that we closely follow [func.require], which basically says that
we must deliver the bound arguments with the appropriate value category
or make the call ill-formed, but not silently fall back to using a
different value category.

As a fly-by, this patch also:
- Adds types __bind_front_t and __not_fn_t to make the result of
  calling bind_front and not_fn more opaque, and improve diagnostics
  for users.
- Adds a bunch of tests for bind_front and remove some that are now
  redundant.
- Adds some missing _LIBCPP_HIDE_FROM_ABI annotations.

Immense thanks to @tcanens for raising awareness about this issue, and
providing help with the = delete bits.

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

3 years ago[libc++] Add timeout to BuildKite jobs
Louis Dionne [Mon, 9 Aug 2021 13:42:24 +0000 (09:42 -0400)]
[libc++] Add timeout to BuildKite jobs

We just had a case where a build bot stalled in an infinite loop during
testing, and the whole pipeline got stuck. To avoid that from happening
in the future, use a timeout on BuildKite jobs.

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

3 years agoRevert "Reapply "[lit] Have REQUIRES support the target triple""
Paul Robinson [Mon, 9 Aug 2021 19:14:16 +0000 (12:14 -0700)]
Revert "Reapply "[lit] Have REQUIRES support the target triple""

This reverts commit 187c69e9efcf2f595943412f21e8ba58de749a22.
compiler-rt/test/cross_over_uniform_dist.test refuses to pass.

3 years agoRevert "[compiler-rt] Speculative fix for cross_over_uniform_dist.test"
Paul Robinson [Mon, 9 Aug 2021 19:13:24 +0000 (12:13 -0700)]
Revert "[compiler-rt] Speculative fix for cross_over_uniform_dist.test"

This reverts commit dc11e69dd4089ba66733d25b182fedee9b54ac81.
The speculative fix did not help.

3 years ago[mlir][sparse] add dense to sparse conversion implementation
Aart Bik [Sat, 7 Aug 2021 00:06:46 +0000 (17:06 -0700)]
[mlir][sparse] add dense to sparse conversion implementation

Implements lowering dense to sparse conversion, for static tensor types only.
First step towards general sparse_tensor.convert support.

Reviewed By: ThomasRaoux

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

3 years ago[AArch64] Implement FCOPYSIGN for SVE.
Eli Friedman [Thu, 5 Aug 2021 22:30:36 +0000 (15:30 -0700)]
[AArch64] Implement FCOPYSIGN for SVE.

I was originally going to try to implement this in target-independent
code, but it's actually sort of tricky to generate the correct sequence
for vectors like nxv2f32.  So just stick this in target-specific code,
at least for now.

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

3 years ago[flang] Silence new build warning
peter klausler [Mon, 9 Aug 2021 18:55:36 +0000 (11:55 -0700)]
[flang] Silence new build warning

Some build environments complain about unused data members in some
C++ translations of Fortran derived types; those members don't really
need to be present, so remove them.

Fix pushed w/o review to get build bots running again.

3 years agoRevert "[sanitizer] Intercept sem_open/sem_unlink"
Florian Mayer [Mon, 9 Aug 2021 18:50:31 +0000 (19:50 +0100)]
Revert "[sanitizer] Intercept sem_open/sem_unlink"

This reverts commit 69a909b9fefeec5d4ece6f3162f8332f125ea202.

3 years ago[sanitizer] Intercept sem_open/sem_unlink
Vitaly Buka [Fri, 6 Aug 2021 02:47:48 +0000 (19:47 -0700)]
[sanitizer] Intercept sem_open/sem_unlink

Without interceptor implementation may call strlen on internal
buffers causing false msan errors.

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

3 years ago[coro] Correct CurrentBlock tracking bug recently introduced
Arnold Schwaighofer [Wed, 4 Aug 2021 20:03:42 +0000 (13:03 -0700)]
[coro] Correct CurrentBlock tracking bug recently introduced

We use the CurrentBlock to determine whether we have already processed a
block. Don't reuse this variable for setting where we should insert the
rematerialization. The rematerialization block is different to the
current block when we rematerialize for coro suspend block users.

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

3 years ago[lldb] [test] Skip all vFile tests on Windows
Michał Górny [Mon, 9 Aug 2021 17:37:44 +0000 (19:37 +0200)]
[lldb] [test] Skip all vFile tests on Windows

3 years agoRevert "[lldb] [test] Mark new vFile tests as XFAIL on Windows"
Michał Górny [Mon, 9 Aug 2021 17:36:29 +0000 (19:36 +0200)]
Revert "[lldb] [test] Mark new vFile tests as XFAIL on Windows"

This reverts commit 0dc57a66a0b1aa2cac88e236f7748b022666bdc5.

3 years agoRevert "[lldb] [test] Use Windows-friendly modes in vFile O_CREAT tests"
Michał Górny [Mon, 9 Aug 2021 17:33:10 +0000 (19:33 +0200)]
Revert "[lldb] [test] Use Windows-friendly modes in vFile O_CREAT tests"

This reverts commit 116b112bbfe043aba16d732c2eec783f0b817bb4.

3 years ago[InstCombine] Remove nnan requirement for transformation to fabs from select
Krishna [Mon, 9 Aug 2021 17:11:51 +0000 (22:41 +0530)]
[InstCombine] Remove nnan requirement for transformation to fabs from select

In this patch, the "nnan" requirement is removed for the canonicalization of select with fcmp to fabs.
(i) FSub logic: Remove check for nnan flag presence in fsub. Example: https://alive2.llvm.org/ce/z/751svg (fsub).
(ii) FNeg logic: Remove check for the presence of nnan and nsz flag in fneg. Example: https://alive2.llvm.org/ce/z/a_fsdp (fneg).

Reviewed By: spatel

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

3 years ago[cuda] Mark builtin texture/surface reference variable as 'externally_initialized'.
Michael Liao [Sun, 8 Aug 2021 15:28:28 +0000 (11:28 -0400)]
[cuda] Mark builtin texture/surface reference variable as 'externally_initialized'.

- They need to be preserved even if there's no reference within the
  device code as the host code may need to initialize them based on the
  application logic.

Reviewed By: tra

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

3 years ago[compiler-rt] Speculative fix for cross_over_uniform_dist.test
Paul Robinson [Mon, 9 Aug 2021 17:16:35 +0000 (10:16 -0700)]
[compiler-rt] Speculative fix for cross_over_uniform_dist.test

This change makes the REQUIRES clause unambiguously use triple-relative
feature names, in case that helps fix the bot failure seen at
https://lab.llvm.org/buildbot/#/builders/37/builds/5998

3 years ago[flang] Make `flang` translate `-M{fixed|free}` into `-f{fixed|free}-form`
Andrzej Warzynski [Thu, 29 Jul 2021 14:58:22 +0000 (15:58 +0100)]
[flang] Make `flang` translate `-M{fixed|free}` into `-f{fixed|free}-form`

We are only adding this in `flang` - the bash wrapper script for the
driver. We don't have any specific plans to support `-M{fixed|free}` in
`flang-new` (i.e. the actual driver).

That feature was requested by one of our users.

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

3 years ago[openmp] Do not use shared memory on Android
Pirama Arumuga Nainar [Fri, 30 Jul 2021 17:06:05 +0000 (10:06 -0700)]
[openmp] Do not use shared memory on Android

Android provides ashmem/ASharedMemory support on newer releases, which
we can use if requested by openmp users on Android.

Also refactor the preprocessor check for using shared memory to
kmp_config.h.cmake.

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

3 years ago[flang] Implement runtime Assign()
peter klausler [Thu, 29 Jul 2021 19:02:45 +0000 (12:02 -0700)]
[flang] Implement runtime Assign()

Define an API for, and implement, runtime support for arbitrary
assignment of one descriptor's data to another, with full support for
(re)allocation of allocatables with finalization when necessary,
user-defined derived type assignment TBP calls, and intrinsic (default)
componentwise assignment of derived type instances with allocation of
automatic components.  Also clean up API and implementation of
finalization/destruction using knowledge gained while studying
edge cases for assignment in the 2018 standard.

The look-up procedure for special procedure bindings in derived
types has been optimized from O(N) to O(1) since it will probably
matter more.  This required some analysis in runtime derived type
description table construction in semantics and some changes to the
table schemata.

Executable Fortran tests have been developed; they'll be added
to the test base once they can be lowered and run by f18.

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

3 years ago[libc++][doc] Improve contributor documentation.
Mark de Wever [Thu, 5 Aug 2021 19:34:52 +0000 (21:34 +0200)]
[libc++][doc] Improve contributor documentation.

Shorty before branching  LLVM 13 a new CMake option was added. This
option `LIBCXX_ENABLE_INCOMPLETE_FEATURES` lacks the contributor
documentation. This patch rectifies that issue.

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

3 years ago[libc++][NFC] Remove MSVC specific code.
Mark de Wever [Sun, 8 Aug 2021 09:02:07 +0000 (11:02 +0200)]
[libc++][NFC] Remove MSVC specific code.

Switching `__builtin_clzll`  to `__libcpp_clz` should work on all
platforms and no longer require MSVC specific code.

Reviewed By: #libc, ldionne

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

3 years ago[lldb][NFC] Remove never read member variable IOHandler::m_editing
Raphael Isemann [Mon, 9 Aug 2021 15:53:21 +0000 (17:53 +0200)]
[lldb][NFC] Remove never read member variable IOHandler::m_editing

The last read access to this variable was removed in 2015 in
4446487d71c52a925c04acfcae44dec8a8d62e00 .

3 years ago[lldb] [test] Mark vFile tests as LLGS-specific
Michał Górny [Mon, 9 Aug 2021 15:43:37 +0000 (17:43 +0200)]
[lldb] [test] Mark vFile tests as LLGS-specific

3 years ago[lldb] Fix break introduced in 14735ca
Robin Giese [Mon, 9 Aug 2021 15:16:12 +0000 (17:16 +0200)]
[lldb] Fix break introduced in 14735ca

The `File::OpenOptions` were renamed; this fixes up a callsite that breaks for
macOS builds. (See
https://github.com/llvm/llvm-project/commit/14735cab655441ba45c4b88ad82f11267e5fe916)

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

3 years ago[Flang] Ported test_symbols to Python
Ivan Zhechev [Mon, 9 Aug 2021 14:44:27 +0000 (15:44 +0100)]
[Flang] Ported test_symbols to Python

Due to unavailability of Flang testing on Windows, the shell scripts
are being ported to Python. The following changes are being made in
this patch: removed test_symbols.sh and common.sh, and ported them
to Python. Changes to the tests themselves so that they use the
python scripts instead of the shell script.

Reviewed By: Meinersbur, awarzynski, kiranchandramohan

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

3 years agoUpdate: clang/test/Profile/gcc-flag-compatibility.c to have -flto on AIX
Mark Danial [Mon, 9 Aug 2021 14:24:22 +0000 (14:24 +0000)]
Update: clang/test/Profile/gcc-flag-compatibility.c to have -flto on AIX

Reviewed By: Whitney

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

3 years ago[DWARF] Remove findRange (NFC)
Kazu Hirata [Mon, 9 Aug 2021 14:27:04 +0000 (07:27 -0700)]
[DWARF] Remove findRange (NFC)

The last use was removed on Apr 15, 2019 in commit
f56a436891e998363bcc02ea09a58d38e0b39da3.

3 years ago[libc] Update size distributions for memory benchmarks
Guillaume Chatelet [Mon, 9 Aug 2021 14:05:22 +0000 (14:05 +0000)]
[libc] Update size distributions for memory benchmarks

All distributions have been updated using 7 days worth of data.

3 years ago[AArch64][SVE] Fix assertion failure when lowering fixed length gather/scatter
Bradley Smith [Thu, 5 Aug 2021 13:15:47 +0000 (13:15 +0000)]
[AArch64][SVE] Fix assertion failure when lowering fixed length gather/scatter

The patterns for fixed length gather/scatter with 32-bit offsets and
64-bit memory type are slightly different that the rest of the patterns,
as such the lowering needs to be slightly different to ensure the
correct types are used.

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

3 years ago[Test] Precommit tests for PR50555
Anton Afanasyev [Mon, 9 Aug 2021 10:01:09 +0000 (13:01 +0300)]
[Test] Precommit tests for PR50555

3 years agoReapply "[lit] Have REQUIRES support the target triple"
Paul Robinson [Mon, 9 Aug 2021 13:38:28 +0000 (06:38 -0700)]
Reapply "[lit] Have REQUIRES support the target triple"

This reverts commit 3229c971512404c512e041c3e88f22dbec2b650b.

With a2acac6 in place this should provide enough info to work out
any repeat of the failure in cross_ovver_uniform_dist.test.

3 years ago[lldb] [test] Use Windows-friendly modes in vFile O_CREAT tests
Michał Górny [Mon, 9 Aug 2021 13:42:17 +0000 (15:42 +0200)]
[lldb] [test] Use Windows-friendly modes in vFile O_CREAT tests

3 years ago[lldb] [test] Mark new vFile tests as XFAIL on Windows
Michał Górny [Mon, 9 Aug 2021 13:38:38 +0000 (15:38 +0200)]
[lldb] [test] Mark new vFile tests as XFAIL on Windows

3 years ago[libc++] [test] IWYU in <concepts> tests.
Arthur O'Dwyer [Fri, 6 Aug 2021 18:35:03 +0000 (14:35 -0400)]
[libc++] [test] IWYU in <concepts> tests.

3 years ago[OpenCL] Add missing virtual destructor
Sven van Haastregt [Mon, 9 Aug 2021 12:42:37 +0000 (13:42 +0100)]
[OpenCL] Add missing virtual destructor

Followup after f9ffe61fb53f ("[OpenCL] Factor out
OpenCLBuiltinFileEmitterBase; NFC", 2021-08-09) introduced a
-Wnon-virtual-dtor warning.

3 years ago[lldb] [test] Fix TestGdbRemotePlatformFile with non-022 umask
Michał Górny [Mon, 9 Aug 2021 12:11:32 +0000 (14:11 +0200)]
[lldb] [test] Fix TestGdbRemotePlatformFile with non-022 umask

3 years agoHave compiler-rt/test/fuzzer report info to help diagnose a test issue
Paul Robinson [Mon, 9 Aug 2021 12:10:42 +0000 (05:10 -0700)]
Have compiler-rt/test/fuzzer report info to help diagnose a test issue

3 years ago[DWARF] Revert sharing subprograms across CUs
Jeremy Morse [Mon, 9 Aug 2021 11:40:21 +0000 (12:40 +0100)]
[DWARF] Revert sharing subprograms across CUs

This patch is a revert of e08f205f5c2c. In that patch, DW_TAG_subprograms
were permitted to be referenced across CU boundaries, to improve stack
trace construction using call site information. Unfortunately, as
documented in PR48790, the way that subprograms are "owned" by dwarf units
is sufficiently complicated that subprograms end up in unexpected units,
invalidating cross-unit references.

There's no obvious way to easily fix this, and several attempts have
failed. Revert this to ensure correct DWARF is always emitted.

Three tests change in addition to the reversion, but they're all very
light alterations.

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

3 years ago[DWARF5] Fix offset check when using .debug_names
Kim-Anh Tran [Mon, 9 Aug 2021 11:14:41 +0000 (13:14 +0200)]
[DWARF5] Fix offset check when using .debug_names

When going through the CU entries in the name index,
make sure to compare the name entry's CU
offset against the skeleton CU's offset.

Previously there would be a mismatch, since the
wrong offset was compared, and thus no suitable
entry was found.

Reviewed By: jankratochvil

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

3 years ago[OpenCL] Factor out OpenCLBuiltinFileEmitterBase; NFC
Sven van Haastregt [Mon, 9 Aug 2021 10:41:25 +0000 (11:41 +0100)]
[OpenCL] Factor out OpenCLBuiltinFileEmitterBase; NFC

Factor out functionality that can be shared with a header file emitter
that is to be added in the future.

3 years ago[lldb] [gdb-remote] Use hexadecimal numbers in vFile packats for GDB compliance
Michał Górny [Wed, 4 Aug 2021 16:17:34 +0000 (18:17 +0200)]
[lldb] [gdb-remote] Use hexadecimal numbers in vFile packats for GDB compliance

Use hexadecimal numbers rather than decimal in various vFile packets
in order to fix compatibility with gdbserver.  This also changes the few
custom LLDB packets -- while technically they do not have to be changed,
it is easier to use the same syntax consistently across LLDB.

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

3 years ago[lldb] [gdb-remote] Sync vFile:open mode constants with GDB
Michał Górny [Wed, 28 Jul 2021 18:37:52 +0000 (20:37 +0200)]
[lldb] [gdb-remote] Sync vFile:open mode constants with GDB

Sync the mode constants used to drive vFile:open requests with these
used by GDB and defined for the gdb remote protocol.  This makes it
possible to use 'platform file open' after connecting to gdbremote
server (and to some degree to operate on the open file modulo other
incompatibilities).

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

3 years ago[lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compat
Michał Górny [Wed, 28 Jul 2021 18:07:03 +0000 (20:07 +0200)]
[lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compat

Modify OpenOptions enum to open the future path into synchronizing
vFile:open bits with GDB.  Currently, LLDB and GDB use different flag
models effectively making it impossible to match bits.  Notably, LLDB
uses two bits to indicate read and write status, and uses union of both
for read/write.  GDB uses a value of 0 for read-only, 1 for write-only
and 2 for read/write.

In order to future-proof the code for the GDB variant:

1. Add a distinct eOpenOptionReadWrite constant to be used instead
   of (eOpenOptionRead | eOpenOptionWrite) when R/W access is required.

2. Rename eOpenOptionRead and eOpenOptionWrite to eOpenOptionReadOnly
   and eOpenOptionWriteOnly respectively, to make it clear that they
   do not mean to be combined and require update to all call sites.

3. Use the intersection of all three flags when matching against
   the three possible values.

This commit does not change the actual bits used by LLDB.

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

3 years ago[mlir] support nD vector forms of shifts in std-to-llvm conversion
Alex Zinenko [Mon, 9 Aug 2021 09:07:54 +0000 (11:07 +0200)]
[mlir] support nD vector forms of shifts in std-to-llvm conversion

These ops were not ported to the nD vector conversion when it was introduced
and nobody needed them so far.

Reviewed By: gysit

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

3 years ago[RISCV] Improve codegen for shuffles with LHS/RHS splats
Fraser Cormack [Wed, 4 Aug 2021 10:07:34 +0000 (11:07 +0100)]
[RISCV] Improve codegen for shuffles with LHS/RHS splats

Shuffles which are broken into separate halves reveal splats in which
a half is accessed via one index; such operations can be optimized to
use "vrgather.vi".

This optimization could be achieved by adding extra patterns to match
`vrgather_vv_vl` which uses a splat as an index operand, but this patch
instead identifies splat earlier. This way, future optimizations can
build on top of the data gathered here, e.g., to splat-gather dominant
indices and insert any leftovers.

Reviewed By: craig.topper

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

3 years ago[RISCV] Half-precision for vget/vset.
Hsiangkai Wang [Tue, 3 Aug 2021 23:57:13 +0000 (07:57 +0800)]
[RISCV] Half-precision for vget/vset.

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

3 years ago[RISCV] Add tests covering shuffles which can be optimized
Fraser Cormack [Tue, 3 Aug 2021 16:02:43 +0000 (17:02 +0100)]
[RISCV] Add tests covering shuffles which can be optimized

These shuffles all take the form of a "splat" of the LHS and/or RHS to
some degree, with one or two elements needing patched up afterwards. We
currently lower all of these to full LHS/RHS vector-index shuffles with
vrgather.vv.

Reviewed By: craig.topper

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