Commit Graph

416698 Commits

Author SHA1 Message Date
Nathan Sidwell e5c98e22fb [demangler] Simplify SwapAndRestore
The SwapAndRestore class is over engineered.  Nothing makes use of the
early restoration machinery.  Let's just remove that cognative burdon.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D120673
2022-03-01 04:37:24 -08:00
Egor Zhdan 3cdc1c155b [Clang] Add `-funstable` flag to enable unstable and experimental features
This new flag enables `__has_feature(cxx_unstable)` that would replace libc++ macros for individual unstable/experimental features, e.g. `_LIBCPP_HAS_NO_INCOMPLETE_RANGES` or `_LIBCPP_HAS_NO_INCOMPLETE_FORMAT`.

This would make it easier and more convenient to opt-in into all libc++ unstable features at once.

Differential Revision: https://reviews.llvm.org/D120160
2022-03-01 12:35:20 +00:00
Martin Storsjö 640e45b9b2 [lit] Read command stdout/stderr as text on Windows
This takes care of normalizing newlines back to single LF instead
of CRLF.

This on itself breaks on a couple tests that accidentally seem to
be writing binary data to stdout; make sure those cases are piped
to /dev/null instead of actually written to a terminal.

Differential Revision: https://reviews.llvm.org/D120623
2022-03-01 14:24:02 +02:00
Alexandros Lamprineas 33830326aa [FuncSpec] Remove definitions of fully specialized functions.
A function is basically dead when:
 * it has no uses
 * it has only self-referencing uses (it's recursive)

Differential Revision: https://reviews.llvm.org/D119878
2022-03-01 11:57:08 +00:00
Alexandros Lamprineas b803aee67b [FuncSpec][NFC] Improve debug messages.
Adds diagnostic messages when debugging the pass.

Differential Revision: https://reviews.llvm.org/D119875
2022-03-01 11:55:08 +00:00
Alexey Lapshin a6f3fedc3f [objcopy] Refactor CommonConfig to add posibility to specify added/updated sections as MemoryBuffer.
Current objcopy implementation has a possibility to add or update sections.
The incoming section is specified as a pair: section name and name of the file
containing section data. The interface does not allow to specify incoming
section as a memory buffer. This patch adds possibility to specify incoming
section as a memory buffer.

Differential Revision: https://reviews.llvm.org/D120486
2022-03-01 14:49:41 +03:00
Alexandros Lamprineas 7b74123a3d [FuncSpec][NFC] Variable renaming.
Just preparing the ground for follow up patches to make the reviews easier.

Differential Revision: https://reviews.llvm.org/D119874
2022-03-01 11:38:57 +00:00
Sander de Smalen 9765e2b5ff [AArch64] NFC: Change description of Streaming SVE mode.
Streaming SVE mode includes more than just the streaming compatible
SVE/SVE2/NEON instructions.
2022-03-01 11:32:58 +00:00
Jay Foad 3a32a445ae [AMDGPU] Precommit tests for D120709 2022-03-01 11:15:33 +00:00
Whisperity 9485091827 [NFC][clang-tidy][docs] Remove mention of backported fix of `readability-suspicious-call-argument` from `ReleaseNotes`
Commit 416e689ecd introduced a fix to
`readability-suspicious-call-argument` which added an entry to the
Release Notes, but the same change was backported to **14.0** in commit
e89602b7b2ec12f20f2618cefb864c2b22d0048a.

Hence, this change is not a new thing of the to-be 15.0 release.
2022-03-01 12:06:59 +01:00
Nikita Popov aeab6167b0 [SCEV] Only verify BECounts for reachable loops (PR50523)
For unreachable loops, any BECount is legal, and since D98706 SCEV
can make use of this for loops that are unreachable due to constant
branches. To avoid false positives, adjust SCEV verification to only
check BECounts in reachable loops.

Fixes https://github.com/llvm/llvm-project/issues/50523.

Differential Revision: https://reviews.llvm.org/D120651
2022-03-01 11:52:35 +01:00
Florian Hahn bb746716c2
[AArch64] Add tests with unnecessary dependency with faddp lowering.
The added tests highlight an unnecessary cross-iteration dependency when
lowering reductions to faddp. This dependency can negatively impact
performance.
2022-03-01 10:30:34 +00:00
Florian Hahn 70c398c198
[AArch64] Use common CHECK prefix for test, reducing duplicated checks.
Use the common CHECK prefix with runlines with and without fullfp16.
This means no duplicated checks are generated for tests not using fp16.
2022-03-01 10:30:29 +00:00
Kristina Bessonova 57aaab3b17 [NVPTX] Fix nvvm.match.sync*.i64 intrinsics return type (i64 -> i32)
NVVM IR specification defines them with i32 return type:

  declare i32 @llvm.nvvm.match.any.sync.i64(i32 %membermask, i64 %value)
  declare {i32, i1} @llvm.nvvm.match.all.sync.i64(i32 %membermask, i64 %value)
  ...
  The i32 return value is a 32-bit mask where bit position in mask corresponds
  to thread’s laneid.

as well as PTX ISA:

  9.7.12.8. Parallel Synchronization and Communication Instructions: match.sync

  match.any.sync.type  d, a, membermask;
  match.all.sync.type  d[|p], a, membermask;
  ...
  Destination d is a 32-bit mask where bit position in mask corresponds
  to thread’s laneid.

Additionally, ptxas doesn't accept intructions, produced by NVPTX backend.
After this patch, it compiles with no issues.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D120499
2022-03-01 12:26:16 +02:00
Yatao Wang 8565b6f9f2 [UpdateLLCTestChecks] Add support for isel debug output in update_llc_test_checks.py
Add a check on run lines to pick up isel options in llc commands and allow
generating check lines of isel final output other than assembly. If llc command
line contains -debug-only=isel, update_llc_test_checks.py will try to scrub isel
output, otherwise, the script will fall back on default behaviour, which is try to
scrub assembly output instead.

The motivation of this change is to allow usage of update_llc_test_checks.py to
autogenerate checks of instruction selection results. In this way, we can detect
errors at an earlier stage before the compilation goes all the way to assembly.
It is an example of having some transparency for the stages between IR and
assembly. These generated tests are almost like "unit tests" of isel stage.

This patch only implements the initial change to differentiate isel output from
assembly output for Lanai. Other targets will not be supported for isel check
generation at the moment. Although adding support for it will only require
implementing the function regex and scrubber for corresponding targets.

The Lanai implementation was chosen mainly for the simplicity of demonstrating
the difference between isel checks and asm checks.

This patch also do not include the implementation of function prefix, which is
required for the generated isel checks to pass. I will put up a follow up revision
for the function prefix change to complete isel support.

Reviewed By: Flakebi

Differential Revision: https://reviews.llvm.org/D119368
2022-03-01 10:55:53 +01:00
Martin Storsjö 9dd2d50984 [LLD] [COFF] Use the new encodeSectionName() helper for long section names
The previous code used an unbounded sprintf, which in theory can
overflow, writing either the null terminator or the last digits
into the next struct member.

In practice, in LLD, all long section names are written sequentially
first at the start of the string table, followed by all the long
symbol names. Due to this, even if the total string table would
end up large, the long section names have fairly short offsets,
which is why this hasn't been an issue in practice.

I don't think it's worth trying to write a test that produces an
executable with enough long section names to make the section names
themselves exceed 10^6 bytes, which is currently necessary to trigger
faults with the previous form.

Differential Revision: https://reviews.llvm.org/D120676
2022-03-01 11:33:02 +02:00
David Spickett 7c77d414e2 [llvm][AArch64] Restore lit cfg for TypePromotion tests
Accidentally deleted in 20d75059a2.

As seen in failures on https://lab.llvm.org/buildbot/#/builders/171/builds/10952.
2022-03-01 09:28:15 +00:00
Sam Parker 20d75059a2 Revert "[TypePromotion] Avoid some unnecessary truncs"
This reverts commit 281d29b8fe.

Report of a miscompilation and awaiting a reproducer.
2022-03-01 08:59:52 +00:00
Hans Wennborg 3e6cfc631b [NFC][hwasan] Check __GLIBCXX__ before checking _GLIBCXX_RELEASE in test
_GLIBCXX_RELEASE wasn't defined before GCC 7.1.

This is another follow-up to https://reviews.llvm.org/D119161
2022-03-01 09:39:26 +01:00
Iain Sandoe a29f8dbb7f [C++20][Modules][8/8] Amend module visibility rules for partitions.
Implementation partitions bring two extra cases where we have
visibility of module-private data.

1) When we import a module implementation partition.
2) When a partition implementation imports the primary module intertace.

We maintain a record of direct imports into the current module since
partition decls from direct imports (but not trasitive ones) are visible.

The rules on decl-reachability are much more relaxed (with the standard
giving permission for an implementation to load dependent modules and for
the decls there to be reachable, but not visible).

Differential Revision: https://reviews.llvm.org/D118599
2022-03-01 08:29:05 +00:00
gysit e9085d0d25 [mlir][OpDSL] Rename function to make signedness explicit (NFC).
The revision renames the following OpDSL functions:
```
TypeFn.cast -> TypeFn.cast_signed
BinaryFn.min -> BinaryFn.min_signed
BinaryFn.max -> BinaryFn.max_signed
```
The corresponding enum values on the C++ side are renamed accordingly:
```
#linalg.type_fn<cast> -> #linalg.type_fn<cast_signed>
#linalg.binary_fn<min> -> #linalg.binary_fn<min_signed>
#linalg.binary_fn<max> -> #linalg.binary_fn<max_signed>
```

Depends On D120110

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D120562
2022-03-01 08:15:53 +00:00
Lian Wang db85cd729a [RISCV] Add FMV_W_X and FMV_H_X instrutions to hasAllNBitUsers
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120699
2022-03-01 08:13:59 +00:00
Lorenzo Chelini e8659c994d [MLIR][Standalone] Don't look for Python if bindings are OFF
Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D120700
2022-03-01 08:55:15 +01:00
gysit 24357fec8d [mlir][OpDSL] Add arithmetic function attributes.
The revision extends OpDSL with unary and binary function attributes. A function attribute, makes the operations used in the body of a structured operation configurable. For example, a pooling operation may take an aggregation function attribute that specifies if the op shall implement a min or a max pooling. The goal of this revision is to define less and more flexible operations.

We may thus for example define an element wise op:
```
linalg.elem(lhs, rhs, outs=[out], op=BinaryFn.mul)
```
If the op argument is not set the default operation is used.

Depends On D120109

Reviewed By: nicolasvasilache, aartbik

Differential Revision: https://reviews.llvm.org/D120110
2022-03-01 07:45:47 +00:00
lian wang 5d91a8a707 [RISCV] Add schedule class for Zbp extension and Zbr extension
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120012
2022-03-01 07:35:59 +00:00
LLVM GN Syncbot 7a5394938a [gn build] Port d8a2afb244 2022-03-01 07:28:51 +00:00
Fangrui Song 87034ad2a4 [ELF] isKnownZFlag: move known literal flags to an array. NFC
The chain of == comparisons is a bit unwieldy to update.

While here, sort the entries alphabetically.
2022-02-28 23:23:33 -08:00
Balázs Kéri d8a2afb244 [clang][analyzer] Add modeling of 'errno'.
Add a checker to maintain the system-defined value 'errno'.
The value is supposed to be set in the future by existing or
new checkers that evaluate errno-modifying function calls.

Reviewed By: NoQ, steakhal

Differential Revision: https://reviews.llvm.org/D120310
2022-03-01 08:20:33 +01:00
Jonas Devlieghere 4429cf146e
[Support] Allow the ability to change WithColor's auto detection function
WithColor has an "auto detection mode" which looks whether the
corresponding whether the corresponding cl::opt is enabled or not. While
this is great when opting into cl::opt, it's not so great for downstream
users of this utility, which might have their own competing options to
enable or disable colors. The WithColor constructor takes a color mode,
but the big benefit of the class are its static error and warning
helpers and default error handlers.

In order to allow users of this utility to enable or disable colors
globally, this patch adds the ability to specify a global auto detection
function. By default, the auto detection function behaves the way that
it does today. The benefit of this patch lies in that it can be
overwritten. In addition to a ability to change the auto detection
function, I've also made it possible to get your hands on the default
auto detection function, so you swap it back if if you so desire.

This patch allow downstream users (like LLDB) to globally disable colors
with its own command line flag.

Differential revision: https://reviews.llvm.org/D120593
2022-02-28 20:30:06 -08:00
Fangrui Song 19b06fa599 [asan][test] Remove Linux/asan_prelink_test.cpp
glibc 2.37 will remove prelink support. See
https://sourceware.org/pipermail/libc-alpha/2022-January/135565.html for its
broken current state.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D120520
2022-02-28 20:26:34 -08:00
Weining Lu a4d2943bf6 [LoongArch][NFC] Delete unnecessary return behind of llvm_unreachable 2022-03-01 11:25:59 +08:00
Amir Ayupov 08dcbed92f [BOLT] Fix X86MCPlusBuilder::replaceRegWithImm
Reassigning the operand didn't update the operand type which resulted in an
assertion (`Assertion `isReg() && "This is not a register operand!"' failed.`)
Reset the instruction instead.

Test Plan:
```
ninja check-bolt
...
PASS: BOLT-Unit :: Core/./CoreTests/X86/MCPlusBuilderTester.ReplaceRegWithImm/0 (90 of 136)
```

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D120263
2022-02-28 19:24:46 -08:00
Jez Ng a552fb2a86 [lld-macho] Have relocation address included in range-check error message
This makes it easier to debug those errors. See e.g. https://github.com/llvm/llvm-project/issues/52767#issuecomment-1028713943

We take the approach of 'reverse-engineering' the InputSection from the
output buffer offset. This provides for a cleaner Target API, and is
similar to LLD-ELF's implementation of getErrorPlace().

Reviewed By: #lld-macho, Roger

Differential Revision: https://reviews.llvm.org/D118903
2022-02-28 21:56:38 -05:00
Phoebe Wang e03d216c28 [X86] Use bit test instructions to optimize some logic atomic operations
This is to match GCC's optimizations: https://gcc.godbolt.org/z/3odh9e7WE

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120199
2022-03-01 09:57:08 +08:00
Lian Wang e2c150ab52 [RISCV][NFC] Move defined non_imm12 to proper place in RISCVInstrInfoZb.td
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120656
2022-03-01 01:45:30 +00:00
Zhihao Yuan d1a59eefd3
[Clang] Remove redundant init-parens in AST print
Given a dependent `T` (maybe an undeduced `auto`),

Before:

    new T(z)  -->  new T((z))  # changes meaning with more args
    new T{z}  -->  new T{z}
        T(z)  -->      T(z)
        T{z}  -->      T({z})  # forbidden if T is auto

After:

    new T(z)  -->  new T(z)
    new T{z}  -->  new T{z}
        T(z)   -->     T(z)
        T{z}   -->     T{z}

Depends on D113393

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D120608
2022-02-28 19:31:16 -06:00
Zhihao Yuan 136b293129
[c++2b] Implement P0849R8 auto(x)
https://wg21.link/p0849

Reviewed By: aaron.ballman, erichkeane

Differential Revision: https://reviews.llvm.org/D113393
2022-02-28 19:21:08 -06:00
Eli Friedman cb254d5919 [Windows] Don't try to use x64 linker on ARM64 Windows.
Trying to invoke an x64 binary on ARM64 Windows 10 won't work, and will
print an obscure error message.  Choose the 32-bit linker instead, which
will run under emulation.

The x64 linker should in theory run under ARM64 Windows 11.  We could
detect this using IsWow64GuestMachineSupported(), but I don't have a
setup to test that with at the moment.

Differential Revision: https://reviews.llvm.org/D120681
2022-02-28 17:00:50 -08:00
Michael Kruse 96ae86bd29 [test] Silence compiler warning.
signed/unsigned comparison in gtest macro.

Also fix buidlbots:
https://lab.llvm.org/buildbot#builders/36/builds/18337
https://lab.llvm.org/buildbot#builders/57/builds/15594
2022-02-28 18:46:55 -06:00
Kirill Stoimenov b7fd30eac3 [ASan] Removed unused AddressSanitizerPass functional pass.
This is a clean-up patch. The functional pass was rolled into the module pass in D112732.

Reviewed By: vitalybuka, aeubanks

Differential Revision: https://reviews.llvm.org/D120674
2022-03-01 00:41:29 +00:00
Michael Kruse a66f7769a3 [OpenMPIRBuilder] Implement static-chunked workshare-loop schedules.
Add applyStaticChunkedWorkshareLoop method implementing static schedule when chunk-size is specified. Unlike a static schedule without chunk-size (where chunk-size is chosen by the runtime such that each thread receives one chunk), we need two nested loops: one for looping over the iterations of a chunk, and a second for looping over all chunks assigned to the threads.

This patch includes the following related changes:
 * Adapt applyWorkshareLoop to triage between the schedule types, now possible since all schedules have been implemented. The default schedule is assumed to be non-chunked static, as without OpenMPIRBuilder.
 * Remove the chunk parameter from applyStaticWorkshareLoop, it is ignored by the runtime. Change the value for the value passed to the init function to 0, as without OpenMPIRBuilder.
 * Refactor CanonicalLoopInfo::setTripCount and CanonicalLoopInfo::mapIndVar as used by both, applyStaticWorkshareLoop and applyStaticChunkedWorkshareLoop.
 * Enable Clang to use the OpenMPIRBuilder in the presence of the schedule clause.

Differential Revision: https://reviews.llvm.org/D114413
2022-02-28 18:18:33 -06:00
Peter Klausler 73b193aec2 [flang] Allow more concurrently open NEWUNIT= values, with recycling
Add a header-only implementation of Briggs & Torczon's fast small
integer set data structure to flang/include/flang/Common, and use
it in the runtime to manage a pool of Fortran unit numbers with
recycling.  This replaces the bit set previously used for that
purpose.  The set is initialized on demand with the negations of
all the NEWUNIT= unit numbers that can be returned to any kind
of integer variable.

For programs that require more concurrently open NEWUNIT= unit
numbers than the pool can hold, they are now allocated with a
non-recycling counter.  This allows as many open units as the
operating system provides.

Many of the top-line comments in flang/unittests/Runtime had the
wrong path name.  I noticed this while adding a unit test for the
fast integer set data structure, and cleaned them up.

Differential Revision: https://reviews.llvm.org/D120685
2022-02-28 16:13:22 -08:00
Arthur O'Dwyer 6d751c410d [libc++] [ranges] Use "inline constexpr bool" not "constexpr bool" for helpers.
Reviewed as part of D118616.
2022-02-28 18:52:54 -05:00
Siva Chandra Reddy 1137255585 [libc] Add a class "Atomic" as a simple equivalent of std::atomic.
Only the methods currently required by the libc have been added.
Most of the existing uses of atomic operations have been switched over
to this new class. A future change will clean up the rest of uses.

This change now allows building mutex and condition variable code with a
C++ compiler which does not have stdatomic.h, for example g++.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D120642
2022-02-28 23:51:44 +00:00
Kiran Chandramohan 4d5bcff3be [Flang] NFC: Changes to adhere to coding guidelines
This patch includes some changes which brings the code in line with
llvm coding guidelines.
-> Remove curlies for one line if statements.
-> Remove else after return.
-> Removes a few usage of auto.
-> Add Doxygen comments

Addresses post review comments in D120403 by @schweitz.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D120657
2022-02-28 23:50:39 +00:00
not-jenni fd2550d80c Adds a flag to optionally disable tosa decompositions
Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D120338
2022-02-28 15:41:13 -08:00
Peter Klausler 19d8642633 [flang] Catch I/O of bad derived type at compile time
Derived types with allocatable and pointer components cannot
be used in I/O data transfer statements unless they have defined
I/O procedures available (as type-bound or regular generics).
These cases are caught as errors by the I/O runtime library,
but it would be better if they were flagged during compilation.

(Address comment in review: don't use explicit name string lengths.)

Differential Revision: https://reviews.llvm.org/D120675
2022-02-28 15:40:12 -08:00
Jonas Devlieghere 3a167c4a90
Revert "[Support] Allow the ability to change WithColor's auto detection function"
This reverts commit a83cf7a846 because it
breaks a bunch of build bots.
2022-02-28 15:32:15 -08:00
Hsiangkai Wang b8e296cf6a [AArch64][SME] Add rdsvl instruction
This patch adds support for the following SME instruction:

  * RDSVL

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-12

Differential Revision: https://reviews.llvm.org/D120603
2022-02-28 23:14:50 +00:00
Hsiangkai Wang 7dd7cb0487 [AArch64][SME] Add addsvl and addspl instructions
This patch adds support for the following SME instructions:

  * ADDSPL, ADDSVL

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-12

Differential Revision: https://reviews.llvm.org/D120554
2022-02-28 23:14:50 +00:00