Commit Graph

398748 Commits

Author SHA1 Message Date
Artem Belevich d99a83b4e5 [NVPTX] Simplify and generalize constant printer.
This allows handling i128 values and fixes
https://bugs.llvm.org/show_bug.cgi?id=51789.

Differential Revision: https://reviews.llvm.org/D109458
2021-09-09 11:30:19 -07:00
Louis Dionne 367a9e709d [libc++][NFC] Remove remnants of _LIBCPP_HAS_NO_STDOUT, which should have been removed by 87dd51983c 2021-09-09 14:27:31 -04:00
Saiyedul Islam 543604f30e [clang-nvlink-wrapper][docs][NFC] Fix sphinx warning about asterisk
Sphinx was giving warning on unescaped special symbol *. It was
an issue on systems treating warning as error.
2021-09-09 23:55:15 +05:30
Simon Pilgrim ea685e1028 [X86][AVX] Update _mm256_loadu2_m128* intrinsics to use _mm256_set_m128* (PR51796)
As reported on PR51796, the _mm256_loadu2_m128i in particular was inserting bitcasts and shuffles with different types making it trickier for some combines, and prevented the value tracker from identifying the shuffle sequences as a single insert_subvector style concat_vectors pattern.

This patch instead concatenate the 128-bit unaligned loads with _mm256_set_m128*, which was written to avoid the unnecessary bitcasts and only emits a single shuffle.

Differential Revision: https://reviews.llvm.org/D109497
2021-09-09 19:15:48 +01:00
Louis Dionne dd662f0f3d [libc++][NFC] Fix typo in comment 2021-09-09 14:00:22 -04:00
Louis Dionne 6382ec1abb [libc++][NFC] Reorder includes in locale.cpp
Also, include <type_traits> unconditionally. There really isn't much
of a benefit in skipping it when exceptions are disabled.
2021-09-09 13:53:44 -04:00
Craig Topper 517728fe1e [SelectionDAG] Use DAG.getNOT to further simplify some code. NFC
Followup to D109483
2021-09-09 10:53:39 -07:00
Stella Stamenova 584a5d171e Remove obsolete msvc workaround from AddLLVM.cmake
The original change to add the workaround is from 10 years ago and a lot has happened with msvc and cmake and llvm's usage of cmake since and we no longer need the workaround for any scenarios that I am aware of. Build more is now correctly configured for multi-configuration generators such as Visual Studio.

The workaround is, however, causing issues with some of the recent mlir tests as because of the workaround we cannot correctly determine whether assertions are enabled (see https://reviews.llvm.org/D105961).

The original change is:

```
commit b46fdac460
Author: Andrew Trick <atrick@apple.com>
Date:   Tue Jun 28 16:32:01 2011

    cmake: Our MSVC build does not support config-time build mode.

    llvm-svn: 134008
```

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D109521
2021-09-09 10:49:34 -07:00
Nick Desaulniers e69d402088 [NFC] rename member of BitTestBlock and JumpTableHeader
Follow up to suggestions in D109103 via hans:
  I think UnreachableDefault (or UnreachableFallthrough) would be a
  better name now, since it doesn't just omit the range check, it also
  omits the last bit test.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D109455
2021-09-09 10:43:00 -07:00
Louis Dionne f40bba48a5 [libc++][NFC] Move misplaced comment about implementation of ctype<wchar_t> 2021-09-09 13:29:24 -04:00
Louis Dionne 1190f38530 [libc++] Add missing include of <cstddarg> for va_xxx functions 2021-09-09 13:26:11 -04:00
Louis Dionne 720b556036 [libc++][NFC] Move __char_traits_length_checked outside of wchar_t definitions
This will simplify an upcoming diff.
2021-09-09 13:24:11 -04:00
Chris Lattner d51da74889 [CodeGen] Use DAG.getAllOnesConstant where possible to simplify code. NFC. 2021-09-09 10:22:51 -07:00
Craig Topper 124bcc1a13 [X86] Disable muloti4 libcalls for x86-64.
This library function only exists in compiler-rt not libgcc. So
this would fail to link unless we were linking with compiler-rt.

This is consistent with the recent removal of calls to mulodi4 on
32-bit targets like D108928.

I suppose maybe we could keep the libcalls for platforms like
Darwin that use compiler-rt exclusively?

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D109385
2021-09-09 10:03:15 -07:00
Chris Lattner 735f46715d [APInt] Normalize naming on keep constructors / predicate methods.
This renames the primary methods for creating a zero value to `getZero`
instead of `getNullValue` and renames predicates like `isAllOnesValue`
to simply `isAllOnes`.  This achieves two things:

1) This starts standardizing predicates across the LLVM codebase,
   following (in this case) ConstantInt.  The word "Value" doesn't
   convey anything of merit, and is missing in some of the other things.

2) Calling an integer "null" doesn't make any sense.  The original sin
   here is mine and I've regretted it for years.  This moves us to calling
   it "zero" instead, which is correct!

APInt is widely used and I don't think anyone is keen to take massive source
breakage on anything so core, at least not all in one go.  As such, this
doesn't actually delete any entrypoints, it "soft deprecates" them with a
comment.

Included in this patch are changes to a bunch of the codebase, but there are
more.  We should normalize SelectionDAG and other APIs as well, which would
make the API change more mechanical.

Differential Revision: https://reviews.llvm.org/D109483
2021-09-09 09:50:24 -07:00
Sam Clegg 6355234660 [lld][WebAssembly] Fix crash on un-used __tls_base symbol
In the case that TLS is used in the single-threaded program, and
therefore effectively lowered away, we still optionally create a
`__tls_base` symbols, but the code for setting it was assuming it was
always created.

Differential Revision: https://reviews.llvm.org/D109518
2021-09-09 12:45:58 -04:00
Aart Bik c34f3780a7 [mlir][sparse] fix broken test
new flag requirements crossed the checkin of this new test

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D109524
2021-09-09 09:40:00 -07:00
Jon Chesterfield 6760234e8d [libomptarget][amdgpu] Precisely manage hsa lifetime
The hsa library must be initialized before any calls into it and
destructed after the last call into it. There have been a number of bugs in
this area related to member variables which would like to use raii to manage
resources acquired from hsa.

This patch moves the init/shutdown of hsa into a class, such that when used as
the first member variable (could be a base), the lifetime of other member
variables are reliably scoped within it. This will allow other classes to use
raii reliably when used as member variables within the global.

Reviewed By: pdhaliwal

Differential Revision: https://reviews.llvm.org/D109512
2021-09-09 17:28:11 +01:00
Fangrui Song 0db402c5b4 [lld] Buffer writes when composing a single diagnostic
llvm::errs() is unbuffered. On a POSIX platform, composing a diagnostic
string may invoke the ::write syscall multiple times, which can be slow.
Buffer writes to a temporary SmallString when composing a single diagnostic to
reduce the number of ::write syscalls to one (also easier to read under
strace/truss).

For an invocation of ld.lld with 62000+ lines of
`ld.lld: warning: symbol ordering file: no such symbol: ` warnings (D87121),
the buffering decreases the write time from 1s to 0.4s (for /dev/tty) and
from 0.4s to 0.1s (for a tmpfs file). This can speed up
`relocation R_X86_64_PC32 out of range` diagnostic printing as well
with `--noinhibit-exec --no-fatal-warnings`.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D87272
2021-09-09 09:27:14 -07:00
Neumann Hon 0782e55c26 [SystemZ] [NFC] Add SystemZELFFrameLowering and SystemZXPLINKFrameLowering classes.
This patch adds class SystemZFrameLowering which is a SystemZ-specific class
detailing special registers used by calling conventions on the target.
SystemZELFFrameLowering and SystemZXPLINKFrameLowering implement this class
for ELF and XPLINK64 respectively. Previous functionality in SystemZFrameLowering
is moved to SystemZELFFrameLowering. SystemZXPLINKFrameLowering can then be
implemented in future patches.

Reviewed By: uweigand, Kai

Differential Revision: https://reviews.llvm.org/D108777
2021-09-09 12:23:40 -04:00
Jon Chesterfield 2a581710c1 [openmp] No longer use LIBRARY_PATH to find devicertl
Given D109057, change test runner to use the libomptarget-x-bc-path
argument instead of the LIBRARY_PATH environment variable to find the device
library.

Also drop the use of LIBRARY_PATH environment variable as it is far
too easy to pull in the device library from an unrelated toolchain by accident
with the current setup. No loss in flexibility to developers as the clang
commandline used here is still available.

Reviewed By: jdoerfert, tianshilei1992

Differential Revision: https://reviews.llvm.org/D109061
2021-09-09 17:16:41 +01:00
Ryan Mansfield 4f1c90a6d4 [lldb] Fix format string in Communication::Write
Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D109508
2021-09-09 17:55:38 +02:00
Akira Hatanaka 17c2948d04 [clang-scan-deps] Add an API for clang dependency scanner to perform
module lookup by name alone

This removes the need to create a fake source file that imports a
module.

rdar://64538073

Differential Revision: https://reviews.llvm.org/D109485
2021-09-09 08:52:50 -07:00
Kazu Hirata 92c9ff6d5f [IR, Transforms] Use arg_empty (NFC) 2021-09-09 08:50:10 -07:00
Aart Bik e2d3db42e5 [mlir][sparse] add casts to operations to lattice and exp builders
Further enhance the set of operations that can be handled by the sparse compiler

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D109413
2021-09-09 08:49:50 -07:00
Nathan Sidwell bb3f5f5d78 [clang] Array list initialization (pre-p0388)
Extends handling of list initialization of bounded array parameters.
This adds the missing checks on converting each initializer for both
std::initializer_list and arrays. And extends
CompareImplicitConversionSequence to compares array size, for two
conversions to array type.

As noted in this patch, there's a defect in the std concerning the
partial orderability of conversion sequences.  DR2492 has a suggested
direction that will be simple to add once it (hopefully) is accepted.

Differential Revision: https://reviews.llvm.org/D103088
2021-09-09 08:30:04 -07:00
Louis Dionne 71752e0008 [libc++][NFC] Remove #endif comments for really small conditionals on _LIBCPP_HAS_NO_UNICODE_CHARS
We generally don't put a comment on the #endif when the #if block is so small
that it's unambiguous what the #endif refers to.
2021-09-09 11:25:10 -04:00
Louis Dionne cf765b1929 [libc++][NFC] Reindent documentation for LIBCXX_ENABLE_UNICODE 2021-09-09 11:14:39 -04:00
LLVM GN Syncbot 49b7d641f9 [gn build] Port b1fb3d75c9 2021-09-09 15:10:21 +00:00
Jon Chesterfield d642156f8f [libomptarget][nfc] Hoist hsa_init into rtl.cpp 2021-09-09 16:09:34 +01:00
Louis Dionne b1fb3d75c9 [libc++] Implement C++20's P0476R2: std::bit_cast
Thanks to Arthur O'Dwyer for fixing up some of the tests.

Differential Revision: https://reviews.llvm.org/D75960
2021-09-09 11:05:54 -04:00
Alex Zinenko 8b58ab8ccd [mlir] Factor type reconciliation out of Standard-to-LLVM conversion
Conversion to the LLVM dialect is being refactored to be more progressive and
is now performed as a series of independent passes converting different
dialects. These passes may produce `unrealized_conversion_cast` operations that
represent pending conversions between built-in and LLVM dialect types.
Historically, a more monolithic Standard-to-LLVM conversion pass did not need
these casts as all operations were converted in one shot. Previous refactorings
have led to the requirement of running the Standard-to-LLVM conversion pass to
clean up `unrealized_conversion_cast`s even though the IR had no standard
operations in it. The pass must have been also run the last among all to-LLVM
passes, in contradiction with the partial conversion logic. Additionally, the
way it was set up could produce invalid operations by removing casts between
LLVM and built-in types even when the consumer did not accept the uncasted
type, or could lead to cryptic conversion errors (recursive application of the
rewrite pattern on `unrealized_conversion_cast` as a means to indicate failure
to eliminate casts).

In fact, the need to eliminate A->B->A `unrealized_conversion_cast`s is not
specific to to-LLVM conversions and can be factored out into a separate type
reconciliation pass, which is achieved in this commit. While the cast operation
itself has a folder pattern, it is insufficient in most conversion passes as
the folder only applies to the second cast. Without complex legality setup in
the conversion target, the conversion infra will either consider the cast
operations valid and not fold them (a separate canonicalization would be
necessary to trigger the folding), or consider the first cast invalid upon
generation and stop with error. The pattern provided by the reconciliation pass
applies to the first cast operation instead. Furthermore, having a separate
pass makes it clear when `unrealized_conversion_cast`s could not have been
eliminated since it is the only reason why this pass can fail.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D109507
2021-09-09 16:51:24 +02:00
Hansang Bae 3976035d68 [OpenMP] Fix line truncation in omp_lib.h
Fixed code that exceeds 72-column.

Differential Revision: https://reviews.llvm.org/D109469
2021-09-09 09:33:45 -05:00
Uday Bondhugula 524eafa5b2 [MLIR] Avoid double space print on llvm global op
Fix extra space print for llvm global op when the 'unamed_addr'
attribute was empty. This led to two spaces being printed in the custom
form between non-whitespace chars. A round trip would add an extra space
to a typical spaced form. NFC.

Differential Revision: https://reviews.llvm.org/D109502
2021-09-09 19:52:38 +05:30
Sam Clegg 44177e5fb2 [WebAssembly] Add explict TLS symbol flag
As before we maintain backwards compat with older object files
by also infering the TLS flag based on the name of the segment.

This change is was split out from https://reviews.llvm.org/D108877.

Differential Revision: https://reviews.llvm.org/D109426
2021-09-09 10:03:30 -04:00
Louis Dionne 3765d284c4 [libc++] Provide a way to trigger rebuild of Docker images in the CI 2021-09-09 09:59:44 -04:00
Louis Dionne d61ec93ff2 [libc++] Move additional build bots to the from-scratch config
Once all the bots are passing with from-scratch configs, we can attempt
to make the from-scratch config the default configuration.

Differential Revision: https://reviews.llvm.org/D103417
2021-09-09 09:14:43 -04:00
Sanjay Patel 97a4e7b7ff [InstCombine] remove a buggy set of zext-icmp transforms
The motivating case is an infinite loop shown with a reduced test from:
https://llvm.org/PR51762

To solve this, I'm proposing we delete the most obviously broken part of this code.

The bug example shows a fundamental problem: we ask computeKnownBits if a transform
will be profitable, alter the code by creating new instructions, then rely on
computeKnownBits to return the same answer to actually eliminate instructions.

But there's no guarantee that the results will be the same between the 1st and 2nd
calls. In the infinite loop example, we get different answers, so we add
instructions that conflict with some other transform, and we're stuck.

There's at least one other problem visible in the test diff for
`@zext_or_masked_bit_test_uses`: the code doesn't check uses properly, so we can
end up with extra instructions created.

Last, it's not clear if this set of transforms actually improves analysis or
codegen. I spot-checked a few targets and don't see a clear win:
https://godbolt.org/z/x87EWovso

If we do see a regression from this change, codegen seems like the right place to
add a cmp -> bit-hack fold.

If this is too big of a step, we could limit the computeKnownBits calls by not
passing a context instruction and/or limiting the recursion. I checked that those
would stop the infinite loop for PR51762, but that won't guarantee that some other
example does not fall into the same loop.

Differential Revision: https://reviews.llvm.org/D109440
2021-09-09 08:49:39 -04:00
Corentin Jabot 7fc743ff84 Mark as P0692R1 as implemented; NFC
P0692R1 was implemented in https://reviews.llvm.org/D92024
but the status page was not updated.
2021-09-09 08:45:47 -04:00
Louis Dionne 8660b89c0c [libc++] Clean up the no-unicode CI job
It was added after we changed the way the CI jobs are run, in particular
how they are pinned down to Linux instances only. As a result, the job
would sometimes run on Mac machines, which we're trying to keep only for
jobs that absolutely need it due to capacity concerns.
2021-09-09 08:39:30 -04:00
Florian Mayer 039fd9af45 [NFC] [hwasan] move prints closer together.
this makes the code slightly more readable.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D109442
2021-09-09 13:39:11 +01:00
Martin Storsjö a3870e8ab1 Reapply [runtimes] Set more paths when building runtimes standalone
These paths are needed when building with per-target runtime directories.

(It's possible to fix this by manually setting these when invoking
cmake, but one isn't supposed to need to do that.)

Also set LLVM_TOOLS_BINARY_DIR while touching this area (as it's
also unset in this case) even if it isn't specifically needed by the
per-target runtime configuration.

Fixed since previous attempt: Don't check if the runtimes directory
is the root of the CMake invocation; when the main LLVM CMake
build builds runtimes, it does invoke a sub-CMake with this directory
as the root too, just as if manually invoking CMake at the runtimes
directory. Instead check whether LLVM_TOOLS_BINARY_DIR was set and
whether find_package(LLVM) succeeded or not.

Differential Revision: https://reviews.llvm.org/D107895
2021-09-09 15:30:42 +03:00
Louis Dionne 312ad74aea [libc++] Implement P1951, default arguments for pair's forwarding constructor
Differential Revision: https://reviews.llvm.org/D109066
2021-09-09 08:28:22 -04:00
Nico Weber 7484206cfd [gn build] Make lldb build on Windows
Differential Revision: https://reviews.llvm.org/D109478
2021-09-09 08:13:50 -04:00
Florian Mayer 6e12c73316 [NFC] [stack-safety] add placeholder addRange.
This is in preparataion of D108457.
2021-09-09 13:13:18 +01:00
Raphael Isemann cda1450f1c [lldb][NFC] Add some tests for function-local classes and document some bugs
This feature doesn't seem to have any dedicated test. Instead some random tests
(e.g. the bitfield tests) are declaring function-local classes for some reason.
This adds a dedicated test so we can clean up those other tests.

Also add FIXME's for some basic stuff that doesn't work. The first FIXME is a
good beginner bug which just requires prepending the function name (in case we
decide to fix it instead of documenting this behaviour). The second FIXME is
caused by LLDB searching for definitions by name (which also seems to miss the
function name so there is a conflict with the outer type).

Some more things that should be tested (and might not work):
* Local classes with member functions with local classes.
* Classes in different functions with same name.
* Classes with the same name in different TUs with internal linkage functions of
  the same name.
* Empty classes are parsed by the DWARF parser in a fast path, so that requires
  dedicated tests.
* Repeat some of the tested logic for C.
2021-09-09 14:12:02 +02:00
Cullen Rhodes 6c8ff4032e [OptParser] NFC: Remove unused template arg 'name' from bool opt
Identified in D109359.

Reviewed By: jansvoboda11

Differential Revision: https://reviews.llvm.org/D109489
2021-09-09 12:04:40 +00:00
Florian Mayer d261d4cf55 [stack-safety] [NFC] do not terminate print with blank line. 2021-09-09 12:31:09 +01:00
LLVM GN Syncbot 9bb803c7a6 [gn build] Port c58c7a6ea0 2021-09-09 11:25:54 +00:00
Marco Gartmann c58c7a6ea0 [clang-tidy] cppcoreguidelines-virtual-base-class-destructor: a new check
Finds base classes and structs whose destructor is neither public and
virtual nor protected and non-virtual.
A base class's destructor should be specified in one of these ways to
prevent undefined behaviour.

Fixes are available for user-declared and implicit destructors that are
either public and non-virtual or protected and virtual.

This check implements C.35 [1] from the CppCoreGuidelines.

Reviewed By: aaron.ballman, njames93

Differential Revision: http://reviews.llvm.org/D102325

  [1]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-virtual
2021-09-09 13:23:38 +02:00