platform/upstream/llvm.git
23 months ago[bazel] Remove --config=rbe
Arthur Eubanks [Thu, 11 Aug 2022 21:12:34 +0000 (14:12 -0700)]
[bazel] Remove --config=rbe

RBE is currently broken due to the RBE container being too old and not supporting C++17.
The bots have already stopped using --config=rbe.

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

23 months ago[MLIR] Add utility function to create values for all dimensions of a tensor value
Frederik Gossen [Fri, 12 Aug 2022 18:40:48 +0000 (14:40 -0400)]
[MLIR] Add utility function to create values for all dimensions of a tensor value

This is a variant of the already provided `createDynamicDimValues` helper.

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

23 months ago[clang-doc] Always emit the TagType for RecordInfo
Brett Wilson [Fri, 12 Aug 2022 18:38:21 +0000 (18:38 +0000)]
[clang-doc] Always emit the TagType for RecordInfo

Always emit the TagType for RecordInfo in YAML output. Previously this omitted the type for "struct", considering it the default. But records in C++ don't really have a default type so always emitting this is more clear.

Emit IsTypeDef in YAML. Previously this existed only in the Representation but was never written. Additionally, adds IsTypeDef to the record merge operation which was clearing it (all RecordInfo structures are merged with am empty RecordInfo during the reduce phase).

Reviewed By: paulkirth

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

23 months ago[clang-doc] Fix assert on startup
Brett Wilson [Fri, 12 Aug 2022 18:35:42 +0000 (18:35 +0000)]
[clang-doc] Fix assert on startup

When using `clang-doc --format=html` it will crash on startup because of an assertion doing a self-assignment of a `SmallString`. This patch removes the self-assignment by creating an intermediate copy.

Reviewed By: paulkirth

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

23 months ago[mlir][sparse] enable integral abs recognition
Aart Bik [Thu, 11 Aug 2022 19:22:21 +0000 (12:22 -0700)]
[mlir][sparse] enable integral abs recognition

The end-to-end test for this new feature also exposed a bug
in LLVM IR lowering (since then, fixed), where we need to account
for the min-poison bit as extra argument.

    declare i32 @llvm.abs.i32(i32 <src>, i1 <is_int_min_poison>)

Reviewed By: bixia

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

23 months ago[llvm] Fix assertion when stat fails in remove_directories
Ben Langmuir [Fri, 12 Aug 2022 17:16:56 +0000 (10:16 -0700)]
[llvm] Fix assertion when stat fails in remove_directories

We were dereferencing an empty Optional if IgnoreErrors was true and the
stat failed.

rdar://60887887

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

23 months ago[Inlining] Introduce the function attribute "inline-max-stacksize"
Wolfgang Pieb [Fri, 15 Jul 2022 20:19:21 +0000 (13:19 -0700)]
[Inlining] Introduce the function attribute "inline-max-stacksize"

The value of the attribute is a size in bytes. It has the effect of
suppressing inlining of functions whose stacksizes exceed the given value.

Reviewed By: mtrofin

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

23 months ago[mlir][shape] Add dim op
Jacques Pienaar [Fri, 12 Aug 2022 18:02:07 +0000 (11:02 -0700)]
[mlir][shape] Add dim op

Convenience op that allows for simple expression of common crossing of
value/shape divide.

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

23 months ago[clangd][unittests][IncludeCleaner] Don't call findReferencedFiles() if the result...
Aleksandr Platonov [Fri, 12 Aug 2022 17:59:49 +0000 (20:59 +0300)]
[clangd][unittests][IncludeCleaner] Don't call findReferencedFiles() if the result is not used

IncludeCleaner.RecursiveInclusion and IncludeCleaner.IWYUPragmaExport tests don't check referenced files list, so we don't need to call findReferencedFiles() there.

Reviewed By: kbobyrev

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

23 months ago[libunwind] Remove __ANDROID_API__ < 18 workaround
Fangrui Song [Fri, 12 Aug 2022 17:46:46 +0000 (10:46 -0700)]
[libunwind] Remove __ANDROID_API__ < 18 workaround

https://github.com/android/ndk/wiki/Changelog-r24 shows that the NDK has
moved forward to at least a minimum target API of 19. Remove old workaround.

Reviewed By: #libunwind, danalbert

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

23 months ago[llvm-reduce] Try harder to not create invalid aliases
Arthur Eubanks [Tue, 9 Aug 2022 00:02:44 +0000 (17:02 -0700)]
[llvm-reduce] Try harder to not create invalid aliases

This was done by adding --abort-on-invalid-reduction to remove-function-bodies-used-in-globals.ll and fixing the fallout.

Aliases must have a GlobalValue or ConstantExpr aliasee and the aliasee must be a definition if it's a GlobalValue.
Don't RAUW functions with null if there's an alias pointing to it, and similarly don't delete the body of a function.
Don't delete the entire body of a function when reducing blocks, preserve at least one block.

Also make debugging these sorts of things easier by dumping the module when --abort-on-invalid-reduction triggers.

Reviewed By: regehr

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

23 months ago[llvm-reduce] Add delta pass to run IR passes
Arthur Eubanks [Thu, 14 Apr 2022 00:36:58 +0000 (17:36 -0700)]
[llvm-reduce] Add delta pass to run IR passes

The exact IR passes run is customizable via `-ir-passes`.

Reviewed By: regehr

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

23 months ago[libc] Pack memory functions in the integration test libc.a files.
Siva Chandra Reddy [Fri, 12 Aug 2022 05:23:24 +0000 (05:23 +0000)]
[libc] Pack memory functions in the integration test libc.a files.

Reviewed By: michaelrj

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

23 months ago[lldb] Skip target variable tests on Darwin because of chained fixups
Jonas Devlieghere [Fri, 12 Aug 2022 17:06:21 +0000 (10:06 -0700)]
[lldb] Skip target variable tests on Darwin because of chained fixups

When targeting macOS Ventura, ld64 will use authenticated fixups for
x86_64 as well as arm64 (where that has always been the case). This
results in test failures when using an Xcode 14 toolchain on an Intel
mac running macOS Ventura:

  Failed Tests (3):
    lldb-api :: commands/target/basic/TestTargetCommand.py
    lldb-api :: lang/c/global_variables/TestGlobalVariables.py
    lldb-api :: lang/cpp/char8_t/TestCxxChar8_t.py

Rather than trying to come up with a sophisticated decorator based off
the deployment target, I marked them all as skipped with a comment
explaining why.

Differential revision: https://reviews.llvm.org/D131741

23 months ago[SampleProfile] Fix non-determinism in promoteMergeNotInlinedContextSamples()
Arthur Eubanks [Wed, 10 Aug 2022 16:30:30 +0000 (09:30 -0700)]
[SampleProfile] Fix non-determinism in promoteMergeNotInlinedContextSamples()

We're seeing non-determinism with loading sample profiles. It seems to
be related to the order in which we merge FunctionSamples in
promoteMergeNotInlinedContextSamples(). Use a MapVector to iterate over
NonInlinedCallSites in the order entries were inserted.

Reviewed By: wenlei, davidxl

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

23 months agoUpdate license on Unicode.org's ConvertUTF code.
James Y Knight [Fri, 12 Aug 2022 16:36:43 +0000 (16:36 +0000)]
Update license on Unicode.org's ConvertUTF code.

The code was relicensed by its owner (Unicode.org) a long time back,
but we still had the old (problematic) license in our fork.

Note that the source files have not been distributed from unicode.org
since 2009 (due to being buggy and unmaintained upstream), but they
were given this license before that.

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

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

23 months ago[clang][dataflow] Encode options using llvm::Optional
Sam Estep [Fri, 12 Aug 2022 16:29:28 +0000 (16:29 +0000)]
[clang][dataflow] Encode options using llvm::Optional

This patch restructures `DataflowAnalysisOptions` and `TransferOptions` to use `llvm::Optional`, in preparation for adding more sub-options to the `ContextSensitiveOptions` struct introduced here.

Reviewed By: sgatev, xazax.hun

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

23 months ago[mlir][math] Fix lowering of AbsIOp
Jeff Niu [Fri, 12 Aug 2022 15:30:55 +0000 (11:30 -0400)]
[mlir][math] Fix lowering of AbsIOp

The LLVM intrinsic has a bool flag `is_int_min_poison` that needs to be
set.

Reviewed By: aartbik

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

23 months ago[clang] fix frontend crash when evaluating type trait
YingChi Long [Thu, 11 Aug 2022 18:14:09 +0000 (02:14 +0800)]
[clang] fix frontend crash when evaluating type trait

Before this patch type traits are checked in Parser, so use type traits
directly did not cause assertion faults. However if type traits are initialized
from a template, we didn't perform arity checks before evaluating. This
patch moves arity checks from Parser to Sema, and performing arity
checks in Sema actions, so type traits get checked corretly.

Crash input:

```
template<class... Ts> bool b = __is_constructible(Ts...);
bool x = b<>;
```

After this patch:

```
clang/test/SemaCXX/type-trait-eval-crash-issue-57008.cpp:5:32: error: type trait requires 1 or more arguments; have 0 arguments
template<class... Ts> bool b = __is_constructible(Ts...);
                               ^~~~~~~~~~~~~~~~~~
clang/test/SemaCXX/type-trait-eval-crash-issue-57008.cpp:6:10: note: in instantiation of variable template specialization 'b<>' requested here
bool x = b<>;
         ^
1 error generated.
```

See https://godbolt.org/z/q39W78hsK.

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

Reviewed By: aaron.ballman

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

23 months ago[mlir] fix crossed transform dialect patches
Alex Zinenko [Fri, 12 Aug 2022 15:47:23 +0000 (15:47 +0000)]
[mlir] fix crossed transform dialect patches

One patch added a use of the IR syntax that was changed by another.

23 months ago[MSAN] Separate id ptr from constant string for variable names used in track origins.
Kevin Athey [Thu, 11 Aug 2022 07:23:15 +0000 (00:23 -0700)]
[MSAN] Separate id ptr from constant string for variable names used in track origins.

The goal is to reduce the size of the MSAN with track origins binary, by making
the variable name locations constant which will allow the linker to compress
them.

Follows: https://reviews.llvm.org/D131415

Reviewed By: vitalybuka

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

23 months ago[CostModel] Add bfloat and fp128 reduction tests
Vir Narula [Fri, 12 Aug 2022 15:44:04 +0000 (16:44 +0100)]
[CostModel] Add bfloat and fp128 reduction tests

Reviewed By: fhahn

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

23 months ago[mlir][transform] failure propagation mode in sequence
Alex Zinenko [Fri, 12 Aug 2022 13:53:46 +0000 (13:53 +0000)]
[mlir][transform] failure propagation mode in sequence

Introduce two different failure propagation mode in the Transform
dialect's Sequence operation. These modes specify whether silenceable
errors produced by nested ops are immediately propagated, thus stopping
the sequence, or suppressed. The latter is useful in end-to-end
transform application scenarios where the user cannot correct the
transformation, but it is robust enough to silenceable failures. It
can be combined with the "alternatives" operation. There is
intentionally no default value to avoid favoring one mode over the
other.

Downstreams can update their tests using:

  S='s/sequence \(%.*\) {/sequence \1 failures(propagate) {/'
  T='s/sequence {/sequence failures(propagate) {/'
  git grep -l transform.sequence | xargs sed -i -e "$S"
  git grep -l transform.sequence | xargs sed -i -e "$T"

Reviewed By: nicolasvasilache

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

23 months ago[lld-macho] Ensure cached objects are affected by `-object_path_lto`
Leonard Grey [Wed, 10 Aug 2022 21:44:27 +0000 (17:44 -0400)]
[lld-macho] Ensure cached objects are affected by `-object_path_lto`

This refactors LTO compile to look more like COFF, where cache hits and misses are all funneled through the same code path.

Previously, cache hits were *not* being saved to -object_path_lto, which led to them sometimes falling out of the cache before dsymutil could process them. As a side effect of the refactor, cached objects are now saved with -save-temps as well, which seems desirable.

(Deleted lld/test/MachO/lto-cache-dsymutil.ll and rolled it into lld/test/MachO/lto-object-path.ll, since the cache-only, non object path approach is unreliable anyway).

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

23 months ago[Sema] Always perform ADL when searching for transormed operators in C++20
Ilya Biryukov [Fri, 12 Aug 2022 13:51:44 +0000 (15:51 +0200)]
[Sema] Always perform ADL when searching for transormed operators in C++20

This fixes compilation errors in the following code with
latest libc++ and libstdc++:
```cpp

int main() {
  std::tuple<std::string> s;
  std::tuple<std::string_view> sv;
  s < sv;
}
```

See https://gcc.godbolt.org/z/vGvEhxWvh for the error.

This used to happen because repeated template instantiations during
C++20 constraint satisfaction will cause a call to `RebuildCXXRewrittenBinaryOperator`
with `PerformADL` set to false, see https://github.com/llvm/llvm-project/blob/59351fe340f20a605bae53260ed30a8e0fd95cb6/clang/lib/Sema/TreeTransform.h#L2737

Committing urgently to unbreak breakages we see in our configurations.
The change seems relatively safe and the right thing to do.

However, I will follow-up with tests and investigation on whether we
need to do this extra semantic checking in the first place next week.

23 months agoSPIRV: Fix compilation in NDEBUG.
James Y Knight [Thu, 11 Aug 2022 22:41:22 +0000 (22:41 +0000)]
SPIRV: Fix compilation in NDEBUG.

23 months ago[libc] Add missing header and Windows entrypoints for tanf.
Tue Ly [Fri, 12 Aug 2022 13:33:44 +0000 (09:33 -0400)]
[libc] Add missing header and Windows entrypoints for tanf.

23 months ago[NFC] Introduce llvm::to_vector_of to allow creation of SmallVector<T> from range...
Dawid Jurczak [Fri, 12 Aug 2022 13:19:31 +0000 (15:19 +0200)]
[NFC] Introduce llvm::to_vector_of to allow creation of SmallVector<T> from range of items convertible to type T

It's https://reviews.llvm.org/D129565 follow-up.

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

23 months ago[libc] Implement tanf function correctly rounded for all rounding modes.
Tue Ly [Thu, 11 Aug 2022 20:28:16 +0000 (16:28 -0400)]
[libc] Implement tanf function correctly rounded for all rounding modes.

Implement tanf function correctly rounded for all rounding modes.

We use the range reduction that is shared with `sinf`, `cosf`, and `sincosf`:
```
  k = round(x * 32/pi) and y = x * (32/pi) - k.
```
Then we use the tangent of sum formula:
```
  tan(x) = tan((k + y)* pi/32) = tan((k mod 32) * pi / 32 + y * pi/32)
         = (tan((k mod 32) * pi/32) + tan(y * pi/32)) / (1 - tan((k mod 32) * pi/32) * tan(y * pi/32))
```
We need to make a further reduction when `k mod 32 >= 16` due to the pole at `pi/2` of `tan(x)` function:
```
  if (k mod 32 >= 16): k = k - 31, y = y - 1.0
```
And to compute the final result, we store `tan(k * pi/32)` for `k = -15..15` in a table of 32 double values,
and evaluate `tan(y * pi/32)` with a degree-11 minimax odd polynomial generated by Sollya with:
```
>  P = fpminimax(tan(y * pi/32)/y, [|0, 2, 4, 6, 8, 10|], [|D...|], [0, 1.5]);
```

Performance benchmark using `perf` tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf
CORE-MATH reciprocal throughput   : 18.586
System LIBC reciprocal throughput : 50.068

LIBC reciprocal throughput        : 33.823
LIBC reciprocal throughput        : 25.161     (with `-msse4.2` flag)
LIBC reciprocal throughput        : 19.157     (with `-mfma` flag)

$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf --latency
GNU libc version: 2.31
GNU libc release: stable
CORE-MATH latency   : 55.630
System LIBC latency : 106.264

LIBC latency        : 96.060
LIBC latency        : 90.727    (with `-msse4.2` flag)
LIBC latency        : 82.361    (with `-mfma` flag)
```

Reviewed By: orex

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

23 months ago[ADT] Replace STLForwardCompat.h's C++17 equivalents
Joe Loser [Thu, 11 Aug 2022 20:29:46 +0000 (14:29 -0600)]
[ADT] Replace STLForwardCompat.h's C++17 equivalents

STLForwardCompat.h defines several utilities and type traits to mimic that of
the ones in the C++17 standard library. Now that LLVM is built with the C++17
standards mode, remove use of these equivalents in favor of the ones from the
standard library.

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

23 months ago[mlir][linalg][transform] Support matching of attributes (and their values)
Matthias Springer [Fri, 12 Aug 2022 12:48:29 +0000 (14:48 +0200)]
[mlir][linalg][transform] Support matching of attributes (and their values)

Do not just check if an attribute exists on the payload op. Also check its value.

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

23 months ago[bazel] Port 3e119c0efdde7bc3e0f8875f784e31d74ac0ca89
Benjamin Kramer [Fri, 12 Aug 2022 12:52:49 +0000 (14:52 +0200)]
[bazel] Port 3e119c0efdde7bc3e0f8875f784e31d74ac0ca89

23 months ago[clangd] Fix an inlay-hint crash on a broken designator.
Haojian Wu [Thu, 11 Aug 2022 17:26:14 +0000 (19:26 +0200)]
[clangd] Fix an inlay-hint crash on a broken designator.

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

23 months ago[clang][SVE] Undefine preprocessor macro defined in
Maciej Gabka [Fri, 12 Aug 2022 11:24:12 +0000 (11:24 +0000)]
[clang][SVE] Undefine preprocessor macro defined in

arm_sve.h defines and uses __ai macro which needs to be undefined (as it is
already in arm_neon.h).

Reviewed By: paulwalker-arm

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

23 months ago[gn build] port 3e119c0efdde (split-file move to utils/)
Nico Weber [Thu, 11 Aug 2022 22:48:59 +0000 (18:48 -0400)]
[gn build] port 3e119c0efdde (split-file move to utils/)

23 months ago[lld/mac] Add missing `_eq` suffix on two (internal) option names
Nico Weber [Fri, 12 Aug 2022 12:06:50 +0000 (08:06 -0400)]
[lld/mac] Add missing `_eq` suffix on two (internal) option names

No behavior change.

23 months agoMissing climits header file in MemRefUtils.h
Jinyun Joey Ye [Fri, 12 Aug 2022 12:16:45 +0000 (14:16 +0200)]
Missing climits header file in MemRefUtils.h

MemRefUtils.h uses UINT_MAX, which is not included in current header files list. This patch include climits to avoid compilation error in this header file.

Reviewed By: ftynse

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

23 months ago[llvm][CMake] Move `split-file` from tools to utils
Markus Böck [Fri, 12 Aug 2022 12:16:29 +0000 (14:16 +0200)]
[llvm][CMake] Move `split-file` from tools to utils

It fittingly already makes use of add_llvm_utility during target creation and is usually only used in conjunction with other (test) related utilities such as FileCheck and not, which are already in utils.

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

23 months ago[gn build] port 74384c7fcec7
Nico Weber [Fri, 12 Aug 2022 12:10:16 +0000 (08:10 -0400)]
[gn build] port 74384c7fcec7

23 months ago[pseudo] Apply the function-declarator to member functions.
Haojian Wu [Wed, 10 Aug 2022 13:41:36 +0000 (15:41 +0200)]
[pseudo] Apply the function-declarator to member functions.

A followup patch of d489b3807f096584175c321ce7f20e9dcd49b1da, but for
member functions, this will eliminate a false parse of member
declaration.

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

23 months ago[pseudo] Eliminate an ambiguity for the empty member declaration.
Haojian Wu [Thu, 11 Aug 2022 21:09:27 +0000 (23:09 +0200)]
[pseudo] Eliminate an ambiguity for the empty member declaration.

We happened to introduce a `member-declaration := ;` rule
when inlining the `member-declaration := decl-specifier-seq_opt
member-declarator-list_opt ;`.
And with the `member-declaration := empty-declaration` rule, we had two parses of `;`.

This patch is to restrict the grammar to eliminate the
`member-declaration := ;` rule.

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

23 months ago[flang][OpenMP] Lowering support for default clause
Nimish Mishra [Fri, 12 Aug 2022 11:16:26 +0000 (16:46 +0530)]
[flang][OpenMP] Lowering support for default clause

This patch adds lowering support for default clause.

1. During symbol resolution in semantics, should the enclosing context
   have a default data sharing clause defined and a `parser::Name` is not
   attached to an explicit data sharing clause, the
   `semantics::Symbol::Flag::OmpPrivate` flag (in case of
   default(private)) and `semantics::Symbol::Flag::OmpFirstprivate` flag
   (in case of default(firstprivate)) is added to the symbol.

2. During lowering, all symbols having either
   `semantics::Symbol::Flag::OmpPrivate` or
   `semantics::Symbol::Flag::OmpFirstprivate` flag are collected and
   privatised appropriately.

Co-authored-by: Peixin Qiao <qiaopeixin@huawei.com>
Reviewed by: peixin

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

23 months agoRevert "[flang][OpenMP] Lowering support for default clause"
Nimish Mishra [Fri, 12 Aug 2022 11:15:38 +0000 (16:45 +0530)]
Revert "[flang][OpenMP] Lowering support for default clause"

This reverts commit 6a305c9b49dd28eaeae694fce5755e279fbc884c.

23 months ago[flang][OpenMP] Lowering support for default clause
Nimish Mishra [Fri, 12 Aug 2022 16:35:43 +0000 (22:05 +0530)]
[flang][OpenMP] Lowering support for default clause

This patch adds lowering support for default clause.

1. During symbol resolution in semantics, should the enclosing context have
a default data sharing clause defined and a `parser::Name` is not attached
to an explicit data sharing clause, the
`semantics::Symbol::Flag::OmpPrivate` flag (in case of default(private))
and `semantics::Symbol::Flag::OmpFirstprivate` flag (in case of
default(firstprivate)) is added to the symbol.

2. During lowering, all symbols having either
`semantics::Symbol::Flag::OmpPrivate` or
`semantics::Symbol::Flag::OmpFirstprivate` flag are collected and
privatised appropriately.

Co-authored-by: Peixin Qiao <qiaopeixin@huawei.com>
Reviewed by: peixin

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

23 months ago[libc++][test] Mark `test_comparisons.h` helpers as nodiscard
Adrian Vogelsgesang [Sun, 7 Aug 2022 17:29:32 +0000 (10:29 -0700)]
[libc++][test] Mark `test_comparisons.h` helpers as nodiscard

I accidentally wrote `testComparisons(...)` instead of
`assert(testComparisons(...))`. This compiled without issues, but
did not provide the intended test coverage. By adding a `nodiscard`,
we can make sure that the compiler catches such mistakes for us.

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

23 months agoHandle explicitly defaulted consteval special members.
Utkarsh Saxena [Tue, 9 Aug 2022 10:05:26 +0000 (12:05 +0200)]
Handle explicitly defaulted consteval special members.

Followup patch for D128083

Previously, using a non-consteval constructor from an consteval constructor would code generates the consteval constructor.
Example
```
template <typename T>
struct S {
  T i;
  consteval S() = default;
};
struct Foo {
    Foo() {}
};
void func() {
  S<Foo> three; // incorrectly accepted by clang.
}
```

This happened because clang erroneously disregards `consteval` specifier for a `consteval explicitly defaulted special member functions in a class template` if it has dependent data members without a `consteval default constructor`.

According to
```
C++14 [dcl.constexpr]p6 (CWG DR647/CWG DR1358):
If the instantiated template specialization of a constexpr function
template or member function of a class template would fail to satisfy
the requirements for a constexpr function or constexpr constructor, that
specialization is still a constexpr function or constexpr constructor,
even though a call to such a function cannot appear in a constant
expression.
```

Therefore the `consteval defaulted constructor of a class template` should be considered `consteval` even if the data members' default constructors are not consteval.
Keeping this constructor `consteval` allows complaining while processing the call to data member constructors.
(Same applies for other special member functions).

This works fine even when we have more than one default constructors since we process the constructors after the templates are instantiated.

This does not address initialization issues raised in
[2602](https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2602) and compiler divergence seen in https://godbolt.org/z/va9EMvvMe

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

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

23 months ago[DAG] Add TODO to remove creation of INSERT_SUBVECTOR nodes from SimplifyMultipleUseD...
Simon Pilgrim [Fri, 12 Aug 2022 09:45:21 +0000 (10:45 +0100)]
[DAG] Add TODO to remove creation of INSERT_SUBVECTOR nodes from SimplifyMultipleUseDemandedBits

SimplifyMultipleUseDemandedBits shouldn't be creating general nodes like this - although we allow bitcasts, even general constant folding is avoided.

Removing it causes a number of regressions that need addressing first, but I've added a TODO for now.

23 months ago[DAGCombine] Hoist shifts out of a logic operations tree.
Filipp Zhinkin [Thu, 4 Aug 2022 18:34:15 +0000 (21:34 +0300)]
[DAGCombine] Hoist shifts out of a logic operations tree.

Hoist and combine shift operations from logic operations tree:
logic (logic (SH x0, s), y), (logic (SH x1, s), z)  --> logic (SH (logic x0, x1), s), (logic y, z)

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

Correctness:
https://alive2.llvm.org/ce/z/pVqVgY
https://alive2.llvm.org/ce/z/YVvT-q
https://alive2.llvm.org/ce/z/W5zTBq
https://alive2.llvm.org/ce/z/YfJsvJ
https://alive2.llvm.org/ce/z/3YSyDM
https://alive2.llvm.org/ce/z/Bs2kzk
https://alive2.llvm.org/ce/z/EoQpzU
https://alive2.llvm.org/ce/z/Jnc_5H
https://alive2.llvm.org/ce/z/_LP6k_
https://alive2.llvm.org/ce/z/KvZNC9

Reviewed By: spatel

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

23 months ago[mlir][Linalg] Let FuseIntoContainingOp return success when nothing is fused.
Nicolas Vasilache [Thu, 11 Aug 2022 22:35:13 +0000 (15:35 -0700)]
[mlir][Linalg] Let FuseIntoContainingOp return success when nothing is fused.

This composes better when the op is applied in situations where it does not match.

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

23 months ago[lldb] [gdb-remote] Remove unimplemented ProcessIDIsValid() (NFC)
Michał Górny [Fri, 12 Aug 2022 09:17:15 +0000 (11:17 +0200)]
[lldb] [gdb-remote] Remove unimplemented ProcessIDIsValid() (NFC)

This method is not implemented and not referenced anywhere in the code.

Sponsored by: The FreeBSD Foundation

23 months ago[mlir][bufferize] Fix missing copy when bufferizing loops
Matthias Springer [Fri, 12 Aug 2022 08:43:22 +0000 (10:43 +0200)]
[mlir][bufferize] Fix missing copy when bufferizing loops

Using a loop init_arg inside of the loop is not supported. This change adds a pre-processing pass that resolves such IR with copies.

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

23 months ago[mlir][emitc][nfc] Clean up tests
Marius Brehler [Fri, 12 Aug 2022 08:21:21 +0000 (08:21 +0000)]
[mlir][emitc][nfc] Clean up tests

With https://reviews.llvm.org/D131666 the types were removed from the
EmitC opaque attributes. This cleans up the tests accordingly.

23 months agoRevert "[mlir] Switch segment size attributes to DenseI32ArrayAttr"
Alex Zinenko [Fri, 12 Aug 2022 08:17:48 +0000 (10:17 +0200)]
Revert "[mlir] Switch segment size attributes to DenseI32ArrayAttr"

This reverts commit 30171e76f0e5ea8037bc4d1450dd3e12af4d9938.

Breaks Python tests in MLIR, missing C API and Python changes.

23 months ago[doc] Remove release notes from the main branch for changes that were backported...
Martin Storsjö [Fri, 12 Aug 2022 08:21:51 +0000 (11:21 +0300)]
[doc] Remove release notes from the main branch for changes that were backported to 15.x

23 months ago[clang-tidy] Support C++14 in bugprone-signal-handler.
Balázs Kéri [Wed, 10 Aug 2022 09:07:38 +0000 (11:07 +0200)]
[clang-tidy] Support C++14 in bugprone-signal-handler.

Check `bugprone-signal-handler` is improved to check for
C++-specific constructs in signal handlers. This check is
valid until C++17.

Reviewed By: whisperity

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

23 months ago[NFC] Split test to reduce time to run.
Daniil Fukalov [Mon, 1 Aug 2022 18:02:11 +0000 (21:02 +0300)]
[NFC] Split test to reduce time to run.

The `RUN:` line with `--debug` used just two function. Moved this test out to
different file.

Reviewed By: vangthao

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

23 months ago[SCEV] Prove condition invariance via context
Max Kazantsev [Fri, 12 Aug 2022 06:27:01 +0000 (13:27 +0700)]
[SCEV] Prove condition invariance via context

Contextual knowledge may be used to prove invariance of some conditions.
For example, in this case:
```
  ; %len >= 0
  guard(%iv = {start,+,1}<nuw> <s %len)
  guard(%iv = {start,+,1}<nuw> <u %len)
```
the 2nd check always fails if `start` is negative and always passes otherwise.

It looks like there are more opportunities of this kind that are still to be
implemented in the future.

Differential Revision: https://reviews.llvm.org/D129753
Reviewed By: apilipenko

23 months ago[mlir][EmitC] Remove the type from the OpaqueAttr
Marius Brehler [Thu, 11 Aug 2022 10:38:31 +0000 (10:38 +0000)]
[mlir][EmitC] Remove the type from the OpaqueAttr

This removes the type from EmitC's opaque attribute. The value provided
as a StringRefParameter can always be emitted as is. In consquence the
constant and variable ops explicitly need to opaque attributes which are
no longer typed attributes.

Co-authored-by: Simon Camphausen <simon.camphausen@iml.fraunhofer.de>
Reviewed By: Mogball, jpienaar

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

23 months ago[PowerPC] Fix test case changed by "Add XXEVAL TD pattern" [NFC]
Ting Wang [Fri, 12 Aug 2022 06:56:54 +0000 (02:56 -0400)]
[PowerPC] Fix test case changed by "Add XXEVAL TD pattern" [NFC]

23 months ago[LegalizeTypes][NFC] Use getConstantOperandVal instead of cast constant getvalue
wanglian [Thu, 11 Aug 2022 03:25:35 +0000 (11:25 +0800)]
[LegalizeTypes][NFC] Use getConstantOperandVal instead of cast constant getvalue

Reviewed By: craig.topper

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

23 months ago[LegalizeTypes][NFC] Use dyn_cast instead of isa and cast
wanglian [Thu, 11 Aug 2022 02:41:58 +0000 (10:41 +0800)]
[LegalizeTypes][NFC] Use dyn_cast instead of isa and cast

Reviewed By: craig.topper

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

23 months ago[LoongArch] Add codegen support for ISD::CTPOP, ISD::CTTZ and ISD::CTLZ
gonglingqin [Fri, 12 Aug 2022 05:06:11 +0000 (13:06 +0800)]
[LoongArch] Add codegen support for ISD::CTPOP, ISD::CTTZ and ISD::CTLZ

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

23 months ago[MCDwarf][test] Improve debug-prefix-map.s
Fangrui Song [Fri, 12 Aug 2022 05:40:30 +0000 (22:40 -0700)]
[MCDwarf][test] Improve debug-prefix-map.s

23 months ago[lldb/Symbol] Fix null-deref in TypeList::Dump
Med Ismail Bennani [Fri, 12 Aug 2022 00:54:41 +0000 (17:54 -0700)]
[lldb/Symbol] Fix null-deref in TypeList::Dump

This patch should just a crash caused by a null pointer dereferencing
when dumping a type. It makes sure that the pointer is valid.

rdar://97455134

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/crashlog] Improve exception reporting for interactive mode
Med Ismail Bennani [Fri, 12 Aug 2022 05:26:36 +0000 (22:26 -0700)]
[lldb/crashlog] Improve exception reporting for interactive mode

This patch improve exception reporting when loading a crash report in a
scripted process. Now, we parse the `exception` dictionary from the
crash report use it the create a higher fidelity `MachException` stop info.

This patch also updates the test to reflect that change.

rdar://97096486

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/test] Fix interactive crashlog test failure (NFC)
Med Ismail Bennani [Fri, 12 Aug 2022 00:11:19 +0000 (17:11 -0700)]
[lldb/test] Fix interactive crashlog test failure (NFC)

This patch removes the system library names and mangled symbol from
the expected output for the interactive crashlog tests.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/crashlog] Adapt raw text crashlog exception to json format
Med Ismail Bennani [Fri, 12 Aug 2022 01:07:20 +0000 (18:07 -0700)]
[lldb/crashlog] Adapt raw text crashlog exception to json format

This patch parses CrashLog exception data from the raw
text format and adapts it to the new JSON format.

This is necessary for feature parity between the 2 formats.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[libc] Add implemementations of thread specific data related API.
Siva Chandra Reddy [Tue, 9 Aug 2022 20:40:53 +0000 (20:40 +0000)]
[libc] Add implemementations of thread specific data related API.

Specifically, POSIX functions pthread_key_create, pthread_key_delete,
pthread_setspecific and pthread_getspecific have been added. The C
standard equivalents tss_create, tss_delete, tss_set and tss_get have
also been added.

Reviewed By: lntue, michaelrj

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

23 months ago[PowerPC] Add XXEVAL TD pattern
Ting Wang [Fri, 12 Aug 2022 05:27:24 +0000 (01:27 -0400)]
[PowerPC] Add XXEVAL TD pattern

Add xxeval TD pattern for P10 on: eqv, nor, or, xor.

Reviewed By: shchenz

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

23 months ago[MCDwarf] Use emplace to avoid move assignment. NFC
Fangrui Song [Fri, 12 Aug 2022 05:05:49 +0000 (05:05 +0000)]
[MCDwarf] Use emplace to avoid move assignment. NFC

23 months ago[Coroutines] Maintain the position of final suspend
Chuanqi Xu [Fri, 12 Aug 2022 03:44:26 +0000 (11:44 +0800)]
[Coroutines] Maintain the position of final suspend

Closing https://github.com/llvm/llvm-project/issues/56329

The problem happens when we try to simplify the suspend points. We might
break the assumption that the final suspend lives in the last slot of
Shape.CoroSuspends. This patch tries to main the assumption and fixes
the problem.

23 months ago[PowerPC] omit location attribute for TLS variable on AIX
Chen Zheng [Thu, 21 Jul 2022 10:22:50 +0000 (06:22 -0400)]
[PowerPC] omit location attribute for TLS variable on AIX

TLS debug on AIX is not ready for now.
The location generated in no-integrated-as mode is wrong and
in integrated-as mode causes AIX linker error.

Reviewed By: Esme

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

23 months ago[LLDB][NFC] Reliability fixes for IOHandlerCursesGUI
Slava Gurevich [Wed, 10 Aug 2022 20:04:26 +0000 (13:04 -0700)]
[LLDB][NFC] Reliability fixes for IOHandlerCursesGUI

- checking retval of function calls
- dead code removal
- null dereference fix

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

23 months ago[LoongArch] Return null SDValue by default in LowerOperation. NFC
Weining Lu [Fri, 12 Aug 2022 03:53:04 +0000 (11:53 +0800)]
[LoongArch] Return null SDValue by default in LowerOperation. NFC

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

23 months ago[LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp (part 2)
Slava Gurevich [Thu, 11 Aug 2022 07:11:35 +0000 (00:11 -0700)]
[LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp (part 2)

Add the fixes suggested post-push in D131554

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

23 months agoDisable update_cc_test_checks.py tests in stand-alone builds
Tom Stellard [Fri, 12 Aug 2022 03:53:34 +0000 (20:53 -0700)]
Disable update_cc_test_checks.py tests in stand-alone builds

The script is located in the llvm/ sub-directory, so it is not available
for when doing a stand-alone build.

See https://discourse.llvm.org/t/rfc-stand-alone-build-support/61291

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

23 months ago[AST] [Modules] Introduce Decl::getNonTransparentDeclContext to handle exported friends
Chuanqi Xu [Thu, 11 Aug 2022 06:08:14 +0000 (14:08 +0800)]
[AST] [Modules] Introduce Decl::getNonTransparentDeclContext to handle exported friends

Closing https://github.com/llvm/llvm-project/issues/56826.

The root cause for pr56826 is: when we collect the template args for the
friend, we need to judge if the friend lives in file context. However,
if the friend lives in ExportDecl lexically, the judgement here is
invalid.

The solution is easy. We should judge the non transparent context and
the ExportDecl is transparent context. So the solution should be good.

A main concern may be the patch doesn't handle all the places of the
same defect. I think it might not be bad since the patch itself should
be innocent.

Reviewed By: erichkeane

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

23 months ago[MSAN] remove unused debugging statements (NFC)
Kevin Athey [Fri, 12 Aug 2022 03:19:58 +0000 (20:19 -0700)]
[MSAN] remove unused debugging statements (NFC)

Reviewed By: vitalybuka

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

23 months ago[libcxx] [test] Fix max_size.pass.cpp for PowerPC targets
Amy Kwan [Thu, 11 Aug 2022 20:53:43 +0000 (15:53 -0500)]
[libcxx] [test] Fix max_size.pass.cpp for PowerPC targets

This patch fixes the max_size.pass.cpp test for PowerPC targets, depending on
endianness.

We will exhibit the full_size() behaviour for little endian
(where __endian_factor = 2 ), and the half_size() behaviour for
big endian (where __endian_factor = 1).

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

23 months ago[LegalizeTypes][NFC] Use getConstantOperandAPInt instead of cast constant getAPInt
wanglian [Fri, 12 Aug 2022 02:08:08 +0000 (10:08 +0800)]
[LegalizeTypes][NFC] Use getConstantOperandAPInt instead of cast constant getAPInt

Reviewed By: RKSimon

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

23 months ago[lldb] Remove unused "import unittest2" statements
Dave Lee [Sun, 7 Aug 2022 18:37:56 +0000 (12:37 -0600)]
[lldb] Remove unused "import unittest2" statements

23 months ago[lldb] Remove uses of six module (NFC)
Dave Lee [Fri, 5 Aug 2022 19:35:20 +0000 (13:35 -0600)]
[lldb] Remove uses of six module (NFC)

With lldb (& llvm) requiring Python 3.6+, use of the `six` module can be removed.

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

23 months ago[LLDB][NFC] Fix the style issue in TCPSocket
Slava Gurevich [Wed, 10 Aug 2022 05:55:27 +0000 (22:55 -0700)]
[LLDB][NFC] Fix the style issue in TCPSocket

Style fixes for the entire file

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

23 months ago[mlir] Switch segment size attributes to DenseI32ArrayAttr
Jeff Niu [Thu, 11 Aug 2022 07:01:35 +0000 (03:01 -0400)]
[mlir] Switch segment size attributes to DenseI32ArrayAttr

Switch variadic operand and result segment size attributes to use the
dense i32 array. Dense integer arrays were introduced primarily to
represent index lists. They are a better fit for segment sizes than
dense elements attrs.

Depends on D131738

Reviewed By: mehdi_amini

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

23 months ago[mlir] Change the syntax of dense arrays
Jeff Niu [Thu, 11 Aug 2022 23:05:48 +0000 (19:05 -0400)]
[mlir] Change the syntax of dense arrays

Follow-up to D123774, where the syntax of dense arrays was discussed. It
was included that the syntax should be changed to `array<i32: 1, 2>`.
This patch changes the syntax but importantly preserves the `[1, 2]`
syntax when embedding these attributes in assembly formats through ODS.

Reviewed By: mehdi_amini, jpienaar

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

23 months ago[libc] move int conversion out of base template
Michael Jones [Thu, 11 Aug 2022 21:16:00 +0000 (14:16 -0700)]
[libc] move int conversion out of base template

The convert_alpha_numeric function is intentionally non-templated so
that its code can be reused for different bases in code-size sensitive
cases. Previously it was inside the IntegerToString class which created
a different version for each base.

Reviewed By: sivachandra, lntue

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

23 months ago[lldb] Fix output for unconditionally decorated tests
Jonas Devlieghere [Thu, 11 Aug 2022 23:14:05 +0000 (16:14 -0700)]
[lldb] Fix output for unconditionally decorated tests

A missing call to `format` resulted in curly braces getting printed in
the reason a test was modified by a decorator. For example it would
print "{} unconditionally" instead of "skipping unconditionally" for
tests that were marked as such.

23 months ago[clang] SIGSEGV fix at clang::ASTContext::getRawCommentForDeclNoCacheImpl
Ivan Murashko [Thu, 11 Aug 2022 23:04:23 +0000 (00:04 +0100)]
[clang] SIGSEGV fix at clang::ASTContext::getRawCommentForDeclNoCacheImpl

The `File` might point to an invalid `FileID` when the AST is broken. That leads to clang/clangd crashes while processing comments. The relevant part of the crash is below
```
 #4 0x00007f1d7fbf95bc std::_Rb_tree<unsigned int, std::pair<unsigned int const, clang::RawComment*>, std::_Select1st<std::pair<unsigned int const, clang::RawComment*>>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const
, clang::RawComment*>>>::_M_lower_bound(std::_Rb_tree_node<std::pair<unsigned int const, clang::RawComment*>> const*, std::_Rb_tree_node_base const*, unsigned int const&) const /usr/include/c++/8/bits/stl_tree.h:1911:2
 #5 0x00007f1d7fbf95bc std::_Rb_tree<unsigned int, std::pair<unsigned int const, clang::RawComment*>, std::_Select1st<std::pair<unsigned int const, clang::RawComment*>>, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, clang::RawComment*>>>::lower_bound(unsigned int const&) const /usr/include/c++/8/bits/stl_tree.h:1214:56
 #6 0x00007f1d7fbf95bc std::map<unsigned int, clang::RawComment*, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, clang::RawComment*>>>::lower_bound(unsigned int const&) const /usr/include/c++/8/bits/stl_map.h:1264:36
 #7 0x00007f1d7fbf95bc clang::ASTContext::getRawCommentForDeclNoCacheImpl(clang::Decl const*, clang::SourceLocation, std::map<unsigned int, clang::RawComment*, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, clang::RawComment*>>> const&) const /home/ivanmurashko/local/llvm-project/clang/lib/AST/ASTContext.cpp:226:57
```

The corresponding LIT test that reproduces the crash was also added

Same issue is described at https://bugs.llvm.org/show_bug.cgi?id=49707

Reviewed By: gribozavr2

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

23 months ago[mlgo][nfc] regalloc test model generator: prep for TFLite
Mircea Trofin [Thu, 11 Aug 2022 22:52:49 +0000 (15:52 -0700)]
[mlgo][nfc] regalloc test model generator: prep for TFLite

Casting operator to make TFLite happy.

Reviewed By: yundiqian

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

23 months ago[mlir][tosa] Updates tosa.logical_not to use the SameOperandsAndResultType trait
not-jenni [Thu, 11 Aug 2022 21:54:13 +0000 (14:54 -0700)]
[mlir][tosa] Updates tosa.logical_not to use the SameOperandsAndResultType trait

Reviewed By: jpienaar

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

23 months ago[gn build] Make it possible to do PGO-optimized builds
Nico Weber [Thu, 11 Aug 2022 19:09:24 +0000 (15:09 -0400)]
[gn build] Make it possible to do PGO-optimized builds

This is fairly manual for now.

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

23 months ago[NFC] Format ilist_node_options.h to cycle bots
Arthur Eubanks [Thu, 11 Aug 2022 22:38:50 +0000 (15:38 -0700)]
[NFC] Format ilist_node_options.h to cycle bots

23 months ago[RISCV] Use SLTIU X, -1 for (setne X, -1).
Craig Topper [Thu, 11 Aug 2022 22:27:12 +0000 (15:27 -0700)]
[RISCV] Use SLTIU X, -1 for (setne X, -1).

Since -1 is the maximum unsigned value, all values less than it
are not equal to it.

23 months ago[Clang] Fix for Tighten restrictions on enum out of range diagnostic
Shafik Yaghmour [Thu, 11 Aug 2022 22:32:35 +0000 (15:32 -0700)]
[Clang] Fix for Tighten restrictions on enum out of range diagnostic

Ok it looks like this is a bit more subtle, I broke the llvm-test-suite file
paq8p.cpp again. We need both conditions to be true Info.EvalMode ==
EvalInfo::EM_ConstantExpression && Info.InConstantContext. We need to be in a
context that requires a constant value but also in a constant expression context.

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

23 months ago[lldb] Tidy some regex in crashlog.py (NFC)
Dave Lee [Thu, 4 Aug 2022 04:22:40 +0000 (22:22 -0600)]
[lldb] Tidy some regex in crashlog.py (NFC)

A spiritual follow up to D131032. I noticed some regex could be simplified.

This does some of the following:
1. Removes unused capture groups
2. Uses non-capturing `(?:...)` groups where grouping is needed but capturing isn't
3. Removes trailing `.*`
4. Uses `\d` over `[0-9]`
5. Uses raw strings
6. Uses `{N,}` to indicate N-or-more

Also improves the call site of a `re.findall`.

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

23 months ago[llvm] Use hidden visibility when building for MinGW with Clang
Martin Storsjö [Mon, 18 Jul 2022 11:13:05 +0000 (14:13 +0300)]
[llvm] Use hidden visibility when building for MinGW with Clang

Since c5b3de6745c37dd991430b9b88ff97c35b6fc455 (git main,
August 11th), Clang does generate working hidden visibility
on MinGW targets. Using that reduces the number of exports from
a dylib build of LLVM significantly, which is vital for fitting
within the limit of 64k exported symbols from a DLL.

It's essential that if we set CMAKE_CXX_VISIBILITY_PRESET=hidden
(which passes -fvisibility=hidden on the command line), we also
must define LLVM_EXTERNAL_VISIBILITY consistently to override
it. (If there are mismatches, e.g. setting hidden visibility generally
but never overriding it back to default for the symbols that do need
to be exported, we'd get broken builds in such configurations.)

We don't want to be using __attribute__((visibility("hidden"))) on
MinGW with GCC, because GCC produces a warning about it. (GCC hasn't
warned about the command line options that set hidden visibility
though.) Clang has historically not warned about either of them, so
it is harmless to use the hidden visibility when building with older
Clang (so we don't need to detect the exact version of Clang/LLVM where
it has an effect).

This reduces the number of exported symbols for a dylib build of LLVM;
previously libLLVM exported around 64650 symbols (when the maximum is
65536) when the ARM, AArch64 and X86 targets were enabled. If enabling
more targets (or if building with e.g. assertions enabled), it would
exceed the limit. Now with visibility flags in use, the same build
with ARM, AArch64 and X86 ends up at around 35k exported symbols.

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

23 months ago[lldb] Silence a GCC warning about missing returns after a fully covered switch....
Martin Storsjö [Thu, 11 Aug 2022 21:34:21 +0000 (00:34 +0300)]
[lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.

23 months ago[test][msan] Test origin description argument
Vitaly Buka [Thu, 11 Aug 2022 21:10:55 +0000 (14:10 -0700)]
[test][msan] Test origin description argument

Reviewed By: kda

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

23 months ago[msan] Avoid unnecessary PC increment/decrement
Vitaly Buka [Thu, 11 Aug 2022 16:35:44 +0000 (09:35 -0700)]
[msan] Avoid unnecessary PC increment/decrement

Reviewed By: kda

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

23 months ago[RISCV] Add more ineg+setcc isel patterns to avoid creating neg+xori+slti(u).
Craig Topper [Thu, 11 Aug 2022 19:59:04 +0000 (12:59 -0700)]
[RISCV] Add more ineg+setcc isel patterns to avoid creating neg+xori+slti(u).

Including patterns to select addiw if only the lower 32 bits are used.

I'm not excited about adding this many patterns. I'm looking at whether
we can create the xori during lowering and move the ineg patterns to
DAGCombiner.