platform/upstream/llvm.git
3 years agotsan: remove indirection when selecting the active mapping
Dmitry Vyukov [Sat, 7 Aug 2021 18:10:54 +0000 (20:10 +0200)]
tsan: remove indirection when selecting the active mapping

Currently there are 2 levels when selecting the active mapping:
the branchy ifdef tree + another ifdef tree in SelectMapping.
Moreover, there is an additional indirection for some platforms
via HAS_48_BIT_ADDRESS_SPACE define. This makes already complex
logic even more complex and almost impossible to read.
Remove one level of indirection and define the active mapping
in SelectMapping.

Depends on D107742.

Reviewed By: melver

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

3 years agotsan: remove dependencies on HAS_48_BIT_ADDRESS_SPACE and Mapping
Dmitry Vyukov [Sun, 8 Aug 2021 10:20:48 +0000 (12:20 +0200)]
tsan: remove dependencies on HAS_48_BIT_ADDRESS_SPACE and Mapping

Remove direct uses of Mapping in preperation for removing Mapping type
(which we already don't have for all platforms).
Remove dependence on HAS_48_BIT_ADDRESS_SPACE in preparation for removing it.
As far as I see for Apple/Mac platforms !HAS_48_BIT_ADDRESS_SPACE
simply means SANITIZER_IOS.

Depends on D107741.

Reviewed By: melver

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

3 years agotsan: unit-test all mappings
Dmitry Vyukov [Sat, 7 Aug 2021 11:07:00 +0000 (13:07 +0200)]
tsan: unit-test all mappings

Move the mapping checking logic from startup to unit tests
and test all mapping instead of just the active one.
This makes it much more feasible to make any global changes
to the mappings since we have 17 of them.

Depends on D107740.

Reviewed By: vitalybuka, melver

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

3 years agotsan: unify all shadow mappings
Dmitry Vyukov [Sat, 7 Aug 2021 14:05:15 +0000 (16:05 +0200)]
tsan: unify all shadow mappings

Currently we have ifdef's for Go/C++ and Windows/non-Windows
in MemToShadow, MemToMeta, ShadowToMem. This does not allow
to test all mappings on a single platform.
Make all these functions support a superset of mappings for
all platforms by defining missing mapping consts to 0.
E.g. we always do ^A+B, but if A and B are defined to 0,
then these operations become no-op.

Depends on D107739.

Reviewed By: melver

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

3 years agotsan: define all fields for all mappings
Dmitry Vyukov [Sat, 7 Aug 2021 12:19:17 +0000 (14:19 +0200)]
tsan: define all fields for all mappings

Define all fields to 0 for all mappings.
This allows to write portable code and tests.
For all existing cases 0 values work out of the box
because we check if an address belongs to the range
and nothing belongs to [0, 0] range.

Depends on D107738.

Reviewed By: melver

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

3 years agotsan: rename kAppMemBeg to kLoAppMemBeg
Dmitry Vyukov [Sat, 7 Aug 2021 12:06:43 +0000 (14:06 +0200)]
tsan: rename kAppMemBeg to kLoAppMemBeg

Unify Go mapping naming with C++ naming to allow
writing portable code/tests that can work for both C++ and Go.
No functional changes.

Depends on D107737.

Reviewed By: melver

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

3 years agotsan: remove TSAN_MID_APP_RANGE macro
Dmitry Vyukov [Sat, 7 Aug 2021 11:39:58 +0000 (13:39 +0200)]
tsan: remove TSAN_MID_APP_RANGE macro

First, the define conflicts with definition/testing of all mappings,
since it's not a global property anymore. Second, macros/ifdefs are bad.
Define kMidAppMemBeg/End to 0 to denote that there is no "mid" range instead.

Depends on D107736.

Reviewed By: melver

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

3 years agosanitizer_common: add FALLTHROUGH macro
Dmitry Vyukov [Sat, 7 Aug 2021 11:56:48 +0000 (13:56 +0200)]
sanitizer_common: add FALLTHROUGH macro

Add FALLTHROUGH portably defined to [[clang::fallthrough]].
We have -Wimplicit-fallthrough already enabled, and currently
it's not possible to fix the warning.

Depends on D107735.

Reviewed By: melver

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

3 years agotsan: deduplicate mapping selection
Dmitry Vyukov [Sat, 7 Aug 2021 10:57:24 +0000 (12:57 +0200)]
tsan: deduplicate mapping selection

Currently we have mapping selection duplicated 9 times.
Deduplicate it. No functional changes.

Depends on D107734.

Reviewed By: melver

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

3 years agotsan: make all memory mappings testable
Dmitry Vyukov [Sat, 7 Aug 2021 10:03:24 +0000 (12:03 +0200)]
tsan: make all memory mappings testable

Currently we define/compile the mapping for a platform
only on that platform. This makes it impossible to unit-test
them on a single platform, and even to build test.
We have 17 of them and the Go mappings will be tested
only after a manual episodic update of the Go runtime.

Define all mappings always with unique names.
This will allow to unit-test them.
No functional changes.

Reviewed By: melver

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

3 years agosanitizers: turn thread-safety errors into warnings
Dmitry Vyukov [Tue, 10 Aug 2021 14:16:32 +0000 (16:16 +0200)]
sanitizers: turn thread-safety errors into warnings

There were 2 issues reported on https://reviews.llvm.org/D105716:
1. FreeBSD phtread.h is annotated with thread-safety attributes
and this causes errors in gtest headers.
2. If sanitizers are compiled with an older versions of clang
(which supports the annotations, but has some false positives
in analysis not present in later versions of clang), compilation
fails with errors.

Switch the errors to warnings by default.
Some CI bots enable COMPILER_RT_ENABLE_WERROR, which should
turn these warnings back into errors.

Reviewed By: nikic

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

3 years agosanitizer_common: optimize Mutex for high contention
Dmitry Vyukov [Tue, 10 Aug 2021 13:48:12 +0000 (15:48 +0200)]
sanitizer_common: optimize Mutex for high contention

After switching tsan from the old mutex to the new sanitizer_common mutex,
we've observed a significant degradation of performance on a test.
The test effectively stresses a lock-free stack with 4 threads
with a mix of atomic_compare_exchange and atomic_load operations.
The former takes write lock, while the latter takes read lock.
It turned out the new mutex performs worse because readers don't
use active spinning, which results in significant amount of thread
blocking/unblocking. The old tsan mutex used active spinning
for both writers and readers.

Add active spinning for readers.
Don't hand off the mutex to readers, and instread make them
compete for the mutex after wake up again.
This makes readers and writers almost symmetric.

Reviewed By: melver

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

3 years agoSystemZ: Tidy up a mir test
Matt Arsenault [Fri, 6 Aug 2021 16:42:54 +0000 (12:42 -0400)]
SystemZ: Tidy up a mir test

3 years agolibunwind: add missing break statements in EHABI
Saleem Abdulrasool [Tue, 10 Aug 2021 17:45:31 +0000 (17:45 +0000)]
libunwind: add missing break statements in EHABI

Add missing break statements identified by static analysis tools.

Patch by Andrii Kurdiumov!

Reviewed By: compnerd, danielkiss

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

3 years ago[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs
Leonard Chan [Tue, 10 Aug 2021 17:50:06 +0000 (10:50 -0700)]
[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs

This is a reland of commit a9d1970384aa3908adbf6f50f110c375def58947.

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

3 years ago[AIX] Don't crash on unimplemented lowerRelativeReference
Jinsong Ji [Tue, 10 Aug 2021 17:43:05 +0000 (17:43 +0000)]
[AIX] Don't crash on unimplemented lowerRelativeReference

We may call lowerRelativeReference in MC to determine whether target
supports this lowering. We should return nullptr instead of crashing
when we haven't implemented the real lowering.

Reviewed By: hubert.reinterpretcast

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

3 years ago[flang] Fix the extent calculation when upper bounds are less than lower bounds
Peter Steinfeld [Tue, 10 Aug 2021 15:20:30 +0000 (08:20 -0700)]
[flang] Fix the extent calculation when upper bounds are less than lower bounds

When the upper bound is less than the lower bound, the extent is zero.  This is
specified in section 8.5.8.2, paragraph 3.

Note that similar problems exist in the lowering code.  This change only fixes
the problem for the front end.

I also added a test.

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

3 years agoAMDGPU: Add alloc priority to global ranges
Matt Arsenault [Tue, 3 Aug 2021 23:09:44 +0000 (19:09 -0400)]
AMDGPU: Add alloc priority to global ranges

The requested register class priorities weren't respected
globally. Not sure why this is a target option, and not just the
expected behavior (recently added in
1a6dc92be7d68611077f0fb0b723b361817c950c). This avoids an allocation
failure when many wide tuple spills are introduced. I think this is a
workaround since I would not expect the allocation priority to be
required, and only a performance hint. The allocator should be smarter
about when only a subregister needs to be spilled and restored.

This does regress a couple of degenerate store stress lit tests which
shouldn't be too important.

3 years agoAMDGPU: Add baseline register allocation failure test
Matt Arsenault [Mon, 2 Aug 2021 21:11:59 +0000 (17:11 -0400)]
AMDGPU: Add baseline register allocation failure test

3 years agoRegAllocGreedy: Add spaces between registers in debug message
Matt Arsenault [Tue, 3 Aug 2021 01:12:21 +0000 (21:12 -0400)]
RegAllocGreedy: Add spaces between registers in debug message

3 years ago[AIX] Define __HOS_AIX__ macro only for AIX target
Jake Egan [Tue, 10 Aug 2021 15:38:48 +0000 (11:38 -0400)]
[AIX] Define __HOS_AIX__ macro only for AIX target

%%%
This patch defines the macro __HOS_AIX__ when the target is AIX and without any dependency on the host. The macro indicates that the host is AIX. Defining the macro will help minimize porting pain for existing code compiled with xlc/xlC. xlC never shipped cross-compiling support, so the difference is not observable anyway.
%%%
This is a follow up to the discussion in https://reviews.llvm.org/D107242.

Reviewed By: cebowleratibm, joerg

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

3 years ago[libcxx] Remove _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
Mark de Wever [Sun, 1 Aug 2021 18:01:51 +0000 (20:01 +0200)]
[libcxx] Remove _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED

All supported compilers should support
_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED so this can be removed.

Reviewed By: ldionne, #libc, Quuxplusone

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

3 years ago[Security] Replace Josh Eads with Tim Penge as a Sony rep
Paul Robinson [Wed, 28 Jul 2021 14:47:06 +0000 (10:47 -0400)]
[Security] Replace Josh Eads with Tim Penge as a Sony rep

3 years ago[libomptarget][NFC] Fix compilation issue with GCC
George Rokos [Tue, 10 Aug 2021 16:36:43 +0000 (09:36 -0700)]
[libomptarget][NFC] Fix compilation issue with GCC

Removed redundant assignment from condition which causes gcc to emit the following error:

error: operation on ‘MoveData’ may be undefined [-Werror=sequence-point]

3 years agoabseil-string-find-str-contains should not propose an edit for the three-parameter...
Tom Lokovic [Tue, 10 Aug 2021 16:26:02 +0000 (16:26 +0000)]
abseil-string-find-str-contains should not propose an edit for the three-parameter version of find().

std::string, std::string_view, and absl::string_view all have a three-parameter version of find()
which has a "count" (or "n") paremeter limiting the size of the substring to search.  We don't want
to propose changing to absl::StrContains in those cases.  This change fixes that and adds unit tests
to confirm.

Reviewed By: ymandel

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

3 years ago[OpenMP][NFC] Simplify targetDataEnd conditions for CopyMember
Joel E. Denny [Tue, 10 Aug 2021 16:23:15 +0000 (12:23 -0400)]
[OpenMP][NFC] Simplify targetDataEnd conditions for CopyMember

targetDataEnd and targetDataBegin compute CopyMember/copy differently,
and I don't see why they should.  This patch eliminates one of those
differences by making a simplifying NFC change to targetDataEnd.

The change is NFC as follows.  The change only affects the case when
`!UNIFIED_SHARED_MEMORY || HasCloseModifier`.  In that case, the
following points are always true:

* The value of CopyMember is relevant later only if DelEntry = false.
* DelEntry = false only if one of the following is true:
    * IsLast = false.  In this case, it's always true that CopyMember
      = false = IsLast.
    * `MEMBER_OF && !PTR_AND_OBJ` is true.  In this case, CopyMember =
      IsLast.
* Thus, if CopyMember is relevant, CopyMember = IsLast.

Reviewed By: grokos

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

3 years agorevert test commit
Denys Petrov [Tue, 10 Aug 2021 16:19:27 +0000 (19:19 +0300)]
revert test commit

3 years ago[analyzer] Move test case to existing test file and remove duplicated test file.
Denys Petrov [Mon, 19 Jul 2021 13:30:24 +0000 (16:30 +0300)]
[analyzer] Move test case to existing test file and remove duplicated test file.

Summary: Move the test case to existing test file. Remove test file as duplicated. The file was mistakenly added due to concerns of a hidden bug (see https://reviews.llvm.org/D104381). After it turned out, that the bug was already fixed with another revision (https://reviews.llvm.org/D85817) and corresponding test was added as well, we can remove this file.

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

3 years agotest commit
Denys Petrov [Tue, 10 Aug 2021 16:06:37 +0000 (19:06 +0300)]
test commit

3 years ago[RISCV] Fold (add (select lhs, rhs, cc, 0, y), x) -> (select lhs, rhs, cc, x, (add...
Craig Topper [Tue, 10 Aug 2021 15:27:34 +0000 (08:27 -0700)]
[RISCV] Fold (add (select lhs, rhs, cc, 0, y), x) -> (select lhs, rhs, cc, x, (add x, y))

Similar for sub except sub isn't commutative.

Modify the existing and/or/xor folds to also work on ISD::SELECT
and not just RISCVISD::SELECT_CC. This is needed to make sure
we do this transform before type legalization turns i32 add/sub
into add/sub+sign_extend_inreg on RV64. If we don't do this before
that, the sign_extend_inreg will still be after the select.

Reviewed By: frasercrmck

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

3 years ago[libc++][NFC] Simplify tests for bind_front
Louis Dionne [Tue, 10 Aug 2021 15:56:03 +0000 (11:56 -0400)]
[libc++][NFC] Simplify tests for bind_front

3 years ago[clang] Implement P0692R1 from C++20 (access checking on specializations and instanti...
Alex Orlov [Tue, 10 Aug 2021 15:20:50 +0000 (19:20 +0400)]
[clang] Implement P0692R1 from C++20 (access checking on specializations and instantiations)

This patch implements paper P0692R1 from the C++20 standard. Disable usual access checking rules to template argument names in a declaration of partial specializations, explicit instantiation or explicit specialization (C++20 13.7.5/10, 13.9.1/6).
Fixes: https://llvm.org/PR37424
This patch also implements option *A* from this paper P0692R1 from the C++20 standard.
This patch follows the @rsmith suggestion from D78404.

Reviewed By: krisb

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

3 years ago[InstSimplify] fold min/max with limit constant
Sanjay Patel [Tue, 10 Aug 2021 14:57:25 +0000 (10:57 -0400)]
[InstSimplify] fold min/max with limit constant

This is already done within InstCombine:
https://alive2.llvm.org/ce/z/MiGE22

...but leaving it out of analysis makes it
harder to avoid infinite loops there.

3 years agoRevert "[InstSimplify] fold min/max with limit constant; NFC"
Sanjay Patel [Tue, 10 Aug 2021 14:50:09 +0000 (10:50 -0400)]
Revert "[InstSimplify] fold min/max with limit constant; NFC"

This reverts commit f43859b4370f978d2bc625643ccbe03775b99713.
This is not NFC, so I'll try again without that mistake in the commit message.

3 years ago[InstSimplify] fold min/max with limit constant; NFC
Sanjay Patel [Tue, 10 Aug 2021 14:41:23 +0000 (10:41 -0400)]
[InstSimplify] fold min/max with limit constant; NFC

This is already done within InstCombine:
https://alive2.llvm.org/ce/z/MiGE22

...but leaving it out of analysis makes it
harder to avoid infinite loops there.

3 years ago[InstSimplify] add tests for min/max idioms; NFC
Sanjay Patel [Tue, 10 Aug 2021 13:39:01 +0000 (09:39 -0400)]
[InstSimplify] add tests for min/max idioms; NFC

3 years agoProblem with realpath interceptor
Dmitry Vyukov [Tue, 10 Aug 2021 14:27:49 +0000 (16:27 +0200)]
Problem with realpath interceptor

tsan in some cases (e.g. after fork from multithreaded program, which arguably is problematic) increments ignore_interceptors and in that case runs just the intercepted functions and not their wrappers.
For realpath the interceptor handles the resolved_path == nullptr case though and so when ignore_interceptors is non-zero, realpath (".", nullptr) will fail instead of succeeding.
This patch uses instead the COMMON_INTERCEPT_FUNCTION_GLIBC_VER_MIN macro to use realpath@@GLIBC_2.3 whenever possible (if not, then it is likely a glibc architecture
with more recent oldest symbol version than 2.3, for which any realpath in glibc will DTRT, or unsupported glibc older than 2.3), which never supported NULL as second argument.

Reviewed By: dvyukov

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

3 years ago[DWARF] Remove isInlinedCStr (NFC)
Kazu Hirata [Tue, 10 Aug 2021 14:24:46 +0000 (07:24 -0700)]
[DWARF] Remove isInlinedCStr (NFC)

The last use was removed on Oct 28, 2013 in commit
48cbda5850264671e982ecdd834c1587b1732c15.

3 years ago[lldb][NFC] Fix inversed documentation of Process::GetID/SetID
Raphael Isemann [Tue, 10 Aug 2021 14:15:57 +0000 (16:15 +0200)]
[lldb][NFC] Fix inversed documentation of Process::GetID/SetID

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.