Commit Graph

434288 Commits

Author SHA1 Message Date
owenca 44a06b51b2 [clang-format] Rework removeBraces() in Format.cpp
Fixes #57373.

Differential Revision: https://reviews.llvm.org/D132719
2022-08-27 14:10:24 -07:00
Florian Hahn 7743badafa
[VPlan] Verify that header only contains header phi recipes.
Add verification that VPHeaderPHIRecipes are only in header VPBBs. Also
adds missing checks for VPPointerInductionRecipe to
VPHeaderPHIRecipe::classof.

Split off from D119661.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D131989
2022-08-27 22:06:12 +01:00
Akira Hatanaka f051c1ded4 [compiler-rt][builtins] Pass -Werror to check_cxx_compiler_flag
This is needed to avoid passing flags that are supported by the compiler
but cause warnings to be emitted.
2022-08-27 13:39:28 -07:00
Nikolas Klauser 640e2bae50 [libc++] Mark everything in <deque> as _LIBCPP_HIDE_FROM_ABI and replace _LIBCPP_INLINE_VISIBILITY
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132320
2022-08-27 22:01:00 +02:00
Nathan James 2a0870c9d3
[clang-tidy] Add missing header from 6bd98b4f2d 2022-08-27 19:59:16 +01:00
Nathan James 6bd98b4f2d
[clang-tidy] Fix a false positive in bugprone-assignment-in-if-condition
Fixed a false positive where a lambda expression in the condition which contained an assignement would trigger a warning.
Fixes #56729

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D132786
2022-08-27 19:55:08 +01:00
Arthur Eubanks 7a94d189ad [LazyCallGraph] Update libcall list when replacing a libcall node's function
Otherwise when we visit all libcalls in
updateCGAndAnalysisManagerForPass(), the old libcall is dead and doesn't
have a node.

We treat libcalls conservatively in LazyCallGraph because any function
may introduce calls to them out of thin air.

It is weird to change the signature of a libcall since introducing calls
to the libcall with a different signature may break, but other passes
like deadargelim already do it, so let's preserve this behavior for now.

Fixes an issue found in D128830.

Reviewed By: psamolysov

Differential Revision: https://reviews.llvm.org/D132764
2022-08-27 10:57:53 -07:00
Kazu Hirata 9d6ab7230b [GlobalISel] Use std::lcm (NFC)
This patch replaces getLCMSize with std::lcm, a C++17 feature.

Note that all the arguments are of unsigned with no implicit type
conversion as they are passed to getLCMSize.
2022-08-27 09:53:16 -07:00
Kazu Hirata 099775c2d6 [mlir] Use std::lcm (NFC)
This patch replaces mlir::lcm with std::lcm, a C++17 feature.

Note that all the arguments to mlir::lcm are of int64_t with no
implicit type conversion as they are passed to mlir::lcm, which I've
verified by modifying mlir::lcm as:

  template <typename TA, typename TB>
  inline int64_t lcm(TA a, TB b) {
    static_assert(std::is_same_v<TA, int64_t>);
    static_assert(std::is_same_v<TB, int64_t>);
    :
2022-08-27 09:53:15 -07:00
Kazu Hirata 86bc4587e1 Use std::clamp (NFC)
This patch replaces clamp idioms with std::clamp where the range is
obviously valid from the source code (that is, low <= high) to avoid
introducing undefined behavior.
2022-08-27 09:53:13 -07:00
Kazu Hirata 21de2888a4 Use llvm::is_contained (NFC) 2022-08-27 09:53:11 -07:00
Kazu Hirata a33ef8f2b7 Use llvm::all_equal (NFC) 2022-08-27 09:53:10 -07:00
Emil Kieri b2c96d7855 [flang] Don't emit faulty warnings for illegal COMMON blocks
SAVE statements referencing COMMON block names are not allowed in BLOCK
constructs. If they occur, an error is correctly emitted, but then flang
gets confused by the illegal SAVE and produces a faulty warning. This
patch removes that warning.

Consider this piece of Fortran (from the test blockconstruct02.f90):

program  main
  real r, s, t
  common /argmnt2/ r, s, t
  block
    save /argmnt2/
  end block
end program

Here flang (in addition to the error about the illegal SAVE) emits a
portability warning saying that the two definitions of argmnt2 have
different size, which does not make much sense.

This patch is a prerequisite for D125804, which in turn will make
blockconstruct02.f90 test this patch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D132403
2022-08-27 18:18:46 +02:00
Sanjay Patel 7abf233f44 [InstCombine] allow poison (undef) element in vector signbit transforms
If the shift constant has undefined lanes, we can assume those
are the same as the defined lanes in these transforms:
https://alive2.llvm.org/ce/z/t6TTJ2

Replace undef with poison in the test while here to support
the transition away from undef.
2022-08-27 11:57:05 -04:00
Sanjay Patel 3cde55d807 [InstCombine] add tests for signbit splat mask; NFC
issue #57381
2022-08-27 11:57:05 -04:00
Jun Zhang b9c2b6069e
Avoid else-if after return, NFC
Signed-off-by: Jun Zhang <jun@junz.org>
2022-08-27 23:14:48 +08:00
Jun Zhang a4f84f1b2e
[CodeGen] Track DeferredDecls that have been emitted
If we run into a first usage or definition of a mangled name, and
there's a DeferredDecl that associated with it, we should remember it we
need to emit it later on.

Without this patch, clang-repl hits a JIT symbol not found error:
clang-repl> extern "C" int printf(const char *, ...);
clang-repl> auto l1 = []() { printf("ONE\n"); return 42; };
clang-repl> auto l2 = []() { printf("TWO\n"); return 17; };
clang-repl> auto r1 = l1();
ONE
clang-repl> auto r2 = l2();
TWO
clang-repl> auto r3 = l2();
JIT session error: Symbols not found: [ l2 ]
error: Failed to materialize symbols: { (main,
{ r3, orc_init_func.incr_module_5, $.incr_module_5.inits.0 }) }

Signed-off-by: Jun Zhang <jun@junz.org>

Differential Revision: https://reviews.llvm.org/D130831
2022-08-27 22:32:47 +08:00
Benjamin Kramer 1bcf21ca7f Use std::uninitialized_move where appropriate. NFCI. 2022-08-27 14:56:43 +02:00
Sanjay Patel c6e56024c6 [InstCombine] fold signbit splat pattern that uses negate
0 - (zext (i8 X u>> 7) to iN) --> sext (i8 X s>> 7) to iN

https://alive2.llvm.org/ce/z/jzv4Ud

This is part of solving issue #57381.
2022-08-27 08:04:35 -04:00
Sanjay Patel 3b071e1d5d [InstCombine] add tests for signbit-smear; NFC
issue #57381
2022-08-27 08:04:35 -04:00
Mark de Wever ca04b49597 [libc++][CI] Increases the Clang version used.
Changes the CI to use the Clang 16 nightly builds instead of Clang 14.
(The libc++15 branch was accidentally build using Clang 14 instead of
Clang 15; hence the skipping of a number.)

Also adds a Clang 15 build to the test matrix.

Based on the private discussion with @ldionne we decided to move
the configuration parameters from the `run-buildbot` script to the
CI configuration `buildkite-pipeline.yml`. Other hard-coded values
from the Dockerfile should be move to the CI configuration too. That
will be done in another commit.

C++17 will use Clang-15 since D131479 causes a test to fail.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D131174
2022-08-27 13:42:38 +02:00
Nathan James 69c20a1f49
[clang-tidy] Move bugprone-assignment-in-if-condition check to correct folder 2022-08-27 11:24:57 +01:00
Shoaib Meenai a745e47900 [MachO] Fix dead-stripping __eh_frame
This section is marked S_ATTR_LIVE_SUPPORT in input files, which meant
that on arm64, we were unnecessarily preserving FDEs if we e.g. had
multiple weak definitions for a function. Worse, we would actually
produce an invalid `__eh_frame` section in that case, because the CIE
associated with the unnecessary FDE would still get dead-stripped and
we'd end up with a dangling FDE. We set up associations from functions
to their FDEs, so dead-stripping will just work naturally, and we can
clear S_ATTR_LIVE_SUPPORT from our input `__eh_frame` sections to fix
dead-stripping.

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D132489
2022-08-27 14:54:34 +05:00
Benjamin Kramer af14c41d07 [tblgen] Use std::variant to simplify code. NFCI. 2022-08-27 10:50:28 +02:00
Benjamin Kramer b831af5197 [libTooling] Simplify code with constexpr if. NFCI. 2022-08-27 10:50:06 +02:00
Nikolas Klauser a13822b35d [libc++] Simplify type_traits a bit more
Reviewed By: ldionne, #libc

Spies: STL_MSFT, CaseyCarter, huixie90, libcxx-commits

Differential Revision: https://reviews.llvm.org/D129094
2022-08-27 10:19:11 +02:00
Stanislav Mekhanoshin 813ae2871d [AMDGPU] Detect uniformness of TID / wavefrontsize
A value of 'workitemid / wavefrontize' or 'workitemid & (wavefrontize - 1)'
is wave uniform.

Differential Revision: https://reviews.llvm.org/D132511
2022-08-26 23:26:08 -07:00
Rainer Orth a31426dc87 [asan][test] Fix typo in Unit/lit.site.cfg.py.in
I noticed that `test/asan/Unit/lit.site.cfg.py.in` contains two typos,
using the FreeBSD forms of the `LD_*LIBRARY_PATH*` variables on Solaris.

Tested on `amd64-pc-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D132736
2022-08-27 07:50:18 +02:00
Anubhab Ghosh c69df92b4f [Orc] Use MapperJITLinkMemoryManager with InProcessMapper in llvm-jitlink tool
MapperJITLinkMemoryManager has slab allocation. Combined with
InProcessMapper, it can replace InProcessMemoryManager.

It can also replace JITLinkSlabAllocator through the InProcessDeltaMapper
that adds an offset to the executor addresses for use in tests.

Differential Revision: https://reviews.llvm.org/D132315
2022-08-27 11:07:09 +05:30
Mircea Trofin 3546b5c520 [mlgo] Fix flaky test
The source of the flakyness is internal uninitialized buffers due to
a dangling variable in the model.
2022-08-26 21:29:25 -07:00
Chelsea Cassanova 53f1cc85e3 [lldb][docs] Fix formatting in fuzzing doc
The page for fuzzing LLDB had incorrectly formatted code,
this commit fixes that.

Differential revision: https://reviews.llvm.org/D132775
2022-08-26 22:15:38 -05:00
Anubhab Ghosh ab492f6282 [Orc] Take offset inside slab into account in SharedMemoryMapper
SharedMemoryMapper assumed each reservation will have its corresponding
allocations starting from the beginning. However with the introduction
of the slab allocator, there can be a possible offset from the start
from where the initialization is being performed.

This commit also simplifies the logic for finding the parent reservation
and makes the assert messages consistent.
2022-08-27 07:49:48 +05:30
Amir Ayupov 62a034cc14 [BOLT][UTILS] Stash including untracked in nfc-check-setup
The command to detect whether the stash is needed is `git status --porcelain`
which includes untracked files by default. We want to stash untracked files
as well as they may affect compilation (LLVM CMake checks that all source files
should be included in CMakeLists).

Update the stash command to include untracked files as well.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D132610
2022-08-26 19:12:41 -07:00
Julian Lettner 5284cf0098 [Clang][Driver] Temporarily disable failing DriverKit test 2022-08-26 18:32:51 -07:00
Lang Hames 16d538c5ef [ORC-RT] Remove __orc_rt::apply_tuple.
This utility was a substitute for std::apply, which is now available.
2022-08-26 17:06:56 -07:00
Craig Topper faf373e526 [RISCV] Pre-commit tests for D132771. NFC 2022-08-26 16:41:01 -07:00
Chelsea Cassanova 43d7320e71 [lldb][docs] Add documentation for LLDB fuzzers
This commit adds a new page to the LLDB HTML documentation for the LLDB
fuzzers. The page primarily explains what the fuzzers are as well as how
to build them, run them and investigate and reproduce bugs.

Differential revision: https://reviews.llvm.org/D132148
2022-08-26 18:35:21 -05:00
Vitaly Buka 0d59969abb [msan] Enable msan-check-constant-shadow by default
Depends on D132761.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D132765
2022-08-26 16:34:47 -07:00
Julian Lettner 3d928e1d28 [TSan] Fix pointer/type-mismatch bug in test that has turned into a compile error
Fixes this test compile error:
```
<path>/compiler-rt/test/tsan/debug_alloc_stack.cpp:54:7: error: no matching function for call to '__tsan_get_alloc_stack'
      __tsan_get_alloc_stack(mem, trace, num_frames, &thread_id, &thread_os_id);
      ^~~~~~~~~~~~~~~~~~~~~~
<path>/compiler-rt/test/tsan/debug_alloc_stack.cpp:17:16: note: candidate function not viable: no known conversion from 'uint64_t **' (aka 'unsigned long long **') to 'uint64_t *' (aka 'unsigned long long *') for 5th argument; remove &
extern "C" int __tsan_get_alloc_stack(void *addr, void **trace, size_t size,
               ^
<path>/compiler-rt/test/tsan/debug_alloc_stack.cpp:61:46: warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t *' (aka 'unsigned long long *') [-Wformat]
  fprintf(stderr, "thread os id = 0x%llx\n", thread_os_id);
                                    ~~~~     ^~~~~~~~~~~~
1 warning and 1 error generated.
```
2022-08-26 16:29:30 -07:00
Julian Lettner dc32ed8a8e [Clang][Driver] Refine/refactor DriverKit support
Add special Framework header search path for DriverKit.
2022-08-26 16:06:24 -07:00
Lang Hames ac0c8cb3ff [ORC-RT] Add "wrap" and "unwrap" steps to __orc_rt::ExecutorAddr toPtr/fromPtr.
The wrap/unwrap operations are applied to pointers after/before conversion to/from
raw addresses. They can be used to tag, untag, sign, or strip signing from
pointers. They currently default to 'rawPtr' (identity) on all platforms, but it
is expected that the default will be set based on the host architecture, e.g.
they would default to signing/stripping for arm64e.

This is the ORC runtime counterpart to f14cb494a34:
2022-08-26 15:58:10 -07:00
Lang Hames faabefe3c8 [ORC-RT] Add a std::identity substitute.
The __orc_rt::identity utility is intended to serve as a substitute for
c++20's std::identity until we can use the latter (when LLVM moves to c++20).
2022-08-26 15:58:10 -07:00
Vitaly Buka 134986a720 [msan] Fix handling of constant shadow
If constant shadown enabled we had false reports because
!isZeroValue() does not guaranty that the values is actually not zero.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D132761
2022-08-26 15:51:02 -07:00
Wei Yi Tee fb9c1b8938 Revert "[clang][dataflow] Extend transfer functions for other `CFGElement`s"
This reverts commit 4b815eb4fd.
2022-08-26 22:41:20 +00:00
Nico Weber e877b42e2c [clang] Better warning-fix follow-up to D131632
Not all host compilers understand gnu:: attributes. Just remove the
variable until it's used.
2022-08-26 18:29:20 -04:00
Wei Yi Tee 4b815eb4fd [clang][dataflow] Extend transfer functions for other `CFGElement`s
Differential Revision: https://reviews.llvm.org/D131614
2022-08-26 22:21:29 +00:00
Nico Weber 396f40a79f [clang] Add __is_target_variant_{os,environment} builtins
Xcode 13's clang has them. For the included testcase, Xcode's clang
behaves like the implementation in this patch.

Availability.h in the macOS 12.0 SDK (part of Xcode 13, and the current
stable version of the macOS SDK) does something like:

   #if defined(__has_builtin)
     ...
     #if __has_builtin(__is_target_os)
      #if __has_builtin(__is_target_environment)
       #if __has_builtin(__is_target_variant_os)
        #if __has_builtin(__is_target_variant_environment)
         #if (... && ((__is_target_os(ios) && __is_target_environment(macabi)) || (__is_target_variant_os(ios) && __is_target_variant_environment(macabi))))
           #define __OSX_AVAILABLE_STARTING(_osx, _ios) ...
           #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) ...
           #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) ...

So if __has_builtin(__is_target_variant_os) or
__has_builtin(__is_target_variant_environment) are false, these defines are not
defined.

Most of the time, this doesn't matter. But open-source clang currently fails
to commpile a file containing only `#include <Security/cssmtype.h>` when
building for catalyst by adding a `-target arm64-apple-ios13.1-macabi` triple,
due to those __OSX_AVAILABLE macros not being set correctly.

If a potential future SDK version were to include cssmtype.h transitively
from a common header such as `<Foundation/Foundation.h>`, then it would become
close to impossible to build Catalyst binaries with open-source clang.

To fix this for normal catalyst builds, it's only necessary that
__has_builtin() evaluates to true for these two built-ins -- the implementation
of them doesn't matter. But as a courtesy, a correct (at least on the test
cases I tried) implementation is provided. (This should also help people who
try to build zippered code, where having the correct implementation does
matter.)

Differential Revision: https://reviews.llvm.org/D132754
2022-08-26 18:20:06 -04:00
Vitaly Buka 072a2fd738 [NFC][msan] Clang-format the file 2022-08-26 15:11:12 -07:00
Vitaly Buka 69754e590f [test] Add msan-check-constant-shadow=0 tests 2022-08-26 15:04:21 -07:00
Lang Hames f828135f91 Reapply "[ORC] Add "wrap" and "unwrap" steps to ExecutorAddr..." with fixes.
Reapplies f14cb494a3 (which was reverted in 2f08f8426c) with a fix for UB in
the ExecutorAddr::Unwrap::Unwrap constructor (which caused failures on some
bots).
2022-08-26 14:53:51 -07:00