Commit Graph

396419 Commits

Author SHA1 Message Date
Dmitry Vyukov 0ebfe7c312 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
2021-08-10 20:07:15 +02:00
Dmitry Vyukov 62c340760c 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
2021-08-10 20:07:04 +02:00
Dmitry Vyukov fd50600733 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
2021-08-10 20:05:14 +02:00
Dmitry Vyukov 3830c93478 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
2021-08-10 20:05:00 +02:00
Dmitry Vyukov fda121a9cc 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
2021-08-10 20:04:44 +02:00
Dmitry Vyukov a44a873e11 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
2021-08-10 20:04:37 +02:00
Dmitry Vyukov 3cb4ed72e7 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
2021-08-10 20:04:11 +02:00
Dmitry Vyukov 470f063720 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
2021-08-10 20:04:02 +02:00
Dmitry Vyukov 2f6ac22b08 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
2021-08-10 20:03:30 +02:00
Dmitry Vyukov 1fa4c188b5 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
2021-08-10 20:03:07 +02:00
Matt Arsenault 57dfa12e4c SystemZ: Tidy up a mir test 2021-08-10 13:56:54 -04:00
Saleem Abdulrasool 08a5ac36b9 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
2021-08-10 17:53:31 +00:00
Leonard Chan e2ff880a7e [clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs
This is a reland of commit a9d1970384.

Differential Revision: https://reviews.llvm.org/D99364
2021-08-10 10:52:24 -07:00
Jinsong Ji 2cfd427626 [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
2021-08-10 17:43:06 +00:00
Peter Steinfeld 3ad9826dcd [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
2021-08-10 10:34:22 -07:00
Matt Arsenault d719f1c3cc 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
1a6dc92be7). 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.
2021-08-10 13:12:34 -04:00
Matt Arsenault d84c4e3857 AMDGPU: Add baseline register allocation failure test 2021-08-10 13:12:34 -04:00
Matt Arsenault 1b41945da0 RegAllocGreedy: Add spaces between registers in debug message 2021-08-10 13:12:34 -04:00
Jake Egan 3b39fa3e28 [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
2021-08-10 13:03:17 -04:00
Mark de Wever 1123100a16 [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
2021-08-10 18:59:55 +02:00
Paul Robinson ca58d9af73 [Security] Replace Josh Eads with Tim Penge as a Sony rep 2021-08-10 12:54:23 -04:00
George Rokos df06ec3057 [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]
2021-08-10 09:43:43 -07:00
Tom Lokovic 1fdb3e36ff 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
2021-08-10 16:39:17 +00:00
Joel E. Denny 2ced1f338a [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
2021-08-10 12:29:55 -04:00
Denys Petrov 497b57ad0b revert test commit 2021-08-10 19:19:27 +03:00
Denys Petrov 497b1b95e6 [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
2021-08-10 19:11:21 +03:00
Denys Petrov 919f0b4acb test commit 2021-08-10 19:08:10 +03:00
Craig Topper 6f5edc3487 [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
2021-08-10 09:02:56 -07:00
Louis Dionne ce96d81c47 [libc++][NFC] Simplify tests for bind_front 2021-08-10 11:57:51 -04:00
Alex Orlov 638dcea010 [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
2021-08-10 19:20:50 +04:00
Sanjay Patel e260e10c4a [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.
2021-08-10 10:57:25 -04:00
Sanjay Patel 188832f419 Revert "[InstSimplify] fold min/max with limit constant; NFC"
This reverts commit f43859b437.
This is not NFC, so I'll try again without that mistake in the commit message.
2021-08-10 10:50:09 -04:00
Sanjay Patel f43859b437 [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.
2021-08-10 10:43:07 -04:00
Sanjay Patel 9b942a545c [InstSimplify] add tests for min/max idioms; NFC 2021-08-10 10:43:07 -04:00
Dmitry Vyukov faef0d042f 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
2021-08-10 16:29:42 +02:00
Kazu Hirata c1a014c382 [DWARF] Remove isInlinedCStr (NFC)
The last use was removed on Oct 28, 2013 in commit
48cbda5850.
2021-08-10 07:24:46 -07:00
Raphael Isemann 2db8461a94 [lldb][NFC] Fix inversed documentation of Process::GetID/SetID 2021-08-10 16:15:57 +02:00
Raphael Isemann 9900af52f6 [lldb][NFC] Add a FIXME for NameSearchContext::AddFunDecl's missing addDecl 2021-08-10 16:14:27 +02:00
Thomas Preud'homme 1397e19129 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
2021-08-10 15:01:44 +01:00
David Sherwood 3ce8c31eb8 [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
2021-08-10 14:48:38 +01:00
Brian Cain 888876ba27 [clang] [hexagon] Add resource include dir 2021-08-10 08:37:58 -05:00
Florian Mayer 45abbaf2e5 Revert "[clangd] Support `#pragma mark` in the outline"
This reverts commit ba06ac8b45.
2021-08-10 14:25:52 +01:00
Sam McCall 13a86c2bb4 [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
2021-08-10 15:16:52 +02:00
Sam McCall bd63977ca9 [Parser] Fix attr infloop on "int x [[c"
Similar to ad2d6bbb14

Differential Revision: https://reviews.llvm.org/D107693
2021-08-10 15:03:08 +02:00
Raphael Isemann 57bf5c8659 [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
2021-08-10 14:54:42 +02:00
Raphael Isemann 499489064b [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
2021-08-10 14:42:06 +02:00
David Green 013030a0b2 [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
2021-08-10 13:25:42 +01:00
David Green 3f74a68c35 [AArch64] Regenerate sink-free-instructions.ll. NFC 2021-08-10 13:25:42 +01:00
Tim Northover 5ad0860899 AArch64: support @llvm.va_copy in GISel 2021-08-10 13:11:03 +01:00
Florian Mayer be59a332eb [hwasan] Fix test on x86.
Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D107816
2021-08-10 13:06:12 +01:00