platform/upstream/llvm.git
15 months agoValueTracking: Handle freeze in computeKnownFPClass
Matt Arsenault [Thu, 13 Apr 2023 13:35:18 +0000 (09:35 -0400)]
ValueTracking: Handle freeze in computeKnownFPClass

15 months ago[test][sanitizer] Add stress test for pthread_create
Vitaly Buka [Fri, 14 Apr 2023 21:28:31 +0000 (14:28 -0700)]
[test][sanitizer] Add stress test for pthread_create

15 months agoValueTracking: Implement computeKnownFPClass for arithmetic.fence
Matt Arsenault [Sun, 9 Apr 2023 11:10:46 +0000 (07:10 -0400)]
ValueTracking: Implement computeKnownFPClass for arithmetic.fence

15 months agoValueTracking: Add baseline test for arithmetic.fence computeKnownFPClass
Matt Arsenault [Sun, 9 Apr 2023 11:09:59 +0000 (07:09 -0400)]
ValueTracking: Add baseline test for arithmetic.fence computeKnownFPClass

15 months agoValueTracking: Add baseline test for computeKnownFPClass fpext handling
Matt Arsenault [Sun, 9 Apr 2023 11:23:53 +0000 (07:23 -0400)]
ValueTracking: Add baseline test for computeKnownFPClass fpext handling

15 months agoValueTracking: Implement computeKnownFPClass for llvm.trunc
Matt Arsenault [Sun, 9 Apr 2023 02:54:30 +0000 (22:54 -0400)]
ValueTracking: Implement computeKnownFPClass for llvm.trunc

15 months agoValueTracking: Add baseline test for trunc computeKnownFPClass handling
Matt Arsenault [Sun, 9 Apr 2023 10:49:48 +0000 (06:49 -0400)]
ValueTracking: Add baseline test for trunc computeKnownFPClass handling

15 months agoValueTracking: Handle non-splat vectors in computeKnownFPClass
Matt Arsenault [Mon, 10 Apr 2023 19:41:46 +0000 (15:41 -0400)]
ValueTracking: Handle non-splat vectors in computeKnownFPClass

Avoids some regressions when the implementation of isKnownNeverNaN is
replaced with computeKnownFPClass.

15 months ago[github] update action and use major version
Mohammed Keyvanzadeh [Fri, 14 Apr 2023 11:23:30 +0000 (14:53 +0330)]
[github] update action and use major version

- Update the `actions/download-artifact` action to version 3.
- Use the major version of an action instead of specifying the minor or patch versions.

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

15 months ago[libc++] Re-generate the ignore-format file with the CI's clang-format
Louis Dionne [Fri, 14 Apr 2023 21:14:16 +0000 (22:14 +0100)]
[libc++] Re-generate the ignore-format file with the CI's clang-format

99e52b68a4 re-generated that file with a clang-format version that differs
from the CI's clang-format, leading to CI breakage.

15 months ago[ELF] Fix SysV hash function.
Nathan Sidwell [Sun, 9 Apr 2023 17:28:34 +0000 (13:28 -0400)]
[ELF] Fix SysV hash function.

(a) Treat name as unsigned chars.

(b) Refactor for better optimization of main loop.

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

15 months ago[clang-format] Correctly indent comment above finalized PPDirective
Owen Pan [Thu, 13 Apr 2023 07:27:40 +0000 (00:27 -0700)]
[clang-format] Correctly indent comment above finalized PPDirective

Fixes #62107.

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

15 months ago[gn build] Port d6d30dd9590b
LLVM GN Syncbot [Fri, 14 Apr 2023 20:52:23 +0000 (20:52 +0000)]
[gn build] Port d6d30dd9590b

15 months ago[ASan] fix test broken by argument promotion pass
Florian Mayer [Fri, 14 Apr 2023 20:47:26 +0000 (13:47 -0700)]
[ASan] fix test broken by argument promotion pass

Reviewed By: vitalybuka

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

15 months ago[ADT] add StringViewExtras llvm::starts_with for std::string_view
Nick Desaulniers [Fri, 14 Apr 2023 20:41:52 +0000 (13:41 -0700)]
[ADT] add StringViewExtras llvm::starts_with for std::string_view

std::string_view::starts_with isn't available until C++20. Create
llvm::starts_with for now; we can delete this when LLVM moves to C++20
one day.

To run the newly added unit test:
$ cd llvm/build; ninja ADTTests; cd -
$ ./llvm/build/unittests/ADT/ADTTests --gtest_filter=StringViewExtrasTest.\*

Reviewed By: MaskRay, erichkeane

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

15 months ago[Tests] Added test for D128011
Dávid Bolvanský [Fri, 14 Apr 2023 20:37:55 +0000 (22:37 +0200)]
[Tests] Added test for D128011

15 months agoValueTracking: Implement computeKnownFPClass for canonicalize
Matt Arsenault [Sat, 8 Apr 2023 23:44:44 +0000 (19:44 -0400)]
ValueTracking: Implement computeKnownFPClass for canonicalize

15 months agoValueTracking: Add baseline test for computeKnownFPClass for canonicalize
Matt Arsenault [Sat, 8 Apr 2023 23:44:22 +0000 (19:44 -0400)]
ValueTracking: Add baseline test for computeKnownFPClass for canonicalize

15 months ago[OpenMP] Remove duplicates from the list if using 'auto'
Joseph Huber [Wed, 12 Apr 2023 20:08:59 +0000 (15:08 -0500)]
[OpenMP] Remove duplicates from the list if using 'auto'

Summary:
We can detect the user's GPUs via the `auto` option. But if the user has
multiple GPUs installed or set the list incorrectly, we need to remove
the duplicates.

15 months ago[libc] Remove duplicate architecture from the detected list
Joseph Huber [Fri, 14 Apr 2023 20:05:40 +0000 (15:05 -0500)]
[libc] Remove duplicate architecture from the detected list

Summary:
When we detect the architectures via `native` we can have systems with
multiple of the same GPU. We need to remove duplicates or else we will
try to build the same target multiple times.

15 months ago[StringView] remove popFront
Nick Desaulniers [Fri, 14 Apr 2023 20:09:01 +0000 (13:09 -0700)]
[StringView] remove popFront

Towards converting our use of llvm::StringView to std::string_view,
remove a method that std::string_view doesn't have.

llvm::StringView::popFront is similar to std::string_view::remove_prefix
but with a reference to std::string_view::front taken first.

Reviewed By: MaskRay

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

15 months ago[AArch64] Precommit a test
Jingu Kang [Fri, 14 Apr 2023 19:42:53 +0000 (20:42 +0100)]
[AArch64] Precommit a test

This patch precommits a test for:

https://reviews.llvm.org/D148347

15 months ago[MLIR][python bindings] implement `PyValue` subclassing to enable operator overloading
max [Fri, 14 Apr 2023 19:20:33 +0000 (14:20 -0500)]
[MLIR][python bindings] implement `PyValue` subclassing to enable operator overloading

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

15 months ago[scudo] The BaseAddr should be MappedBase in releasePagesToOS()
Chia-hung Duan [Fri, 14 Apr 2023 19:12:48 +0000 (19:12 +0000)]
[scudo] The BaseAddr should be MappedBase in releasePagesToOS()

This is used to make MemMapDefault be compliant with legacy APIs.

Reviewed By: fabio-d

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

15 months agoReland "[clang-scan-deps] Migrate to OptTable"
Alex Brachet [Fri, 14 Apr 2023 19:15:02 +0000 (19:15 +0000)]
Reland "[clang-scan-deps] Migrate to OptTable"

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

15 months agotest-release.sh: build projects and runtimes lists with semicolons
Dimitry Andric [Sun, 12 Mar 2023 18:53:12 +0000 (19:53 +0100)]
test-release.sh: build projects and runtimes lists with semicolons

While doing a test-release.sh run on FreeBSD, I ran into a sed error due
to the introduction of the GNU extension '\s' in commit 500587e23dfd.

Scanning for blanks (spaces and tabs) could be done in a more portable
fashion using the [[:blank:]] character class. But it is easier to avoid
the original problem, which is that the projects and runtime lists have
to be separated by semicolons, and cannot start with a semicolon.

Instead, use the shell's alternate value parameter expansion mechanism,
which makes it easy to append items to lists with separators in between,
and without any leading separator. This also avoids having to run sed on
the end result.

In addition, build any selected runtimes in the second phase, otherwise
the third phase can fail to find several symbols in compiler-rt, if that
has been built. This is because the host's compiler-rt is not guaranteed
to have those symbols.

Reviewed By: tstellar

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

15 months agoFix tls_get_addr handling for glibc >=2.25
Thurston Dang [Wed, 12 Apr 2023 20:53:49 +0000 (20:53 +0000)]
Fix tls_get_addr handling for glibc >=2.25

This changes the sanitizers' tls_get_addr handling from
a heuristic check of __signal_safe_memalign allocations
(which has only been used in a since deprecated version
of Google's runtime), to using the sanitizers' interface
function to check if it is a malloc allocation (used
since glibc >= 2.25).

This is one of the approaches proposed by Keno in
https://github.com/google/sanitizers/issues/1409#issuecomment-1214244142

This moves the weak annotation of __sanitizer_get_allocated_size/begin from the header to sanitizer_tls_get_addr.cpp, as suggested by Vitaly in D148060.

Reviewed By: vitalybuka

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

15 months ago[bazel] Fix build after 33468a5
Christian Sigg [Fri, 14 Apr 2023 18:44:19 +0000 (20:44 +0200)]
[bazel] Fix build after 33468a5

Add missing dependency.

15 months agoValueTracking: Handle fptrunc in computeKnownFPClass
Matt Arsenault [Sun, 9 Apr 2023 11:18:07 +0000 (07:18 -0400)]
ValueTracking: Handle fptrunc in computeKnownFPClass

Handle nan.

15 months agoValueTracking: Add computeKnownFPClass baseline test for fptrunc
Matt Arsenault [Mon, 10 Apr 2023 13:49:06 +0000 (09:49 -0400)]
ValueTracking: Add computeKnownFPClass baseline test for fptrunc

15 months agoInstSimplify: Perform cheaper check first
Matt Arsenault [Tue, 11 Apr 2023 20:39:39 +0000 (16:39 -0400)]
InstSimplify: Perform cheaper check first

15 months agoValueTracking: Handle extractelement and extractvalue in computeKnownFPClass
Matt Arsenault [Wed, 12 Apr 2023 23:09:17 +0000 (19:09 -0400)]
ValueTracking: Handle extractelement and extractvalue in computeKnownFPClass

15 months agoValueTracking: Implement computeKnownFPClass for sin/cos
Matt Arsenault [Sat, 8 Apr 2023 23:15:26 +0000 (19:15 -0400)]
ValueTracking: Implement computeKnownFPClass for sin/cos

15 months ago[Docs] Update ClangFormatStyleOptions.rst's versionbadge's to have min-width
Shivam Gupta [Fri, 14 Apr 2023 18:14:39 +0000 (23:44 +0530)]
[Docs] Update ClangFormatStyleOptions.rst's versionbadge's to have min-width

This fix https://github.com/llvm/llvm-project/issues/61934

By default, the width property is used to set the width of a table column.
However, if the content of a cell in that column is wider than the width
specified by the width property, the cell's content will overflow the
column and the table will become wider than the specified width.
This causes the version numbers to be displayed outside of their table cells.

Using the min-width property instead of width ensures that the column is
wide enough to accommodate the content of its cells. If a cell's content is
wider than the specified min-width, the column will expand to fit the content.

15 months ago[mlir][linalg] Fix a bug in lower_pack when there are no padding values.
Hanhan Wang [Fri, 14 Apr 2023 18:23:16 +0000 (11:23 -0700)]
[mlir][linalg] Fix a bug in lower_pack when there are no padding values.

Reviewed By: chelini

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

15 months ago[StringView] remove ctor incompatible with std::string_view
Nick Desaulniers [Fri, 14 Apr 2023 18:11:25 +0000 (11:11 -0700)]
[StringView] remove ctor incompatible with std::string_view

Towards replacing llvm::StringView with std::string_view, remove ctor
that std::string_view doesn't have an analog for.

Reviewed By: erichkeane, MaskRay

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

15 months ago[InstCombine] Make `FoldOpIntoSelect` handle non-constants and use condition to deduc...
Noah Goldstein [Fri, 14 Apr 2023 17:35:14 +0000 (12:35 -0500)]
[InstCombine] Make `FoldOpIntoSelect` handle non-constants and use condition to deduce constants.

Make the fold use the information present in the condition for deducing constants i.e:
```
%c = icmp eq i8 %x, 10
%s = select i1 %c, i8 3, i8 2
%r = mul i8 %x, %s
```

If we fold the `mul` into the select, on the true side we insert `10` for `%x` in the `mul`.

Reviewed By: nikic

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

15 months ago[InstCombine] Add tests for deducing constants based on condition in select; NFC
Noah Goldstein [Fri, 14 Apr 2023 17:34:53 +0000 (12:34 -0500)]
[InstCombine] Add tests for deducing constants based on condition in select; NFC

Reviewed By: nikic

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

15 months ago[LIBC] Actually assert no errors in `pthread_call_once` in its test; NFC
Noah Goldstein [Fri, 14 Apr 2023 17:34:27 +0000 (12:34 -0500)]
[LIBC] Actually assert no errors in `pthread_call_once` in its test; NFC

Just seemed to be missing an assertion.

Reviewed By: sivachandra

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

15 months ago[LIBC] Clarify namespace of `thread_exit` in `pthread_exit`
Noah Goldstein [Fri, 14 Apr 2023 17:33:59 +0000 (12:33 -0500)]
[LIBC] Clarify namespace of `thread_exit` in `pthread_exit`

Just add `__llvm_libc::` to makes things clearer.

Reviewed By: sivachandra

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

15 months ago[TableGen] Replace std::shared_ptr with InstrusiveRefCntPtr for TreePatternNode. NFC
Craig Topper [Fri, 14 Apr 2023 17:37:14 +0000 (10:37 -0700)]
[TableGen] Replace std::shared_ptr with InstrusiveRefCntPtr for TreePatternNode. NFC

An intrusive reference counter uses less memory than the control
block of std::shared_ptr.

This should allow some additional code simplifications if we
don't need to pass around shared_ptr in order to create new
shared_ptrs.

15 months ago[gn build] Port 5abe338f2a7f
LLVM GN Syncbot [Fri, 14 Apr 2023 17:45:35 +0000 (17:45 +0000)]
[gn build] Port 5abe338f2a7f

15 months ago[clang-tidy][NFC] Remove reference to Visual studio native plugin
Jorge Pinto Sousa [Fri, 14 Apr 2023 17:22:47 +0000 (17:22 +0000)]
[clang-tidy][NFC] Remove reference to Visual studio native plugin

The clang-tidy documentation contained:

> MS Visual Studio has a native clang-tidy-vs plugin

This plugin was removed via 559ae14.

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

Reviewed By: PiotrZSL

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

15 months ago[clang-tidy][NFC] Improved hungarian notation regression test at post-commit review
Douglas Chen [Fri, 14 Apr 2023 17:22:36 +0000 (17:22 +0000)]
[clang-tidy][NFC] Improved hungarian notation regression test at post-commit review

Improve the (`D144510`)[https://reviews.llvm.org/D144510] patch with prefix string. Using "my" instead of "cust" would increase
readability.

Take some examples:
- const char* `custszNamePtr` = "Name"; --> `myszNamePtr`
- uint8_t `custu8ValueU8` = 0; --> `myu8ValueU8`
- DWORD `custdwMsDword` = 0; --> `mydwMsDword`

Reviewed By: PiotrZSL

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

15 months ago[clang-tidy] Fix false positve for defaulted move constructor in performance-noexcept...
AMS21 [Fri, 14 Apr 2023 17:06:30 +0000 (17:06 +0000)]
[clang-tidy] Fix false positve for defaulted move constructor in performance-noexcept-move-constructor

Previously a struct like this:

template <typename>
struct A { A(A&&) = default; };

Would trigger a false positive, since even though it is not marked as
noexcept it still is due to the `= default`.
Now we only give a warning if the defaulted move constructor is
actually declared as throwing and correctly resolve it if they are
defaulted.

This fixes llvm#56026, llvm#41414, llvm#38081

Reviewed By: PiotrZSL

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

15 months ago[StringView] remove dropFront
Nick Desaulniers [Fri, 14 Apr 2023 17:24:07 +0000 (10:24 -0700)]
[StringView] remove dropFront

Towards converting our use of llvm::StringView to std::string_view,
remove a method that std::string_view doesn't have.
llvm::StringView::dropFront is semantically similar to
std::string_view::substr but with the input clamped to the size. No code
was relying on clamping other than the rust demangler, which I fixed in
https://reviews.llvm.org/D148272.  Removing this method makes it easier
to switch over code later.

Reviewed By: MaskRay

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

15 months ago[lsan] Move allocator base to avoid conflict with high-entropy ASLR for x86-64 Linux
Fangrui Song [Fri, 14 Apr 2023 17:18:54 +0000 (10:18 -0700)]
[lsan] Move allocator base to avoid conflict with high-entropy ASLR for x86-64 Linux

This ports D148280 for ASan.

On x86-64 Linux, when mmap_rnd_bits is set to 32 (the maximum `ARCH_MMAP_RND_BITS_MAX`),
the allocator space `[kAllocatorSpace,kAllocatorSpace+kAllocatorSize)`
collides with the PIE load base range (0x555555554000 upto `2**mmap_rnd_bits * pagesize` away),
which can cause the allocation to fail.
Using 0x500000000000ULL as the base address avoids this problem and works with
AArch64 Linux and FreeBSD as well.

While here, change s390x to use 0x500000000000ULL as well. See D78644
discussions that the address works.

Reviewed By: thurston, vitalybuka

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

15 months ago[Pipeline] Don't limit ArgumentPromotion to -O3
Arthur Eubanks [Thu, 13 Apr 2023 20:25:08 +0000 (13:25 -0700)]
[Pipeline] Don't limit ArgumentPromotion to -O3

This is a cheap pass so there's no need to limit to -O3.
This removes some differences between various pipelines.

Reviewed By: nikic

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

15 months ago[passes] Remove the legacy PM version of IRCE
Bjorn Pettersson [Fri, 14 Apr 2023 13:04:10 +0000 (15:04 +0200)]
[passes] Remove the legacy PM version of IRCE

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

15 months ago[passes] Remove the legacy PM version of AlignmentFromAssumptions
Bjorn Pettersson [Fri, 14 Apr 2023 13:00:36 +0000 (15:00 +0200)]
[passes] Remove the legacy PM version of AlignmentFromAssumptions

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

15 months ago[Passes] Remove the legacy DemandedBitsWrapperPass
Bjorn Pettersson [Thu, 13 Apr 2023 11:25:43 +0000 (13:25 +0200)]
[Passes] Remove the legacy DemandedBitsWrapperPass

Last user of DemandedBitsWrapperPass was the BDCE pass. Since
the legacy PM version of BDCE was removed in an earlier commit, this
patch removes the now unused DemandedBitsWrapperPass.

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

15 months ago[Passes] Remove legacy PM version of BDCE (aka BitTrackingDCEPass)
Bjorn Pettersson [Thu, 13 Apr 2023 08:42:16 +0000 (10:42 +0200)]
[Passes] Remove legacy PM version of BDCE (aka BitTrackingDCEPass)

BDCE is not used by the codegen pipeline so we should not need the
legacy PM version of the pass any longer.

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

15 months ago[clangd] Handle destructors in DefineOutline tweak
Nathan James [Fri, 14 Apr 2023 16:51:44 +0000 (17:51 +0100)]
[clangd] Handle destructors in DefineOutline tweak

Fix destructors being incorrectly defined in the DefineOutline tweak
Currently it doesn't prepend the class name to the destructor
```lang=c++
class A { ~A() {} };
// Destructor definition after outline
~A() {}
// After this fix
A::~A() {}
```

Reviewed By: kadircet

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

15 months ago[AArch64] Combine SELECT_CC patterns that match smin(a,0) and smax(a,0)
Cameron McInally [Fri, 14 Apr 2023 16:26:16 +0000 (09:26 -0700)]
[AArch64] Combine SELECT_CC patterns that match smin(a,0) and smax(a,0)

With a previous patch to canonicalize SPF to min/max intrinsics (a266af721153),
we saw a performance regression on the AArch64 backend.

This patch recovers from the SPF canonicalization by combining smin(a,0) and
smax(a,0) SELECT_CC patterns during AArch64ISelLowering.

GitHub Issue: #61767

Reviewed By: dmgreen

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

15 months ago[mlir][Linalg] Make HoistRedundantTensorSubsetsOp not a FunctionalStyleTransformOpTrait
Nicolas Vasilache [Fri, 31 Mar 2023 15:00:39 +0000 (08:00 -0700)]
[mlir][Linalg] Make HoistRedundantTensorSubsetsOp not a FunctionalStyleTransformOpTrait

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

15 months ago[flang][openacc] Add kernels construct lowering
Valentin Clement [Fri, 14 Apr 2023 16:43:44 +0000 (09:43 -0700)]
[flang][openacc] Add kernels construct lowering

Lower the parse tree to acc dialects operations. Make use
of the compute construct lowering.

Depends on D148277

Reviewed By: PeteSteinfeld

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

15 months ago[mlir][Tensor] Add support for insert_slice in FoldTensorSubsetOps
Nicolas Vasilache [Fri, 14 Apr 2023 12:44:41 +0000 (05:44 -0700)]
[mlir][Tensor] Add support for insert_slice in FoldTensorSubsetOps

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

15 months ago[RustDemangle] remove StringView::dropFront
Nick Desaulniers [Fri, 14 Apr 2023 16:18:04 +0000 (09:18 -0700)]
[RustDemangle] remove StringView::dropFront

Toward the goal of replacing llvm::StringView with std::string_view,
first replacing users of llvm::StringView::dropFront, this case in the
Rust demangling scheme seemed worth its own commit+review.

Reviewed By: erichkeane, MaskRay

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

15 months ago[lldb][ClangExpression] Filter out non-root namespaces in FindNamespace
Michael Buch [Mon, 3 Apr 2023 10:09:23 +0000 (11:09 +0100)]
[lldb][ClangExpression] Filter out non-root namespaces in FindNamespace

**Summary**

In a program such as:
```
namespace A {
namespace B {
struct Bar {};
}
}

namespace B {
struct Foo {};
}
```
...LLDB would run into issues such as:
```
(lldb) expr ::B::Foo f
error: expression failed to parse:
error: <user expression 0>:1:6: no type named 'Foo' in namespace 'A::B'
::B::Foo f
~~~~~^
```

This is because the `SymbolFileDWARF::FindNamespace` implementation
will return *any* namespace it finds if the `parent_decl_ctx` provided
is empty. In `FindExternalVisibleDecls` we use this API to find the
namespace that symbol `B` refers to. If `A::B` happened to be the one
that `SymbolFileDWARF::FindNamespace` looked at first, we would try
to find `struct Foo` in `A::B`. Hence the error.

This patch proposes a new `SymbolFileDWARF::FindNamespace` API that
will only find a match for top-level namespaces, which is what
`FindExternalVisibleDecls` is attempting anyway; it just never
accounted for multiple namespaces of the same name.

**Testing**

* Added API test-case

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

15 months ago[OpenMP][Docs] Replace broken design document link with the git repo
Joseph Huber [Fri, 14 Apr 2023 16:09:33 +0000 (11:09 -0500)]
[OpenMP][Docs] Replace broken design document link with the git repo

Summary:
At some point we stopped copying this file to the server, but
realistically this is just a static `.pdf` hosted in the LLVM repository
so we can link it directly.

15 months ago[AArch64] Teach the AArch64 backend patterns to generate the RAX1 instruction.
Shreyansh Chouhan [Fri, 14 Apr 2023 16:11:05 +0000 (17:11 +0100)]
[AArch64] Teach the AArch64 backend patterns to generate the RAX1 instruction.

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

15 months ago[lldb] Allow evaluating expressions in C++20 mode
Michael Buch [Fri, 14 Apr 2023 16:01:49 +0000 (17:01 +0100)]
[lldb] Allow evaluating expressions in C++20 mode

This patch allows users to evaluate expressions using
`expr -l c++20`. Currently DWARF keeps the CU's at
`DW_AT_language` at `DW_LANG_C_plus_plus_14` even
when compiling with `-std=c++20`. So even in "C++20
programs" expression evaluation will by default be
performed in `C++11` mode for now.

Enabling `C++14` has been previously attempted at
https://reviews.llvm.org/D80308

There are some remaining issues around evaluating C++20
expressions. Mainly, lack of support for C++20 AST nodes in
`clang::ASTImporter`. But these can be addressed in follow-up
patches.

15 months ago[lldb][Language] Add more language types
Michael Buch [Wed, 1 Feb 2023 03:58:05 +0000 (03:58 +0000)]
[lldb][Language] Add more language types

Adds more languages to the `language_names` list in
preparation for adding support for C++20 expression
evaluation.

The language constants were taken from the DWARFv5
constants defined in LLVM's `Dwarf.def`. Two vendor
constants overlap with the DWARFv5 constants so bump
their values. Their actual value is not important,
whereas keeping the enum values consecutive is (since
they are used for array lookups).

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

15 months ago[fuzzer][test] Disable noasan-strncmp test for AArch64
Antoine Moynault [Fri, 14 Apr 2023 15:32:41 +0000 (15:32 +0000)]
[fuzzer][test] Disable noasan-strncmp test for AArch64

This test fails on several aarch64 bots
  clang-aarch64-lld-2stage ( https://lab.llvm.org/buildbot/#/builders/185/builds/3525 )
  clang-aarch64-full-2stage ( https://lab.llvm.org/buildbot/#/builders/179/builds/5904 )
  clang-aarch64-sve-vla ( https://lab.llvm.org/buildbot/#/builders/197/builds/4519 )
Disable it while this is analyzed.

Reviewed By: DavidSpickett

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

15 months ago[mlir][openacc] Add acc.kernels operation
Valentin Clement [Fri, 14 Apr 2023 15:29:39 +0000 (08:29 -0700)]
[mlir][openacc] Add acc.kernels operation

The acc.kernels operation models the OpenACC kernels construct.
The kernels construct defines a region of a program that is
compiled into a sequence of kernels to be executed on the current device.
The operation is modelled on the acc.parallel operation and will
receive similar updates when the data operands operations will
be implemented.

Reviewed By: PeteSteinfeld

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

15 months ago[libc++] Remove redundant assertion in std::span::subspan
Louis Dionne [Tue, 11 Apr 2023 16:53:39 +0000 (17:53 +0100)]
[libc++] Remove redundant assertion in std::span::subspan

That is already checked later in the function as `__count <= size() - __offset`.

rdar://107884996

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

15 months ago[FPEnv][LangRef] Update doc for strictfp attribute
Kevin P. Neal [Wed, 12 Apr 2023 15:42:44 +0000 (11:42 -0400)]
[FPEnv][LangRef] Update doc for strictfp attribute

Based on the direction of IR Verifier changes in D146845, this documentation
needs to be updated.

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

15 months ago[lldb] Add `operator StringRef` to ConstString
Dave Lee [Wed, 12 Apr 2023 21:44:19 +0000 (15:44 -0600)]
[lldb] Add `operator StringRef` to ConstString

Add a `StringRef` conversion function to `ConstString`.

This will make using llvm, and other non-ConstString, APIs more convenient.

For demonstration, this updates Module.cpp.

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

15 months ago[mlir] Fix test after 2d4e856
Christian Sigg [Fri, 14 Apr 2023 15:04:14 +0000 (17:04 +0200)]
[mlir] Fix test after 2d4e856

The test CHECKs for `-nan`, but printing the sign is optional.

This change removes the sign because it has no meaning.

15 months ago[ConstraintElimination] Add tests to check for transfering facts from sgt to ugt.
Zain Jaffal [Fri, 14 Apr 2023 14:37:06 +0000 (15:37 +0100)]
[ConstraintElimination] Add tests to check for transfering facts from sgt to ugt.

If we have a >s b and we know that b >s 0 then we also can infer that a >u b.

Reviewed By: fhahn

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

15 months ago[OpenMP] Replace HeapToShared's initial value with `poison`
Joseph Huber [Thu, 6 Apr 2023 16:18:47 +0000 (11:18 -0500)]
[OpenMP] Replace HeapToShared's initial value with `poison`

There's a desire to move away from `undef` in LLVM. Currently we want to
have the `addressspace(3)` variables use `poison` instead.

Reviewed By: jdoerfert

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

15 months ago[OpenMP][Docs] Add documentation for using configuration files
Joseph Huber [Mon, 10 Apr 2023 14:50:40 +0000 (09:50 -0500)]
[OpenMP][Docs] Add documentation for using configuration files

We recently reverted a patch that automatically set the rpath on OpenMP
executables. This was used because the `libomptarget.so` library is only
expected to work with the same version of compiler that will be using
it. This patch adds some documentation for how to get similar behaviour
as before using a clang configuration file.

Reviewed By: jdoerfert

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

15 months ago[Flang] Add code owner for the Driver
Kiran Chandramohan [Fri, 14 Apr 2023 14:23:30 +0000 (14:23 +0000)]
[Flang] Add code owner for the Driver

Andrzej proposed the design and led the work for the Flang Driver
over the past couple of years. He is continuing to function as
the primary reviewer and gate-keeper of the Driver.

Reviewed By: sscalpone

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

15 months ago[X86] combineSetCCMOVMSK - fold anyof/noneof movmskps/movmskpd -> testps/testpd
Simon Pilgrim [Fri, 14 Apr 2023 14:37:40 +0000 (15:37 +0100)]
[X86] combineSetCCMOVMSK - fold anyof/noneof movmskps/movmskpd -> testps/testpd

Another part of Issue #60007

15 months ago[X86] Add additional add of mul test (NFC)
Nikita Popov [Fri, 14 Apr 2023 14:28:03 +0000 (16:28 +0200)]
[X86] Add additional add of mul test (NFC)

15 months ago[mlir][math] Expand math.powf to exp, log and multiply
Balaji V. Iyer [Fri, 14 Apr 2023 13:52:17 +0000 (13:52 +0000)]
[mlir][math] Expand math.powf to exp, log and multiply

Powf functions are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will decompose the
powf function into log of exponent multiplied by log of base and raise
it to the exp.

Reviewed By: rsuderman

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

15 months ago[X86] Add test for foldable add of mul (NFC)
Nikita Popov [Fri, 14 Apr 2023 13:56:42 +0000 (15:56 +0200)]
[X86] Add test for foldable add of mul (NFC)

15 months agoRevert " [sanitizer] adapt for 75f1f158812dabc03e70697b6b9c272230bce63d"
Krasimir Georgiev [Fri, 14 Apr 2023 13:55:20 +0000 (13:55 +0000)]
Revert " [sanitizer] adapt for 75f1f158812dabc03e70697b6b9c272230bce63d"

This reverts commit de4c038c7ba2c6a8d529cb094f1a7c3deaae9b75.

The change that triggered this fix got reverted.

15 months ago[AMDGPU] Less aggressively break large PHIs
pvanhout [Fri, 7 Apr 2023 12:54:50 +0000 (14:54 +0200)]
[AMDGPU] Less aggressively break large PHIs

In some cases, breaking large PHIs can very negatively affect
performance (3x more instructions observed in a particular test case).

This patch adds some basic profitability heuristics to help with some of these issues without affecting the "good" cases.
e.g. avoid breaking PHIs if it causes back-and-forth between vector/scalar form for no good reason.

Fixes SWDEV-392803
Fixes SWDEV-393781
Fixes SWDEV-394228

Reviewed By: arsenm

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

15 months ago[mlir][Linalg] Support tensor.parallel_insert_slice in transform.insert_slice_to_copy
Nicolas Vasilache [Fri, 14 Apr 2023 12:43:07 +0000 (05:43 -0700)]
[mlir][Linalg] Support tensor.parallel_insert_slice in transform.insert_slice_to_copy

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

15 months ago[VP] Mark llvm.vp.copysign as a binary op
Luke Lau [Thu, 13 Apr 2023 15:43:36 +0000 (16:43 +0100)]
[VP] Mark llvm.vp.copysign as a binary op

I was working on legalising vector binary ops to their VP counterparts when I noticed that `vp_copysign` wasn't marked as a binary op. It looks like this might have been an oversight, so this marks it as one.

Reviewed By: craig.topper

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

15 months ago[lldb] Add a sleep to TestObjectFileJSON
Pavel Labath [Fri, 14 Apr 2023 12:36:27 +0000 (14:36 +0200)]
[lldb] Add a sleep to TestObjectFileJSON

The test fails when the two generated files have the same timestamp
(lldb uses second granularity).

15 months ago[SCEV] Preserve NSW for AddRec multiplied by -1 if it cannot be signed minimum
Dmitry Makogon [Wed, 12 Apr 2023 08:15:47 +0000 (15:15 +0700)]
[SCEV] Preserve NSW for AddRec multiplied by -1 if it cannot be signed minimum

This preserves NSW flag for AddRecs multiplied by -1 if we can prove
via constant ranges that the AddRec cannot be signed minimum.

An explanation:
Let M be signed minimum. If AddRec's range contains M, then M * (-1) will
stay M and (M + 1) * (-1) will be signed maximum, so we get a signed overflow.
In all other cases if an AddRec didn't signed overflow,
then AddRec * (-1) wouldn't too.

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

15 months ago[mlir][scf] WhileOp patterns cleanup
Ivan Butygin [Thu, 13 Apr 2023 16:28:57 +0000 (18:28 +0200)]
[mlir][scf] WhileOp patterns cleanup

Fix review comments from https://reviews.llvm.org/D146252
Merge `WhileRemoveUnusedArgs` pattern with (unused) `WhileUnusedArg`,
use `getConditionOp`, use `SmallPtrSet` and early check, move tests

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

15 months ago[bazel] Fix build after e5f50bd and 62ef97e
Christian Sigg [Fri, 14 Apr 2023 11:24:15 +0000 (13:24 +0200)]
[bazel] Fix build after e5f50bd and 62ef97e

15 months ago[mlir][Analysis] CFGLoopInfo instantiation in C++
Christian Ulmann [Fri, 14 Apr 2023 11:09:54 +0000 (11:09 +0000)]
[mlir][Analysis] CFGLoopInfo instantiation in C++

This commit moves the CFGLoopInfo instantiation into the C++ file to
ensure that it is only compiled once. Instantiating the template
explicitly revealed two missing functions that this commit also adds.

Reviewed By: ftynse

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

15 months agoModel list initialization more directly; fixes an assert with coverage mapping
Aaron Ballman [Fri, 14 Apr 2023 11:18:46 +0000 (07:18 -0400)]
Model list initialization more directly; fixes an assert with coverage mapping

Instead of using the validity of a brace's source location as a flag
for list initialization, this now uses a PointerIntPair to model it so
we do not increase the size of the AST node to track this information.
This allows us to retain the valid source location information, which
fixes the coverage assertion.

Fixes https://github.com/llvm/llvm-project/issues/62105
Differential Revision: https://reviews.llvm.org/D148245

15 months ago[Test] Fix tests showing flags improvement for SCEV sub expressions (NFC)
Dmitry Makogon [Fri, 14 Apr 2023 11:12:25 +0000 (18:12 +0700)]
[Test] Fix tests showing flags improvement for SCEV sub expressions (NFC)

This fixes a failing check in tests added by 05a142cc6fd1.

15 months ago[X86] SimplifyDemandedBitsForTargetNode - improve TESTPS/TESTPD handling for duplicat...
Simon Pilgrim [Fri, 14 Apr 2023 11:03:38 +0000 (12:03 +0100)]
[X86] SimplifyDemandedBitsForTargetNode - improve TESTPS/TESTPD handling for duplicated operands

We often repeat the vector operand in TESTPS(X,X)/TESTPD(X,X) for anyof comparisons - ensure we still only demand the sign bits when the TESTP is the only user of that operand

15 months ago[RISCV][NFC] Add test case for accept hexadecimal floating-point for fli instructions
Kito Cheng [Fri, 14 Apr 2023 10:46:52 +0000 (18:46 +0800)]
[RISCV][NFC] Add test case for accept hexadecimal floating-point for fli instructions

Zfa provide fli instruction to load a floating point immediate value,
and some of those are not easy to write and read by human, so
hexadecimal floating-point format should be a good alternative way to write:

Consider this case: 1^-16 = 1.52587890625e-05 (decimal) vs 0x1p-16 (hexadecimal)

The hexadecimal format is easier to write for human.

Fortunately hexadecimal floating-point constants already supported in
C99, so actually we don't need to add any extra code to support that.

This patch added test case for demonstrate we support that and also make
sure this will be supported in future.

I also gonna to talk with ISA folks to adding hexadecimal floating-point
to the ISA spec, so that user will know fli accept value in this format.

Reviewed By: asb

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

15 months agoRevert "[symbolizer] Change error message if module not found"
Serge Pavlov [Fri, 14 Apr 2023 10:37:25 +0000 (17:37 +0700)]
Revert "[symbolizer] Change error message if module not found"

This reverts commit 75f1f158812dabc03e70697b6b9c272230bce63d.
It caused fail on https://lab.llvm.org/buildbot#builders/37/builds/21461

15 months ago[Matrix] Refine cost estimate for dot-product.
Florian Hahn [Fri, 14 Apr 2023 10:35:01 +0000 (11:35 +0100)]
[Matrix] Refine cost estimate for dot-product.

Adjust lowerDotProduct cost estimate to include the cost benefits of:
 * emitting a wide load
 * emitting a wide multiply.

Reviewed By: thegameg

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

15 months ago[X86] Add AVX2 test coverage to TESTPS/TESTPD combines
Simon Pilgrim [Fri, 14 Apr 2023 10:07:37 +0000 (11:07 +0100)]
[X86] Add AVX2 test coverage to TESTPS/TESTPD combines

15 months ago[X86] Add TESTPS/TESTPD test coverage showing failure to simplify demanded sign bit...
Simon Pilgrim [Fri, 14 Apr 2023 10:05:51 +0000 (11:05 +0100)]
[X86] Add TESTPS/TESTPD test coverage showing failure to simplify demanded sign bit when the operands has multiple uses

15 months ago[Test] Add tests showing flags improvement for SCEV sub expressions (NFC)
Dmitry Makogon [Fri, 14 Apr 2023 10:12:17 +0000 (17:12 +0700)]
[Test] Add tests showing flags improvement for SCEV sub expressions (NFC)

15 months ago[AIX] enable the cases that are excluded by XCOFF 64 integrated-as support
Chen Zheng [Fri, 14 Apr 2023 10:16:01 +0000 (06:16 -0400)]
[AIX] enable the cases that are excluded by XCOFF 64 integrated-as support

These case are excluded in https://reviews.llvm.org/D113049.
Now AIX XCOFF 64 integrated-as support improves a lot and all these
cases pass now, so enable them.

15 months ago[llvm-c] Remove PassRegistry and initialization APIs
Nikita Popov [Wed, 1 Mar 2023 08:41:59 +0000 (09:41 +0100)]
[llvm-c] Remove PassRegistry and initialization APIs

Remove C APIs for interacting with PassRegistry and pass
initialization. These are legacy PM concepts, and are no longer
relevant for the new pass manager.

Calls to these initialization functions can simply be dropped.

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

15 months ago[gn] Port fcc5f9ef50e1 (GenVT)
Nico Weber [Fri, 14 Apr 2023 10:08:51 +0000 (06:08 -0400)]
[gn] Port fcc5f9ef50e1 (GenVT)

15 months ago[FunctionAttrs] Fix nounwind inference for landingpads
Nikita Popov [Thu, 6 Apr 2023 08:49:42 +0000 (10:49 +0200)]
[FunctionAttrs] Fix nounwind inference for landingpads

Currently, FunctionAttrs treats landingpads as non-throwing, and
will infer nounwind for functions with landingpads (assuming they
can't unwind in some other way, e.g. via resum). There are two
problems with this:

* Non-cleanup landingpads with catch/filter clauses do not
  necessarily catch all exceptions. Unless there are catch ptr null
  or filter [0 x ptr] zeroinitializer clauses, we should assume
  that we may unwind past this landingpad. This seems like an
  outright bug.
* Cleanup landingpads are skipped during phase one unwinding, so
  we effectively need to support unwinding past them. Marking these
  nounwind is technically correct, but not compatible with how
  unwinding works in reality.

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

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

15 months ago[Matrix] Add dot product tests with builtin loads with variable strides
Florian Hahn [Fri, 14 Apr 2023 09:40:47 +0000 (10:40 +0100)]
[Matrix] Add dot product tests with builtin loads with variable strides

Extra tests for D147330.