platform/upstream/llvm.git
2 years ago[lldb] Use single-argument static_assert where applicable (NFC)
Jonas Devlieghere [Sun, 7 Aug 2022 21:26:04 +0000 (14:26 -0700)]
[lldb] Use single-argument static_assert where applicable (NFC)

Since C++17 the message string for static_assert is optional. Replaces
static asserts with an empty string literal with the single-argument
variant.

2 years ago[InstSimplify] fold scalable vectors with over-shift splat constant to poison
Sanjay Patel [Sun, 7 Aug 2022 20:24:15 +0000 (16:24 -0400)]
[InstSimplify] fold scalable vectors with over-shift splat constant to poison

Fixes #56968

2 years ago[InstSimplify] add test for over-shift of scalable vector; NFC
Sanjay Patel [Sun, 7 Aug 2022 19:05:16 +0000 (15:05 -0400)]
[InstSimplify] add test for over-shift of scalable vector; NFC

2 years ago[flang][runtime] Catch & report attempts at recursive I/O
Peter Klausler [Tue, 26 Jul 2022 00:27:15 +0000 (17:27 -0700)]
[flang][runtime] Catch & report attempts at recursive I/O

When an I/O statement contains a function call that attempts
to perform I/O on the same unit, detect the recursive I/O
and terminate with a useful message rather than deadlocking in
the threading library.

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

2 years agoRevert "[JITLink] Fix some C++17 related fixmes."
Lang Hames [Sun, 7 Aug 2022 18:45:06 +0000 (11:45 -0700)]
Revert "[JITLink] Fix some C++17 related fixmes."

This reverts commit 6ea5bf436a983ea9e16a5fe7534c87beca0a61b7.

6ea5bf436a983ea9e16a5fe7534c87beca0a61b7 made use of new c++17 rules regarding
order of evaluation (specifically: in function calls the expression naming the
function should be sequenced before the evalution of any operands) to simplify
some continuation-passing calls. Unfortunately this appears to break at least
one MSVC bot: https://lab.llvm.org/buildbot/#/builders/123/builds/12149 .

Includes an update to the comments to note that the workaround is now based on
MSVC limitations, not on LLVM adopting c++17.

2 years ago[mlir] Use value instead of getValue
Kazu Hirata [Sun, 7 Aug 2022 18:59:37 +0000 (11:59 -0700)]
[mlir] Use value instead of getValue

2 years ago[ADT] Deprecate Optional::{hasValue,getValue} (NFC)
Kazu Hirata [Sun, 7 Aug 2022 18:30:58 +0000 (11:30 -0700)]
[ADT] Deprecate Optional::{hasValue,getValue} (NFC)

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

2 years ago[ORC-RT] Remove a stray __orc_rt::string_view helper.
Lang Hames [Sun, 7 Aug 2022 18:22:15 +0000 (11:22 -0700)]
[ORC-RT] Remove a stray __orc_rt::string_view helper.

This function was accidentally left in after 1dcff823db9.

2 years ago[lldb] Hoist TraceOn check out of loop (NFC)
Dave Lee [Wed, 25 May 2022 00:22:12 +0000 (17:22 -0700)]
[lldb] Hoist TraceOn check out of loop (NFC)

2 years ago[lldb] Fix formatting in python-reference.rst
Dave Lee [Sun, 24 Jul 2022 23:31:53 +0000 (17:31 -0600)]
[lldb] Fix formatting in python-reference.rst

2 years ago[lldb] Dynamically generate enum names in lldbutil
Dave Lee [Thu, 4 Aug 2022 02:45:47 +0000 (20:45 -0600)]
[lldb] Dynamically generate enum names in lldbutil

Change the `<enum>_to_str` functions in lldbutil to be dynamic.

Instead of a manually maintained if/elif switch, the functions now perform
lookup in a dynamically generated dict. The names are determined by stripping
the enum's prefix, and then lowercasing the remaining suffix, ex:

    eStateRunning -> "running"

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

2 years ago[libc++][NFC] Fix `the the` in comment in `__format/buffer.h`
Adrian Vogelsgesang [Sun, 7 Aug 2022 18:02:28 +0000 (11:02 -0700)]
[libc++][NFC] Fix `the the` in comment in `__format/buffer.h`

I made this commit primarily to test my commit access to the LLVM repo

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

2 years ago[mlir] Fix a warning
Kazu Hirata [Sun, 7 Aug 2022 18:13:19 +0000 (11:13 -0700)]
[mlir] Fix a warning

This patch fixes:

  llvm-project/mlir/include/mlir/IR/OpDefinition.h:1544:19: error: use
  of bitwise '|' with boolean operands
  [-Werror,-Wbitwise-instead-of-logical]

2 years ago[ConstFolding] fix overzealous assert when converting FP half
Sanjay Patel [Sun, 7 Aug 2022 17:33:44 +0000 (13:33 -0400)]
[ConstFolding] fix overzealous assert when converting FP half

Fixes #56981

2 years ago[InstCombine] add tests for bitwise logic; NFC
Sanjay Patel [Sat, 6 Aug 2022 18:22:12 +0000 (14:22 -0400)]
[InstCombine] add tests for bitwise logic; NFC

2 years ago[JITLink] Fix some C++17 related fixmes.
Lang Hames [Sun, 7 Aug 2022 15:58:08 +0000 (08:58 -0700)]
[JITLink] Fix some C++17 related fixmes.

2 years ago[ORC-RT] Drop __orc_rt::string_view now that we have c++17.
Lang Hames [Sun, 7 Aug 2022 04:58:56 +0000 (21:58 -0700)]
[ORC-RT] Drop __orc_rt::string_view now that we have c++17.

b1356504e63 enabled the use of c++17 features in LLVM, which means that we can
drop the ORC runtime's placeholder string_view implemention in favor of
std::string_view.

2 years ago[clang][CodeGen] Factor out Swift ABI hooks (NFCI)
Sergei Barannikov [Sun, 7 Aug 2022 16:21:40 +0000 (00:21 +0800)]
[clang][CodeGen] Factor out Swift ABI hooks (NFCI)

Swift calling conventions stands out in the way that they are lowered in
mostly target-independent manner, with very few customization points.
As such, swift-related methods of ABIInfo do not reference the rest of
ABIInfo and vice versa.
This change follows interface segregation principle; it removes
dependency of SwiftABIInfo on ABIInfo. Targets must now implement
SwiftABIInfo separately if they support Swift calling conventions.

Almost all targets implemented `shouldPassIndirectly` the same way. This
de-facto default implementation has been moved into the base class.

`isSwiftErrorInRegister` used to be virtual, now it is not. It didn't
accept any arguments which could have an effect on the returned value.
This is now a static property of the target ABI.

Reviewed By: rusyaev-roman, inclyc

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

2 years ago[X86] Add test case to recombine LEA from OR.
Amaury Séchet [Sun, 7 Aug 2022 15:55:14 +0000 (15:55 +0000)]
[X86] Add test case to recombine LEA from OR.

2 years ago[flang] Allow pure function references in expandable scalar
Peter Klausler [Wed, 3 Aug 2022 17:25:43 +0000 (10:25 -0700)]
[flang] Allow pure function references in expandable scalar

F18 disallows function references and coarray references from
appearing in scalar expressions that are to be expanded into
arrays to conform with other operands or actual arguments in
an elemental expression.  This is too strong, as pure procedures
can be safely used.

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

2 years ago[mlir] Flip to prefixed accessors (NFC)
Jacques Pienaar [Sun, 7 Aug 2022 15:46:15 +0000 (08:46 -0700)]
[mlir] Flip to prefixed accessors (NFC)

Missed these in td files.

2 years ago[polly] Fixed a number of typos. NFC
Gabriel Ravier [Sun, 7 Aug 2022 14:53:09 +0000 (22:53 +0800)]
[polly] Fixed a number of typos. NFC

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: inclyc

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

2 years ago[clang-tidy] Fix a forwarding-reference-overload crash after the
Haojian Wu [Sat, 6 Aug 2022 21:34:02 +0000 (23:34 +0200)]
[clang-tidy] Fix a forwarding-reference-overload crash after the
ElaboratedType change.

After 15f3cd6bfc670ba6106184a903eb04be059e5977, the nss of
ElaboratedType can be null.

2 years agoRevert "[RDF] Remove explicit template arguments from Print"
Aaron Ballman [Sun, 7 Aug 2022 12:24:01 +0000 (08:24 -0400)]
Revert "[RDF] Remove explicit template arguments from Print"

This reverts commit ede96de751224487aea122af8bfb4e82bc54840b.

This breaks the build on Windows with Visual Studio:
https://lab.llvm.org/buildbot/#/builders/123/builds/12134

2 years ago[Polly] Suppress the LLVM-IR output for pattern matching tests, if there is no FileCh...
Roman Gareev [Sun, 7 Aug 2022 11:48:54 +0000 (14:48 +0300)]
[Polly] Suppress the LLVM-IR output for pattern matching tests, if there is no FileCheck-ing for it.

2 years ago[mlir] Flip to prefixed accessors (NFC)
Jacques Pienaar [Sun, 7 Aug 2022 11:55:58 +0000 (04:55 -0700)]
[mlir] Flip to prefixed accessors (NFC)

2 years ago[ARM] Regenerate vector_store.ll tests. NFC
David Green [Sun, 7 Aug 2022 11:46:28 +0000 (12:46 +0100)]
[ARM] Regenerate vector_store.ll tests. NFC

2 years ago[Polly] Generalize the pattern matching to the case of tensor contractions
Roman Gareev [Sat, 21 May 2022 19:40:33 +0000 (22:40 +0300)]
[Polly] Generalize the pattern matching to the case of tensor contractions

The pattern matching optimization of Polly detects and optimizes dense general
matrix-matrix multiplication. The generated code is close to high performance
implementations of matrix-matrix multiplications, which are contained in
manually tuned libraries. The described pattern matching optimization is
a particular case of tensor contraction optimization, which was
introduced in [1].

This patch generalizes the pattern matching to the case of tensor contractions
using the form of data dependencies and memory accesses produced by tensor
contractions [1].

Optimization of tensor contractions will be added in the next patch. Following
the ideas introduced in [2], it will logically represent tensor contraction
operands as matrix multiplication operands and use an approach for
optimization of matrix-matrix multiplications.

[1] - Gareev R., Grosser T., Kruse M. High-Performance Generalized Tensor
Op­erations: A Compiler-Oriented Approach // ACM Transactions on
Architec­ture and Code Optimization (TACO). 2018. Vol. 15, no. 3.
P. 34:1–34:27. DOI: 10.1145/3235029.

[2] - Matthews D. High-Performance Tensor Contraction without BLAS // SIAM
Journal on Scientific Computing. 2018. Vol. 40, no. 1. P. C 1—C 24.
DOI: 110.1137/16m108968x.

Reviewed By: Meinersbur

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

2 years ago[libc++][test] Fix MSVC warnings C6054, C6001, C4242 in format_tests.h
Igor Zhukov [Sat, 6 Aug 2022 16:01:04 +0000 (23:01 +0700)]
[libc++][test] Fix MSVC warnings C6054, C6001, C4242 in format_tests.h

Reviewed By: Mordante

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

2 years ago[mlir] Make use of C++17 language features
Markus Böck [Sun, 7 Aug 2022 09:16:38 +0000 (11:16 +0200)]
[mlir] Make use of C++17 language features

Now that C++17 is enabled in LLVM, a lot of the TODOs and patterns to emulate C++17 features can be eliminated.
The steps I have taken were essentially:
```
git grep C++17
git grep c++17
git grep "initializer_list<int>"
```
and address given comments and patterns.
Most of the changes boiled down to just using fold expressions rather than initializer_list.

While doing this I also discovered that Clang by default restricts the depth of fold expressions to 256 elements. I specifically hit this with `TestDialect` in `addOperations`. I opted to not replace it with fold expressions because of that but instead adding a comment documenting the issue.
If any other functions may be called with more than 256 elements in the future we might have to revert other parts as well.
I don't think this is a common occurence besides the `TestDialect` however. If need be, this could potentially be fixed via `mlir-tblgen` in the future.

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

2 years ago[demangler] Add getters for Qual/Vector/Pointer types
Alexey Bader [Mon, 1 Aug 2022 15:06:38 +0000 (08:06 -0700)]
[demangler] Add getters for Qual/Vector/Pointer types

These are useful for downstream tool aligning the mangling of data types which differ between different languages/targets.

Patch by Steffen Larsen <steffen.larsen@intel.com>

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

2 years agoAdded warning about outdated feature into Kaleidoscope tutorial text
Shivam Gupta [Sat, 6 Aug 2022 07:52:42 +0000 (13:22 +0530)]
Added warning about outdated feature into Kaleidoscope tutorial text

**Motivation: **  I have been studying LLVM with LLVM Kaleidoscope tutorial. In the 4th part I faced an error which said that I can't redefine a function as shown in the tutorial. After hours of searching, I finally found the reason that produced the error is that the feature of symbols redefinition has been disabled since LLVM-9. There was no information about that in the tutorial's text, so I've decided to add a warning.

**Changes**: The only file I fixed is "`llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst`", I added text warning which says that described feature is outdated and the described functionality will not work properly on LLVM versions older 8 one.

Patch by : DKay7

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

2 years ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Sun, 7 Aug 2022 07:16:20 +0000 (00:16 -0700)]
[llvm] Use range-based for loops (NFC)

2 years ago[x86] Remove unused declaration processWaitCnt (NFC)
Kazu Hirata [Sun, 7 Aug 2022 07:16:19 +0000 (00:16 -0700)]
[x86] Remove unused declaration processWaitCnt (NFC)

The declaration was introduced without a corresponding definition on
Jan 2, 2022 in commit 85e6e748d426f8992016914b07bc67c4da22e278.

2 years agoUse llvm::is_contained (NFC)
Kazu Hirata [Sun, 7 Aug 2022 07:16:17 +0000 (00:16 -0700)]
Use llvm::is_contained (NFC)

2 years ago[Target] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 7 Aug 2022 07:16:16 +0000 (00:16 -0700)]
[Target] Remove unused forward declarations (NFC)

2 years ago[llvm] Fix comment typos (NFC)
Kazu Hirata [Sun, 7 Aug 2022 07:16:14 +0000 (00:16 -0700)]
[llvm] Fix comment typos (NFC)

2 years ago[mlir] Remove redundaunt return statements (NFC)
Kazu Hirata [Sun, 7 Aug 2022 07:16:13 +0000 (00:16 -0700)]
[mlir] Remove redundaunt return statements (NFC)

Identified with readability-redundant-control-flow.

2 years ago[llvm] Drop unnecessary const from return types (NFC)
Kazu Hirata [Sun, 7 Aug 2022 07:16:11 +0000 (00:16 -0700)]
[llvm] Drop unnecessary const from return types (NFC)

Identified with readability-const-return-type.

2 years ago[LLDB][NFC] Reliability fixes to TCPSocket code
Slava Gurevich [Fri, 5 Aug 2022 20:54:08 +0000 (13:54 -0700)]
[LLDB][NFC] Reliability fixes to TCPSocket code

Patch the following issues found by static code inspection:
- Unchecked return values from lib calls
- Passing potentially negative arg into a function that requires non-negative input
- Possible socket double-close

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

2 years ago[MLIR] Add MlirValue to PybindAdapters
John Demme [Sun, 7 Aug 2022 04:58:46 +0000 (21:58 -0700)]
[MLIR] Add MlirValue to PybindAdapters

Allows out-of-tree users to automatically cast to/from MlirValue.

2 years ago[clang][docs] use `Fixes` instead of `This fixes` in ReleaseNotes [NFC]
YingChi Long [Sun, 7 Aug 2022 04:42:15 +0000 (12:42 +0800)]
[clang][docs] use `Fixes` instead of `This fixes` in ReleaseNotes [NFC]

2 years ago[mlir][tosa] Flip to prefixed form.
Jacques Pienaar [Sun, 7 Aug 2022 02:24:40 +0000 (19:24 -0700)]
[mlir][tosa] Flip to prefixed form.

Flipped to _Both 2 weeks ago, flipping to _Prefixed now.

2 years ago[llvm] LLVM_NODISCARD => [[nodiscard]]. NFC
Fangrui Song [Sun, 7 Aug 2022 00:26:33 +0000 (00:26 +0000)]
[llvm] LLVM_NODISCARD => [[nodiscard]]. NFC

With C++17 there is no Clang pedantic warning.

2 years ago[lld] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
Fangrui Song [Sun, 7 Aug 2022 00:02:35 +0000 (00:02 +0000)]
[lld] LLVM_FALLTHROUGH => [[fallthrough]]. NFC

With C++17 there is no Clang pedantic warning or MSVC C5051.

2 years agoRevert "[SampleProfileInference] Work around odr-use of const non-inline static data...
Fangrui Song [Sat, 6 Aug 2022 23:48:23 +0000 (16:48 -0700)]
Revert "[SampleProfileInference] Work around odr-use of const non-inline static data member to fix -O0 builds after D120508"

This reverts commit 48c74bb2e2a72830f1068823bfc2f6fd4b53d427.
With C++17 the workaround is no longer needed.

2 years agoRevert "[lld-macho] Work around odr-use of const non-inline static data member to...
Fangrui Song [Sat, 6 Aug 2022 23:44:14 +0000 (16:44 -0700)]
Revert "[lld-macho] Work around odr-use of const non-inline static data member to fix -O0 build after D128298"

This reverts commit 20b2d3260d4a1878ca2a37cee6ee335a21a12d0f.
The workaround is no longer needed for C++17.

2 years ago[clang-tidy] Fix g++ -DCMAKE_CXX_STANDARD=17 build
Fangrui Song [Sat, 6 Aug 2022 23:12:18 +0000 (23:12 +0000)]
[clang-tidy] Fix g++ -DCMAKE_CXX_STANDARD=17 build

`constexpr std::initializer_list<llvm::StringRef>` leads to
```
error: modification of '<temporary>' is not a constant expression
```
Related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102921

2 years ago[ADT] Fix signature of StringSet::insert
Fangrui Song [Sat, 6 Aug 2022 22:48:41 +0000 (22:48 +0000)]
[ADT] Fix signature of StringSet::insert

to match StringMap and unordered_set.

2 years ago[Clang][OpenMP] Fix the issue that `llvm.lifetime.end` is emitted too early for varia...
Shilei Tian [Sat, 6 Aug 2022 20:50:30 +0000 (16:50 -0400)]
[Clang][OpenMP] Fix the issue that `llvm.lifetime.end` is emitted too early for variables captured in linear clause

Currently if an OpenMP program uses `linear` clause, and is compiled with
optimization, `llvm.lifetime.end` for variables listed in `linear` clause are
emitted too early such that there could still be uses after that. Let's take the
following code as example:
```
// loop.c
int j;
int *u;

void loop(int n) {
  int i;
  for (i = 0; i < n; ++i) {
    ++j;
    u = &j;
  }
}
```
We compile using the command:
```
clang -cc1 -fopenmp-simd -O3 -x c -triple x86_64-apple-darwin10 -emit-llvm loop.c -o loop.ll
```
The following IR (simplified) will be generated:
```
@j = local_unnamed_addr global i32 0, align 4
@u = local_unnamed_addr global ptr null, align 8

define void @loop(i32 noundef %n) local_unnamed_addr {
entry:
  %j = alloca i32, align 4
  %cmp = icmp sgt i32 %n, 0
  br i1 %cmp, label %simd.if.then, label %simd.if.end

simd.if.then:                                     ; preds = %entry
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %j)
  store ptr %j, ptr @u, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j)
  %0 = load i32, ptr %j, align 4
  store i32 %0, ptr @j, align 4
  br label %simd.if.end

simd.if.end:                                      ; preds = %simd.if.then, %entry
  ret void
}
```
The most important part is:
```
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j)
  %0 = load i32, ptr %j, align 4
  store i32 %0, ptr @j, align 4
```
`%j` is still loaded after `@llvm.lifetime.end.p0(i64 4, ptr nonnull %j)`. This
could cause the backend incorrectly optimizes the code and further generates
incorrect code. The root cause is, when we emit a construct that could have
`linear` clause, it usually has the following pattern:
```
EmitOMPLinearClauseInit(S)
{
  OMPPrivateScope LoopScope(*this);
  ...
  EmitOMPLinearClause(S, LoopScope);
  ...
  (void)LoopScope.Privatize();
  ...
}
EmitOMPLinearClauseFinal(S, [](CodeGenFunction &) { return nullptr; });
```
Variables that need to be privatized are added into `LoopScope`, which also
serves as a RAII object. When `LoopScope` is destructed and if optimization is
enabled, a `@llvm.lifetime.end` is also emitted for each privatized variable.
However, the writing back to original variables in `linear` clause happens after
the scope in `EmitOMPLinearClauseFinal`, causing the issue we see above.

A quick "fix" seems to be, moving `EmitOMPLinearClauseFinal` inside the scope.
However, it doesn't work. That's because the local variable map has been updated
by `LoopScope` such that a variable declaration is mapped to the privatized
variable, instead of the actual one. In that way, the following code will be
generated:
```
  %0 = load i32, ptr %j, align 4
  store i32 %0, ptr %j, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %j)
```
Well, now the life time is correct, but apparently the writing back is broken.

In this patch, a new function `OMPPrivateScope::restoreMap` is added and called
before calling `EmitOMPLinearClauseFinal`. This can make sure that
`EmitOMPLinearClauseFinal` can find the orignal varaibls to write back.

Fixes #56913.

Reviewed By: ABataev

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

2 years agolld/cmake: Drop use of llvm-config for LLVM install discovery
Tom Stellard [Sat, 6 Aug 2022 13:22:19 +0000 (09:22 -0400)]
lld/cmake: Drop use of llvm-config for LLVM install discovery

This has been deprecated since D116492 earlier in 2022.

That seems recent, but with the recent cut of LLVM 15 that is still two releases (14 and 15). Meanwhile Clang has deprecated `llvm-config` for a lot longer, and since it is likely that LLD users are also Clang users, this serves as an extra "heads up" that `llvm-config` is on its way out.

Remove it in favor of using CMake's find_package() function.

Reviewed By: MaskRay, mgorny

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

2 years agoclang/cmake: Drop use of llvm-config for LLVM install discovery
Tom Stellard [Sat, 6 Aug 2022 13:22:05 +0000 (09:22 -0400)]
clang/cmake: Drop use of llvm-config for LLVM install discovery

This has been deprecated for a while, since D51714 in 2018.

Remove it in favor of using CMake's find_package() function.

Reviewed By: phosek, mgorny

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

2 years ago[bazel] Switch to C++17
Benjamin Kramer [Sat, 6 Aug 2022 19:47:44 +0000 (21:47 +0200)]
[bazel] Switch to C++17

LLVM switched to C++17 in b1356504e63ae821cccf1e051a0d2526bdfef2b0

2 years agoclang: fix typo availbility
Aarush Bhat [Sat, 6 Aug 2022 19:42:16 +0000 (03:42 +0800)]
clang: fix typo availbility

- Fixes [[ https://github.com/llvm/llvm-project/issues/56787 | #56787 ]].

I am fixing the spelling of availability.

I am unsure if this change will have any side effects. If someone can
help on how to check if it has any side effects, I can test those out as
well.

Reviewed By: inclyc

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

2 years ago[RDF] Use default TargetOperandInfo if not given in constructor
Krzysztof Parzyszek [Sat, 6 Aug 2022 19:29:19 +0000 (14:29 -0500)]
[RDF] Use default TargetOperandInfo if not given in constructor

All current in-tree users use the default implementation.

2 years ago[bolt] silence unused variables warnings
Thorsten Schütt [Sat, 6 Aug 2022 18:51:40 +0000 (20:51 +0200)]
[bolt] silence unused variables warnings

2 years ago[RDF] Remove explicit template arguments from Print
Krzysztof Parzyszek [Sat, 6 Aug 2022 17:09:18 +0000 (12:09 -0500)]
[RDF] Remove explicit template arguments from Print

CTAD takes care of it.

2 years agoUse value instead of getValue (NFC)
Kazu Hirata [Sat, 6 Aug 2022 18:21:39 +0000 (11:21 -0700)]
Use value instead of getValue (NFC)

2 years ago[mlir, flang] Use has_value instead of hasValue (NFC)
Kazu Hirata [Sat, 6 Aug 2022 18:12:47 +0000 (11:12 -0700)]
[mlir, flang] Use has_value instead of hasValue (NFC)

2 years agoUpdate the status of some more C DRs
Aaron Ballman [Sat, 6 Aug 2022 15:52:28 +0000 (11:52 -0400)]
Update the status of some more C DRs

Update some of the C99-era DRs starting in the 300s.

2 years ago[bazel] Port 1c5a50e32815a49a41d79ff529ca8611ee49c5c8
Benjamin Kramer [Sat, 6 Aug 2022 14:08:48 +0000 (16:08 +0200)]
[bazel] Port 1c5a50e32815a49a41d79ff529ca8611ee49c5c8

2 years ago[libc++] Remove `operator!=` from `type_info` in C++20
Adrian Vogelsgesang [Sat, 6 Aug 2022 13:09:50 +0000 (15:09 +0200)]
[libc++] Remove `operator!=` from `type_info` in C++20

Implements part of:

* P1614R2 The Mothership has Landed

Reviewed By: #libc, Mordante

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

2 years ago[libc++] Implement `operator<=>` for `unique_ptr`
Adrian Vogelsgesang [Sat, 6 Aug 2022 13:04:38 +0000 (15:04 +0200)]
[libc++] Implement `operator<=>` for `unique_ptr`

Implements part of:

  - P1614R2 The Mothership has Landed

Fixes LWG3426

Reviewed By: #libc, Mordante

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

2 years ago[NFC] add test cases for D123366
Chen Zheng [Tue, 19 Jul 2022 08:24:49 +0000 (04:24 -0400)]
[NFC] add test cases for D123366

2 years ago[PowerPC] fix stack size allocated for float point argument
Chen Zheng [Tue, 12 Jul 2022 11:28:19 +0000 (07:28 -0400)]
[PowerPC] fix stack size allocated for float point argument

This is for https://github.com/llvm/llvm-project/issues/56469

Allocate 4 bytes for float point arguments on PPC32.

Reviewed By: nemanjai

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

2 years ago[gn build] fix 547c551925c8f4dd
Nico Weber [Sat, 6 Aug 2022 12:36:01 +0000 (08:36 -0400)]
[gn build] fix 547c551925c8f4dd

2 years ago[gn build] Try to fix build on linux after std=c++17 switch
Nico Weber [Sat, 6 Aug 2022 12:29:11 +0000 (08:29 -0400)]
[gn build] Try to fix build on linux after std=c++17 switch

glibc annotates `process_vm_readv` with `__THROW`.
lldb/include/lldb/Host/linux/Uio.h and
lldb/source/Host/linux/LibcGlue.cpp don't.

Having a mismatch causes an error with c++17:

    ../../lldb/source/Host/linux/LibcGlue.cpp:18:9:
        error: 'process_vm_readv' is missing exception specification 'throw()'
    ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
            ^
    ../../lldb/include/lldb/Host/linux/Uio.h:18:9:
        note: previous declaration is here
    ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
            ^

The diagnostic is a bit misleading, since the previous declaration
in the sysroot (in usr/include/x76_64-linux-gnu/bits/uio-ext.h) is
what has the `__THROW`.

In the cmake build, cmake sets `HAVE_PROCESS_VM_READV` correctly based
on header probing.

In the GN build, just set it to 1 unconditionally on linux. If that
turns out to not be good enough everywhere, we'll have to add a GN arg
for this.

(I'm also setting it to 1 on Android. I'm not sure if that's correct --
but we don't build lldb for Android anyways.)

2 years ago[llvm] Remove uses of deprecated `std::iterator`
Markus Böck [Sat, 6 Aug 2022 11:31:48 +0000 (13:31 +0200)]
[llvm] Remove uses of deprecated `std::iterator`

std::iterator has been deprecated in C++17 and some standard library implementations such as MS STL or libc++ emit deperecation messages when using the class.
Since LLVM has now switched to C++17 these will emit warnings on these implementations, or worse, errors in build configurations using -Werror.

This patch fixes these issues by replacing them with LLVMs own llvm::iterator_facade_base which offers a superset of functionality of std::iterator.

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

2 years ago[mlir][tblgen] Refact mlir-tblgen main into its own library
Markus Böck [Wed, 3 Aug 2022 21:43:41 +0000 (23:43 +0200)]
[mlir][tblgen] Refact mlir-tblgen main into its own library

This has previously been done for `mlir-opt` and `mlir-reduce` and roughly the same approach has been done here.

The use case for having a separate library is that it is easier for downstream to make custom TableGen backends/executable that work on top of the utilities that are defined in `mlir/TableGen`.
The customization point here is the same one as for any upstream TableGen backends: One can add a new generator by simply creating a global instance of `mlir::GenRegistration`.

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

2 years ago[gn build] port b1356504e63ae better (c++17)
Nico Weber [Sat, 6 Aug 2022 11:54:43 +0000 (07:54 -0400)]
[gn build] port b1356504e63ae better (c++17)

2 years ago[gn build] port b1356504e63ae (c++17)
Nico Weber [Sat, 6 Aug 2022 11:51:06 +0000 (07:51 -0400)]
[gn build] port b1356504e63ae (c++17)

2 years ago[bazel] Add missing dependency after 713f85d5952ab27d474aba2a960a893b7e7e438d
Benjamin Kramer [Sat, 6 Aug 2022 09:34:24 +0000 (11:34 +0200)]
[bazel] Add missing dependency after 713f85d5952ab27d474aba2a960a893b7e7e438d

2 years ago[ELF] toString(const InputFile *): synchronize toStringCache
Fangrui Song [Sat, 6 Aug 2022 08:00:06 +0000 (01:00 -0700)]
[ELF] toString(const InputFile *): synchronize toStringCache

The function may be called currently for diagnostics.

2 years agoTransform illegal intrinsics to V_ILLEGAL
Leon Clark [Sat, 6 Aug 2022 07:57:12 +0000 (08:57 +0100)]
Transform illegal intrinsics to V_ILLEGAL

Related tasks:

- SWDEV-240194
- SWDEV-309417
- SWDEV-334876

Reviewed By: arsenm

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

2 years ago[LLVM] Update C++ standard to 17
Tobias Hieta [Fri, 5 Aug 2022 19:45:55 +0000 (21:45 +0200)]
[LLVM] Update C++ standard to 17

Also make the soft toolchain requirements hard. This allows
us to use C++17 features in LLVM now.

If we find patterns with C++17 that improve readability
it should be recommended in the coding standards.

Reviewed By: jhenderson, cor3ntin, MaskRay

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

2 years ago[Clang][Lex] Extend HeaderSearch::LookupFile to control OpenFile behavior.
Jun Zhang [Sat, 6 Aug 2022 03:36:02 +0000 (11:36 +0800)]
[Clang][Lex] Extend HeaderSearch::LookupFile to control OpenFile behavior.

In the case of static compilation the file system is pretty much read-only
and taking a snapshot of it usually is sufficient. In the interactive C++
case the compilation is longer and people can create and include files, etc.
In that case we often do not want to open files or cache failures unless is
absolutely necessary.

This patch extends the original API call by forwarding some optional flags,
so we can continue use it in the previous way with no breakage.
Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D131241

2 years ago[NFC] add test case for D129558
Chen Zheng [Tue, 12 Jul 2022 11:41:49 +0000 (07:41 -0400)]
[NFC] add test case for D129558

2 years ago [LLDB] Missing break in a switch statement alters the execution flow.
Slava Gurevich [Sat, 6 Aug 2022 01:15:45 +0000 (18:15 -0700)]
  [LLDB] Missing break in a switch statement alters the execution flow.

    Looks like a typo from the past code changes.

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

2 years ago[ELF][AArch64] Fix potentially corrupted section content for PAC
Fangrui Song [Sat, 6 Aug 2022 01:24:53 +0000 (18:24 -0700)]
[ELF][AArch64] Fix potentially corrupted section content for PAC

D74537 introduced a bug: if `(config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_PAC) != 0`
with -z pac-plt unspecified, we incorrectly use AArch64BtiPac, whose writePlt will make
out-of-bounds write after the .plt section. This is often benign because the
output section after .plt will usually overwrite the content.

This is very difficult to test without D131247 (Parallelize writes of different OutputSections).

2 years ago[ELF] Keep only getTarget() call. NFC
Fangrui Song [Sat, 6 Aug 2022 01:20:23 +0000 (18:20 -0700)]
[ELF] Keep only getTarget() call. NFC

The place from D61712 seems unneeded now. We can just use the place added by
D62609 (support AArch64 BTI/PAC).

2 years ago[test/Modules/cxx20-export-import.cpp] Pre-clean the modules cache directory of the...
Argyrios Kyrtzidis [Sat, 6 Aug 2022 00:26:51 +0000 (17:26 -0700)]
[test/Modules/cxx20-export-import.cpp] Pre-clean the modules cache directory of the test, NFC

2 years ago[ELF] mergeCmp: work around irreflexivity bug
Fangrui Song [Sat, 6 Aug 2022 00:08:37 +0000 (17:08 -0700)]
[ELF] mergeCmp: work around irreflexivity bug

Some tests (e.g. aarch64-feature-pac.s) segfault in libstdc++ _GLIBCXX_DEBUG
builds (enabled by LLVM_ENABLE_EXPENSIVE_CHECKS).

dyn_cast<ThunkSection> is incorrectly true for any SyntheticSection. std::merge
transitively calls mergeCmp(x, x) (due to __glibcxx_requires_irreflexive_pred)
and will segfault in `ta->getTargetInputSection()`. The dyn_cast<ThunkSection>
issue should be eventually fixed properly, bug `a != b` is robust enough for now.

2 years agounbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV=OFF after 6635f48e4aba
Nico Weber [Fri, 5 Aug 2022 23:50:23 +0000 (19:50 -0400)]
unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV=OFF after 6635f48e4aba

See revision b8b7a9dcdcbc for prior art.

2 years ago[HLSL] emit-obj when set output.
Xiang Li [Sun, 31 Jul 2022 22:16:24 +0000 (15:16 -0700)]
[HLSL] emit-obj when set output.

When not set output, set default output to stdout.
When set output with -Fo and no -fcgl, set -emit-obj to generate dx container.

Reviewed By: beanz

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

2 years ago[CUDA] Fix output name being replaced in device-only mode
Joseph Huber [Fri, 5 Aug 2022 18:43:23 +0000 (14:43 -0400)]
[CUDA] Fix output name being replaced in device-only mode

When performing device only compilation, there was an issue where
`cubin` outputs were being renamed to `cubin` despite the user's name.
This is required in a normal compilation flow as the Nvidia tools only
understand specific filenames instead of checking magic bytes for some
unknown reason. We do not want to perform this transformation when the
user is performing device only compilation.

Reviewed By: tra

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

2 years ago[Serialization] Remove `ORIGINAL_PCH_DIR` record
Argyrios Kyrtzidis [Wed, 3 Aug 2022 22:24:25 +0000 (15:24 -0700)]
[Serialization] Remove `ORIGINAL_PCH_DIR` record

Use of `ORIGINAL_PCH_DIR` record has been superseeded by making PCH/PCM files with relocatable paths at write time.
Removing this record is useful for producing an output-path-independent PCH file and enable sharing of the same PCH file even
when it was intended for a different output path.

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

2 years ago[Sanitizer][Darwin] Support OS versions before DRIVERKIT
Keith Smiley [Fri, 5 Aug 2022 20:26:24 +0000 (13:26 -0700)]
[Sanitizer][Darwin] Support OS versions before DRIVERKIT

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

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

2 years ago[ELF][PPC64] Fix potentially corrupted section content with empty .got
Fangrui Song [Fri, 5 Aug 2022 22:22:57 +0000 (15:22 -0700)]
[ELF][PPC64] Fix potentially corrupted section content with empty .got

D91426 makes .got possibly empty while needed. If .got and .data have the same
address, and .got's content is written after .data, the first word of .data will
be corrupted.

The bug is not testable without D131247.

2 years ago[mlir] Use SymbolTableCollection to lookup referenced symbol in AddressOfOp
Eugene Zhulenev [Fri, 5 Aug 2022 20:52:18 +0000 (13:52 -0700)]
[mlir] Use SymbolTableCollection to lookup referenced symbol in AddressOfOp

Depends On D131285

Reviewed By: Mogball

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

2 years ago[libc++][ranges][NFC] Mark the completed Ranges papers and issues as done.
Konstantin Varlamov [Fri, 5 Aug 2022 21:02:50 +0000 (14:02 -0700)]
[libc++][ranges][NFC] Mark the completed Ranges papers and issues as done.

The newly-completed papers:
- P0896R4 ("The One Ranges Proposal");
- P1243R4 ("Rangify New Algorithms");
- P1252R2 ("Ranges Design Cleanup");
- P1716R3 ("Range Comparison Algorithms Are Over-Constrained");
- P1871R1 ("Concept traits should be named after concepts");
- P2106R0 ("Alternative wording for GB315 and GB316").

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

2 years ago[DAGCombiner] Hoist funnel shifts from logic operation
Filipp Zhinkin [Fri, 5 Aug 2022 20:56:45 +0000 (16:56 -0400)]
[DAGCombiner] Hoist funnel shifts from logic operation

Hoist funnel shift from logic op:
logic_op (FSH x0, x1, s), (FSH y0, y1, s) --> FSH (logic_op x0, y0), (logic_op x1, y1), s

The transformation improves code generated for some cases related to
issue https://github.com/llvm/llvm-project/issues/49541.

Reduced amount of funnel shifts can also improve throughput on x86 CPUs by utilizing more
available ports: https://quick-bench.com/q/gC7AKkJJsDZzRrs_JWDzm9t_iDM

Transformation correctness checks:
https://alive2.llvm.org/ce/z/TKPULH
https://alive2.llvm.org/ce/z/UvTd_9
https://alive2.llvm.org/ce/z/j8qW3_
https://alive2.llvm.org/ce/z/7Wq7gE
https://alive2.llvm.org/ce/z/Xr5w8R
https://alive2.llvm.org/ce/z/D5xe_E
https://alive2.llvm.org/ce/z/2yBZiy

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

2 years ago[libc++][ranges][NFC] Make sure all implemented algorithms are enabled in "robust...
Konstantin Varlamov [Fri, 5 Aug 2022 21:01:46 +0000 (14:01 -0700)]
[libc++][ranges][NFC] Make sure all implemented algorithms are enabled in "robust" tests.

Also fix `std::find_first_of` (which accidentally copied the predicate
in the implementation).

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

2 years ago[ORC] Fix a memory leak in LLVMOrcIRTransformLayerSetTransform.
Lang Hames [Fri, 5 Aug 2022 19:03:34 +0000 (12:03 -0700)]
[ORC] Fix a memory leak in LLVMOrcIRTransformLayerSetTransform.

This function heap-allocates a ThreadSafeModule (the current C bindings assume
that TSMs are always heap-allocated), but was failing to free it.

Should fix http://llvm.org/PR56953.

2 years ago[examples][ORC] Add missing call to LLVMDisposeBuilder to example.
Lang Hames [Fri, 5 Aug 2022 18:41:38 +0000 (11:41 -0700)]
[examples][ORC] Add missing call to LLVMDisposeBuilder to example.

The missing call was pointed out in https://llvm.org/PR56953, though it's not
the focus of that issue.

2 years ago[mlir] Implement SymbolUserOpInterface in LLVM::CallOp
Eugene Zhulenev [Fri, 5 Aug 2022 20:08:08 +0000 (13:08 -0700)]
[mlir] Implement SymbolUserOpInterface in LLVM::CallOp

Avoid expensive calls to `SymbolTable::lookupNearestSymbolFrom` in verifier

Reviewed By: Mogball

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

2 years ago[mlir][spirv] Define spv.IAddCarry
Jakub Kuderski [Fri, 5 Aug 2022 20:45:32 +0000 (16:45 -0400)]
[mlir][spirv] Define spv.IAddCarry

Based on `spv.ISubBorrow` from D127909.
Also resolved some clang-tidy warnings.

Reviewed By: antiagainst, ThomasRaoux

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

2 years ago[NFC][Inliner] Add Load/Store handler
Vitaly Buka [Wed, 3 Aug 2022 22:04:26 +0000 (15:04 -0700)]
[NFC][Inliner] Add Load/Store handler

This is an additional signal which may benefit sanitizers.

Reviewed By: kda

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

2 years ago[test][SimpleLoopUnswitch] Precommit test for D129599
Ruobing Han [Fri, 5 Aug 2022 20:17:26 +0000 (20:17 +0000)]
[test][SimpleLoopUnswitch] Precommit test for D129599

2 years ago[HWASan] Remove incorrect unreachable.
Florian Mayer [Fri, 5 Aug 2022 19:09:05 +0000 (12:09 -0700)]
[HWASan] Remove incorrect unreachable.

This function could be called wih access_info & 0x20 or with
flags()->halt_on_error, in which case HandleTagMismatch returns (is not
fatal).

Reviewed By: eugenis

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

2 years ago[NFC] Regenerates X86's win64-bool.ll
Amaury Séchet [Fri, 5 Aug 2022 19:46:26 +0000 (19:46 +0000)]
[NFC] Regenerates X86's win64-bool.ll