platform/upstream/llvm.git
20 months ago[asan][test] Fix SED issues with macOS (BSD)
Roy Sundahl [Mon, 28 Nov 2022 16:29:23 +0000 (08:29 -0800)]
[asan][test] Fix SED issues with macOS (BSD)

SED differs between GNU and BSD in handling semicolon and the use of
'\n' in regex patterns. For macOS we can't use these GNU extensions.

rdar://102686948

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

20 months ago[AMDGPU] Use GCNSubtarget::hasInstPrefetch instead of generation check. NFC.
Jay Foad [Tue, 29 Nov 2022 17:25:55 +0000 (17:25 +0000)]
[AMDGPU] Use GCNSubtarget::hasInstPrefetch instead of generation check. NFC.

20 months agoAMDGPU: Fix broken test
Matt Arsenault [Tue, 29 Nov 2022 17:33:15 +0000 (12:33 -0500)]
AMDGPU: Fix broken test

From ee29a846c622b52d82e208146a028cf866351fde

20 months ago[flang] Lower F08 FINDLOC intrinsic
Tarun Prabhu [Tue, 29 Nov 2022 16:34:58 +0000 (09:34 -0700)]
[flang] Lower F08 FINDLOC intrinsic

The implementation follows the patterns established by the lowering of other
similar intrinsics.

In addition to the code for lowering, the DoTotalReduction template had to be
fixed to correctly break when signaled to do so by the accumulator function.

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

20 months ago[flang] Remove warnings that fast-math options are unimplemented
Tom Eccles [Tue, 29 Nov 2022 11:06:27 +0000 (11:06 +0000)]
[flang] Remove warnings that fast-math options are unimplemented

These are now fully implemented, see
https://reviews.llvm.org/D137390
https://reviews.llvm.org/D137391
https://reviews.llvm.org/D137456
https://reviews.llvm.org/D137580
https://reviews.llvm.org/D137602
https://reviews.llvm.org/D138048

These flags are still tested in
flang/test/Driver/frontend-forwarding.f90 and
flang/test/Lower/fast-math-arithmetic.f90

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

20 months ago[lit] UNSUPPORTED ps4/ps5 => target={{.*-ps(4|5)}}
Paul Robinson [Tue, 29 Nov 2022 17:07:31 +0000 (09:07 -0800)]
[lit] UNSUPPORTED ps4/ps5 => target={{.*-ps(4|5)}}

Part of the project to eliminate special handling for triples in lit expressions.

20 months ago[lldb] Make SWIG an auto-detected dependency
Jonas Devlieghere [Tue, 29 Nov 2022 16:46:21 +0000 (08:46 -0800)]
[lldb] Make SWIG an auto-detected dependency

This patch makes SWIG itself an auto-detected dependency. This allows us
to look for SWIG once in a centralized place and makes it easier
downstream to detect whether to use the static bindings.

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

20 months agoRevert "Use-after-return sanitizer binary metadata"
Kazu Hirata [Tue, 29 Nov 2022 17:04:00 +0000 (09:04 -0800)]
Revert "Use-after-return sanitizer binary metadata"

This reverts commit a1255dc467f7ce57a966efa76bbbb4ee91d9115a.

This patch results in:

  llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp:57:17: error: no member
  named 'size' in 'llvm::MDTuple'

20 months agoFix Clang sphinx build
Aaron Ballman [Tue, 29 Nov 2022 17:01:25 +0000 (12:01 -0500)]
Fix Clang sphinx build

This addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/92/builds/36372

20 months ago[PS4] Remove an UNSUPPORTED, this test seems to work now
Paul Robinson [Tue, 29 Nov 2022 16:57:02 +0000 (08:57 -0800)]
[PS4] Remove an UNSUPPORTED, this test seems to work now

20 months agoDAG: Fix assert when alloca has inconsistent pointer size
Matt Arsenault [Tue, 29 Nov 2022 04:34:18 +0000 (23:34 -0500)]
DAG: Fix assert when alloca has inconsistent pointer size

Take the type from the alloca, not the type to use for allocas.

Fixes issue 59250.

20 months agoclang: Fix cast failure when using -fsanitize=undefined for HIP
Matt Arsenault [Mon, 21 Nov 2022 02:30:19 +0000 (18:30 -0800)]
clang: Fix cast failure when using -fsanitize=undefined for HIP

This was assuming a direct reference to the global variable. The
constant string is placed in addrspace 4, and has a constexpr
addrspacecast to the generic address space.

20 months agoUse-after-return sanitizer binary metadata
Dmitry Vyukov [Mon, 17 Oct 2022 13:13:56 +0000 (15:13 +0200)]
Use-after-return sanitizer binary metadata

Currently per-function metadata consists of:
(start-pc, size, features)

This adds a new UAR feature and if it's set an additional element:
(start-pc, size, features, stack-args-size)

Reviewed By: melver

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

20 months ago[AMDGPU] Add error line number checking
Jay Foad [Tue, 29 Nov 2022 13:18:24 +0000 (13:18 +0000)]
[AMDGPU] Add error line number checking

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

20 months ago[SDAG] Allow scalable vectors in ComputeNumSignBits (try 2)
Philip Reames [Tue, 29 Nov 2022 16:14:48 +0000 (08:14 -0800)]
[SDAG] Allow scalable vectors in ComputeNumSignBits (try 2)

I had reverted this before the holiday week because a problem was reported with a related change (D137140 - scalable vector known bits in DAG).  I had initially confused the two patches, and then decided to leave this reverted out an abundance of caution.  Now that we're through the holiday week, reapplying.

I also roled in fixes for several post commit review comments that hadn't landed with the original change.

Original commit message

This is a continuation of the series of patches adding lane wise support for scalable vectors in various knownbit-esq routines.

The basic idea here is that we track a single lane for scalable vectors which corresponds to an unknown number of lanes at runtime. This is enough for us to perform lane wise reasoning on many arithmetic operations.

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

20 months ago[Clang] Implement CWG2654: Un-deprecation of compound volatile assignments
Corentin Jabot [Tue, 29 Nov 2022 14:31:21 +0000 (15:31 +0100)]
[Clang] Implement CWG2654: Un-deprecation of compound volatile assignments

Reviewed By: #clang-language-wg, erichkeane

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

20 months agoAMDGPU: Remove unnecessary metadata from test
Matt Arsenault [Tue, 29 Nov 2022 15:59:14 +0000 (10:59 -0500)]
AMDGPU: Remove unnecessary metadata from test

The pass isn't doing anything with it, and the line wrapping is
confusing update_test_checks.

20 months ago[Coroutines] createStructType takes alignment in bits but receives bytes
Guillaume Chatelet [Mon, 28 Nov 2022 10:54:34 +0000 (10:54 +0000)]
[Coroutines] createStructType takes alignment in bits but receives bytes

This has been found while trying to remove the last few places relying on `unsigned` to convey alignment operations.
This seems to be untested.

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

20 months ago[AMDGPU] Add support for new LLVM vector types
Mateja Marjanovic [Thu, 17 Nov 2022 10:58:14 +0000 (11:58 +0100)]
[AMDGPU] Add support for new LLVM vector types

Add VReg, AReg and SReg on AMDGPU for bit widths: 288, 320, 352 and 384.

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

20 months agoAdd new vector types for LLVM
Mateja Marjanovic [Thu, 17 Nov 2022 10:04:24 +0000 (11:04 +0100)]
Add new vector types for LLVM

Add v9i32, v9f32, v10i32, v10f32, v11i32, v11f32, v12i32 and v12f32.

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

20 months agoUtils: Fix appending to global_ctors with program address spaces
Matt Arsenault [Tue, 29 Nov 2022 15:31:20 +0000 (10:31 -0500)]
Utils: Fix appending to global_ctors with program address spaces

Also fix constructing sanitizer constructors in address space 0 so
it's testable (this was also failing the verifier on the type of
global_ctors).

20 months ago[AArch64] Extend testing for widening conditions under SVE. NFC
David Green [Tue, 29 Nov 2022 15:53:39 +0000 (15:53 +0000)]
[AArch64] Extend testing for widening conditions under SVE. NFC

20 months ago[Libomptarget][NFC] Add missing LLVM header
Joseph Huber [Tue, 29 Nov 2022 15:46:33 +0000 (09:46 -0600)]
[Libomptarget][NFC] Add missing LLVM header

20 months ago[LinkerWrapper] Ignore OFK_None kinds for building registration code
Joseph Huber [Tue, 29 Nov 2022 15:42:03 +0000 (09:42 -0600)]
[LinkerWrapper] Ignore OFK_None kinds for building registration code

Summary:
The linker wrapper uses this metadata to determine which registration
code to emit, e.g. CUDA, HIP or OpenMP. If we encounter an OFK_None we
should just ignore it.

20 months ago[AMDGPU][MC][GFX11] Correct op_sel handling for permlane*16
Dmitry Preobrazhensky [Tue, 29 Nov 2022 15:15:21 +0000 (18:15 +0300)]
[AMDGPU][MC][GFX11] Correct op_sel handling for permlane*16

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

20 months ago[AIX][pg] Add Correct Search Paths for Profiled Libraries
Michael Francis [Thu, 10 Nov 2022 21:50:53 +0000 (21:50 +0000)]
[AIX][pg] Add Correct Search Paths for Profiled Libraries

On AIX, profiled system libraries are stored at `/lib/profiled` and
`/usr/lib/profiled`. When compiling with `-pg`, we want to link against
libraries in those directories. This PR modifies the AIX toolchain to
add those directories to the linker search paths.

Differential Review: https://reviews.llvm.org/D137375

20 months ago[NFC][ORC] Fix lljit-with-thinlto-summaries.test output ordering issue
Filipp Zhinkin [Tue, 29 Nov 2022 13:16:37 +0000 (16:16 +0300)]
[NFC][ORC] Fix lljit-with-thinlto-summaries.test output ordering issue

Use CHECK-DAG to check module names that printed in order depending
on full file path.

Related issue: https://github.com/llvm/llvm-project/issues/59248

Reviewed By: sgraenitz

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

20 months agollvm-reduce: Add some missing consts
Matt Arsenault [Tue, 29 Nov 2022 14:00:51 +0000 (09:00 -0500)]
llvm-reduce: Add some missing consts

20 months ago[include-cleaner] Implement IWYU begin_keep/end_keep pragma support.
Viktoriia Bakalova [Mon, 28 Nov 2022 13:35:59 +0000 (13:35 +0000)]
[include-cleaner] Implement IWYU begin_keep/end_keep pragma support.

Implement support for begin_keep/end_keep pragmas.

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

20 months ago[clang] Propely handle tests for open DRs in make_cxx_dr_status
Vlad Serebrennikov [Tue, 29 Nov 2022 14:46:47 +0000 (06:46 -0800)]
[clang] Propely handle tests for open DRs in make_cxx_dr_status

A follow-up to D136133. It was mentioned in #58382 that there is a need
to test for DRs that have not been officially resolved yet. This patch
aims to replace original "hackery" with proper handling for such cases.
Highlights:

- Availability can be suffixed (further) with "open", "drafting", or
  "review", e.g. // dr2565: 16 open, // drXXXX: 16 c++17 drafting
- Checks are implemented to ensure that this suffix corresponds to
  actual issue status
- Non-resolved DRs are counted (stdout of make_cxx_dr_status)
- No changes made to cxx_dr_status.html
- 'c++20' availability suffix added
- Remove 'concurrency' status since it's no longer
  on the list of statuses in CWG Active Issues

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

20 months ago[SLP]Fix PR59230: Use actual vector factor when sorting entries.
Alexey Bataev [Mon, 28 Nov 2022 14:30:44 +0000 (06:30 -0800)]
[SLP]Fix PR59230: Use actual vector factor when sorting entries.

When we sort entries for attempting to reorder scalars, need to use
actual vectorization factor, not the number of scalars. Otherwise the
compiler crashes, if the scalars has to be reordered.

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

20 months ago[InstSimplify] Fold !(X || Y) && X --> false
chenglin.bi [Tue, 29 Nov 2022 14:45:04 +0000 (22:45 +0800)]
[InstSimplify] Fold !(X || Y) && X --> false

!(X || Y) && X --> false
https://alive2.llvm.org/ce/z/693Jgv

Fix: [56654](https://github.com/llvm/llvm-project/issues/56654)
Fix: [56780](https://github.com/llvm/llvm-project/issues/56780)

Reviewed By: spatel

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

20 months ago[AMDGPU][MC][MI100+] Enable VOP3 variants of dot2c/dot4c/dot8c opcodes
Dmitry Preobrazhensky [Tue, 29 Nov 2022 14:35:46 +0000 (17:35 +0300)]
[AMDGPU][MC][MI100+] Enable VOP3 variants of dot2c/dot4c/dot8c opcodes

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

20 months ago[mlir][linalg] Allow some fusion on mixed generics
Ivan Butygin [Thu, 24 Nov 2022 02:45:04 +0000 (03:45 +0100)]
[mlir][linalg] Allow some fusion on mixed generics

Relax linalg elementwise fusion check to allow mixed consumers. Producer is still required to be fully tensor to avoid potential memref aliasing.

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

20 months ago[include-cleaner] Fix -Woverloaded-virtual warning, NFC.
Haojian Wu [Tue, 29 Nov 2022 14:04:28 +0000 (15:04 +0100)]
[include-cleaner] Fix -Woverloaded-virtual warning, NFC.

20 months ago[InstSimplify] Fold (X || Y) ? false : X --> false
chenglin.bi [Tue, 29 Nov 2022 13:58:38 +0000 (21:58 +0800)]
[InstSimplify] Fold (X || Y) ? false : X --> false

(X || Y) ? false : X --> false
https://alive2.llvm.org/ce/z/y93yUm

Reviewed By: spatel

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

20 months ago[mlir][spirv] Add group ops
Ivan Butygin [Sun, 27 Nov 2022 11:54:17 +0000 (12:54 +0100)]
[mlir][spirv] Add group ops

Also, gen_spirv_dialect script was broken was broken due to SPV->SPIRV renamings.

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

20 months ago[clang] Update CWG2635 status
Vlad Serebrennikov [Tue, 29 Nov 2022 13:54:34 +0000 (05:54 -0800)]
[clang] Update CWG2635 status

A follow-up to D138852. Apparently cxx_dr_status.html was changed
manually there, since make_cxx_dr_status script doesn't generate the
same HTML after that patch landed.

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

20 months ago[OpenCL] Remove arm-integer-dot-product extension pragmas
Sven van Haastregt [Tue, 29 Nov 2022 13:26:50 +0000 (13:26 +0000)]
[OpenCL] Remove arm-integer-dot-product extension pragmas

This extension only adds builtin functions and thus doesn't need to be
included as an extension.  Instead of a pragma, the builtin functions
of the extension can be exposed through enabling preprocessor defines.

20 months agoRevert "Cache memory buffer's name length"
Florian Hahn [Tue, 29 Nov 2022 13:22:52 +0000 (13:22 +0000)]
Revert "Cache memory buffer's name length"

This reverts commit 1824432174b3166b40bce59477beb5821170748e.

The change triggers an assertion when building clang on macOS:

FAILED: tools/clang/include/clang/Tooling/Syntax/Nodes.inc
cd /Users/florianhahn/projects/llvm-project/builds/release-with-assertions/ccache-stage1 && /Users/florianhahn/projects/llvm-project/builds/release-with-assertions/ccache-stage1/bin/clang-tblgen -gen-clang-syntax-node-list -I /Users/florianhahn/projects/llvm-project/clang/include/clang/Tooling/Syntax -I/Users/florianhahn/projects/llvm-project/clang/include -I/Users/florianhahn/projects/llvm-project/builds/release-with-assertions/ccache-stage1/tools/clang/include -I/Users/florianhahn/projects/llvm-project/builds/release-with-assertions/ccache-stage1/include -I/Users/florianhahn/projects/llvm-project/llvm/include /Users/florianhahn/projects/llvm-project/clang/include/clang/Tooling/Syntax/Nodes.td --write-if-changed -o tools/clang/include/clang/Tooling/Syntax/Nodes.inc -d tools/clang/include/clang/Tooling/Syntax/Nodes.inc.d
Assertion failed: ((!RequiresNullTerminator || BufEnd[0] == 0) && "Buffer is not null terminated!"), function init, file MemoryBuffer.cpp, line 52.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  clang-tblgen             0x000000010466b68c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  clang-tblgen             0x000000010466a808 llvm::sys::RunSignalHandlers() + 64
2  clang-tblgen             0x000000010466bd60 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x00000001877a92a4 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000018777acec pthread_kill + 288
5  libsystem_c.dylib        0x00000001876b42c8 abort + 180
6  libsystem_c.dylib        0x00000001876b3620 err + 0
7  clang-tblgen             0x00000001046ce150 llvm::ErrorOr<std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>> getOpenFileImpl<llvm::MemoryBuffer>(int, llvm::Twine const&, unsigned long long, unsigned long long, long long, bool, bool, llvm::Optional<llvm::Align>) (.cold.1) + 0
8  clang-tblgen             0x000000010464a548 llvm::WritableMemoryBuffer::getNewUninitMemBuffer(unsigned long, llvm::Twine const&, llvm::Optional<llvm::Align>) + 496
9  clang-tblgen             0x000000010464a7a0 llvm::ErrorOr<std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>> getOpenFileImpl<llvm::MemoryBuffer>(int, llvm::Twine const&, unsigned long long, unsigned long long, long long, bool, bool, llvm::Optional<llvm::Align>) + 528
10 clang-tblgen             0x000000010464a254 llvm::ErrorOr<std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>> getFileAux<llvm::MemoryBuffer>(llvm::Twine const&, unsigned long long, unsigned long long, bool, bool, bool, llvm::Optional<llvm::Align>) + 176
11 clang-tblgen             0x000000010466fbbc llvm::TableGenMain(char const*, bool (*)(llvm::raw_ostream&, llvm::RecordKeeper&)) + 1428
12 clang-tblgen             0x0000000104626114 main + 156
13 dyld                     0x0000000187453e50 start + 2544

20 months ago[Support] Move getHostNumPhysicalCores to Threading.h
Archibald Elliott [Fri, 25 Nov 2022 16:25:19 +0000 (16:25 +0000)]
[Support] Move getHostNumPhysicalCores to Threading.h

This change is focussed on simplifying `Support/Host.h` to only do
target detection. In this case, this function is close in usage to
existing functions in `Support/Threading.h`, so I moved it into there.
The function is also renamed to `llvm::get_physical_cores()` to match
the style of threading's functions.

The big change here is that now if you have threading disabled,
`llvm::get_physical_cores()` will return -1, as if it had not been able
to work out the right info. This is due to how Threading.cpp includes
OS-specific code/headers. This seems ok, as if threading is disabled,
LLVM should not need to know the number of physical cores.

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

20 months ago[clang][CodeGen] Add default attributes to __clang_call_terminate
John Brawn [Tue, 22 Nov 2022 17:52:15 +0000 (17:52 +0000)]
[clang][CodeGen] Add default attributes to __clang_call_terminate

When generating __clang_call_terminate use SetLLVMFunctionAttributes
to set the default function attributes, like we do for all the other
functions generated by clang. This fixes a problem where target
features from the command line weren't being applied to this function.

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

20 months agoCache memory buffer's name length
serge-sans-paille [Wed, 23 Nov 2022 06:45:59 +0000 (07:45 +0100)]
Cache memory buffer's name length

This avoids repeated calls to strlen while we already know its value.

When preprocessing sqlite3.c, this gives a surprising 2% speedup.

Full benchmark available here: https://llvm-compile-time-tracker.com/compare.php?from=5279e6a7d677cdf4488883b77aacab911318100c&to=389601b0dbdf23cf25167ddfc49b3af5742ebd9a&stat=instructions:u

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

20 months ago[NFC] fix doc inconsistency in cxx_status
Roy Jacobson [Tue, 29 Nov 2022 13:00:40 +0000 (15:00 +0200)]
[NFC] fix doc inconsistency in cxx_status

20 months ago[Clang] Implement LWG3823 for __is_aggregate
Roy Jacobson [Wed, 23 Nov 2022 20:26:31 +0000 (22:26 +0200)]
[Clang] Implement LWG3823 for __is_aggregate

LWG3823 says that arrays of incomplete types are aggregates. Fix the clang builtin to match that.

Closes https://github.com/llvm/llvm-project/issues/59002

Reviewed By: cjdb

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

20 months ago[clang] Compare constraints before diagnosing mismatched ref qualifiers (GH58962)
Roy Jacobson [Sat, 26 Nov 2022 22:57:23 +0000 (00:57 +0200)]
[clang] Compare constraints before diagnosing mismatched ref qualifiers (GH58962)

As noticed in GH58962, we should only diagnose illegal overloads of member functions
when the ref qualifiers don't match if the trailing constraints are the same.

The fix is to move the existing constraints check earlier in Sema::IsOverload.

Closes https://github.com/llvm/llvm-project/issues/58962

Reviewed By: erichkeane

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

20 months ago[AMDGPU] Better more consistent error check lines
Jay Foad [Tue, 29 Nov 2022 12:45:28 +0000 (12:45 +0000)]
[AMDGPU] Better more consistent error check lines

Checking for : before @LINE avoids the unlikely possibility that the
expected error line number happens to be a suffix of the actual one.

20 months ago[DAG] Attempt to replace a mul node with an existing umul_lohi/smul_lohi node (PR59217)
Simon Pilgrim [Tue, 29 Nov 2022 12:51:23 +0000 (12:51 +0000)]
[DAG] Attempt to replace a mul node with an existing umul_lohi/smul_lohi node (PR59217)

As discussed on Issue #59217, under certain circumstances the DAG can generate duplicate MUL and MUL_LOHI nodes, often during MULO legalization.

This patch attempts to replace MUL nodes with additional uses of the LO result from the MUL_LOHI node

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

20 months ago[AArch64][SME]: Generate streaming-compatible code for fp-extend-trunc
Hassnaa Hamdi [Tue, 29 Nov 2022 12:27:33 +0000 (12:27 +0000)]
[AArch64][SME]: Generate streaming-compatible code for fp-extend-trunc

To generate code compatible to streaming mode:
 - enable custome lowering for TruncStore to avoid crashing
   during legalizing TruncStore for non Integer vector.

Reviewed By: sdesmalen

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

20 months ago[NFC][ASAN][AMDGPU] Use CreateNot/CreateIsNotNull instead of more verbose CreateICMP...
Juan Manuel MARTINEZ CAAMAÑO [Tue, 29 Nov 2022 12:34:56 +0000 (06:34 -0600)]
[NFC][ASAN][AMDGPU] Use CreateNot/CreateIsNotNull instead of more verbose CreateICMP methods

Reviewed By: vitalybuka

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

20 months ago[test] Allow libc++ namespaces besides `__1`
Jordan Rupprecht [Tue, 29 Nov 2022 12:34:40 +0000 (04:34 -0800)]
[test] Allow libc++ namespaces besides `__1`

The libc++ data formatter for `std::shared_ptr` allows any namespace, but the test asserts that it must be the default `__1` namespace. Relax the regex to allow anything that looks like `__.*` (although we use `__[^:]*` so we don't match arbitrarily long text).

Reviewed By: labath

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

20 months ago[test] Switch to use -passes syntax in a bunch of test cases
Bjorn Pettersson [Tue, 29 Nov 2022 09:15:11 +0000 (10:15 +0100)]
[test] Switch to use -passes syntax in a bunch of test cases

Should cover most of the tests for GVN, GVNHoist, GVNSink, GlobalOpt,
GlobalSplit, InstCombine, Reassociate, SROA and TailCallElim that
had not been updated earlier.

20 months ago[Coroutine] Update test to demonstrate bug (D138784)
Guillaume Chatelet [Tue, 29 Nov 2022 12:27:16 +0000 (12:27 +0000)]
[Coroutine] Update test to demonstrate bug (D138784)

20 months ago[AArch64][SME]: Generate streaming-compatible code for bit counting/select
Hassnaa Hamdi [Tue, 29 Nov 2022 11:51:21 +0000 (11:51 +0000)]
[AArch64][SME]: Generate streaming-compatible code for bit counting/select

To generate code compatible to streaming mode:
 - enable custom-lowering ISD::CTLZ and ISD::CTPOP.
 - disable combining OR into BSL.

- Testing files:
 - bit-counting.ll
 - bitselect.ll

Reviewed By: david-arm, sdesmalen

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

20 months ago[AArch64][SME]: Add precursory tests for D138682
Hassnaa Hamdi [Thu, 24 Nov 2022 19:05:25 +0000 (19:05 +0000)]
[AArch64][SME]: Add precursory tests for D138682

Add testing files:
 - bit-counting.ll
 - bitselect.ll

20 months ago[test] Implement layout for unstable std::string garbage formatter tests.
Jordan Rupprecht [Tue, 29 Nov 2022 12:22:30 +0000 (04:22 -0800)]
[test] Implement layout for unstable std::string garbage formatter tests.

The layout is essentially just reversed from the stable std::string layout.

Reviewed By: labath

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

20 months ago[flang][NFC] Retrieve binding table from fir.dispatch_table operations
Valentin Clement [Tue, 29 Nov 2022 12:21:56 +0000 (13:21 +0100)]
[flang][NFC] Retrieve binding table from fir.dispatch_table operations

Change how the binding tables are retrived. Use the newly lowered
fir.dispatch_table operations instead of the fir.global type infos.

Reviewed By: jeanPerier

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

20 months ago[clangd] Heuristic to avoid desync if editors are confused about newline-at-eof
Sam McCall [Sat, 8 Oct 2022 04:39:48 +0000 (06:39 +0200)]
[clangd] Heuristic to avoid desync if editors are confused about newline-at-eof

As strange as it seems to our files-are-strings view of the world, some editors
that treat files as arrays of lines can get confused about whether the last line
has a newline or not.

The consequences of failing to handle a bad incremental update are catastrophic.
If an update would be valid except for a missing newline at end of file, pretend
one exists.

This fixes problems still present in neovim where deleting all text often leads
to a desync shortly afterwards: https://github.com/neovim/neovim/issues/17085

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

20 months ago[NFC] Make headers self-contained.
Jordan Rupprecht [Tue, 29 Nov 2022 12:14:55 +0000 (04:14 -0800)]
[NFC] Make headers self-contained.

Some headers in LLDB work only when considered as textual inclusion, but not if one attempts to use them on their own or with a different context.

- python-typemaps.h: uses Python definitions without using "Python.h".
- RISCVCInstructions.h uses RISC-V register enums without including the enums header.
- RISCVInstructions.h includes EmulateInstructionRISCV.h, but is unnecessary since we forward-declare EmulateInstructionRISCV anyway. Including the header is problematic because EmulateInstructionRISCV.h uses DecodeResult which isn't defined until later in RISCVInstructions.h.

This makes LLDB build cleanly with the "parse_headers" feature [1]. I'm not sure what the analagous CMake option is.

[1] I didn't find public documentation but @MaskRay wrote this up: https://maskray.me/blog/2022-09-25-layering-check-with-clang#parse_headers

Reviewed By: labath, MaskRay

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

20 months ago[mlir][llvm] Make additional int debug attribute parameters optional.
Tobias Gysi [Tue, 29 Nov 2022 11:50:01 +0000 (13:50 +0200)]
[mlir][llvm] Make additional int debug attribute parameters optional.

The revision makes additional integer debug info parameters such as
line or column numbers optional (e.g. the line and column numbers 0 are
elided when printing, which is in line with the LLVM implementation).

Depends on D138405

Reviewed By: rriddle

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

20 months ago[NFC][AMDGPU] Pre-commit tests for D136432
Thomas Symalla [Tue, 29 Nov 2022 11:09:24 +0000 (12:09 +0100)]
[NFC][AMDGPU] Pre-commit tests for D136432

20 months ago[clang] Skip defaulted functions in zero-as-null-pointer-constant.
Jens Massberg [Fri, 25 Nov 2022 16:18:03 +0000 (17:18 +0100)]
[clang] Skip defaulted functions in zero-as-null-pointer-constant.

The zero-as-null-pointer-constant check should not fire if it is inside
a defaulted function, e.g. defaulted spaceship operators.
Add C++20 tests with spaceship operators.

Fixes #50221

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

20 months ago[AggressiveInstCombine] Handle the insert point of the merged load correctly.
bipmis [Tue, 29 Nov 2022 10:53:51 +0000 (10:53 +0000)]
[AggressiveInstCombine] Handle the insert point of the merged load correctly.

This patch updates the load insert point of the merged load in AggressiveInstCombine().
This is done to handle the reported test breaks by handling Alias Analysis correctly.

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

20 months agoRecommit "[LoopFlatten] Enable it by default"
Sjoerd Meijer [Tue, 29 Nov 2022 10:39:08 +0000 (10:39 +0000)]
Recommit "[LoopFlatten] Enable it by default"

The problem in 58441 that was reported after enabling this last time was fixed
in 8e9e22f07bcbe2ee95478684cf31948370e4e51e.

20 months ago[Clang] Implement static operator[]
Roy Jacobson [Sun, 20 Nov 2022 22:30:59 +0000 (00:30 +0200)]
[Clang] Implement static operator[]

After accepted in Kona, update the code to accept static operator[] as well.

No big code changes: accept this operator as static in SemaDeclCXX, update AST call generation in SemaOverload and update feature macros + tests accordingly.

Reviewed By: cor3ntin, erichkeane, #clang-language-wg

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

20 months ago[mlir][llvm] Import debug intrinsics from LLVMIR.
Tobias Gysi [Tue, 29 Nov 2022 10:11:55 +0000 (12:11 +0200)]
[mlir][llvm] Import debug intrinsics from LLVMIR.

Currently, the import of LLVMIR fails if the program contains debug
intrinsics. The revision adds support to import debug intrinsics that
have no debug expression attached and drops all debug intrinsics with a
non-empty debug expression. It also moves the existing debug intrinsics
into the "intr" namespace by deriving from LLVM_IntrOp.

Reviewed By: rriddle

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

20 months ago[lldb/test] Use SBPlatform info for lldbplatformutil.getPlatform()
Pavel Labath [Mon, 21 Nov 2022 13:17:07 +0000 (14:17 +0100)]
[lldb/test] Use SBPlatform info for lldbplatformutil.getPlatform()

Previously, we just used the platform name. This worked mostly OK, but
it required adding special handling for any unusual (and potentially
downstream) platform plugins, as evidenced by the hardcoding of the
qemu-user platform.

The current implementation was added in
D121605/21c5bb0a636c23ec75b13681c0a6fdb03ecd9c0d, which this essentially
reverts and goes back to the previous method of retrieving the platform
name from the platform triple (the "OS" field).

The motivation for D121605 was the ability to retrieve the process
without constructing an SBDebugger object (which would be necessary in a
world where SBPlatforms are managed by SBDebuggers). However, this world
did not arrive (mainly due to other commitments on my part), and I now
think that if we do want to go in that direction, that we should just
create a dummy/empty SBDebugger object for holding the initial
SBPlatform.

One benefit of D121605 was the unification of getPlatform and
getHostPlatform code paths, and I preserve that benefit by unifying them
in the other direction -- using the host SBPlatform for getHostPlatform.

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

20 months ago[flang] Enable RISC-V for x86CompatibleBehavior in floating point flag
Qihan Cai [Tue, 22 Nov 2022 16:12:26 +0000 (03:12 +1100)]
[flang] Enable RISC-V for x86CompatibleBehavior in floating point flag

Fixes #59132 by mitigating the behavior of not setting underflow flag on RISC-V platform.

Reviewed By: vzakhari

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

20 months ago[ARM,MVE] Update MVE_VMLA_qr for architecture change.
Simon Tatham [Tue, 29 Nov 2022 08:46:49 +0000 (08:46 +0000)]
[ARM,MVE] Update MVE_VMLA_qr for architecture change.

In revision B.q and before of the Armv8-M architecture reference
manual, the vector/scalar forms of the `vmla` and `vmlas` instructions
came in signed and unsigned integer forms, such as `vmla.s8 q0,q1,r2`
or `vmlas.u32 q3,q4,r5`.

Revision B.r has changed this. There are no longer signed and unsigned
versions of these instructions, since they were functionally identical
anyway. Now there is just `vmla.i8` (or `i16` or `i32`, and similarly
for `vmlas`). Bit 28 of the instruction encoding, which was previously
0 for signed or 1 for unsigned, is now expected to be 0 always.

This change updates LLVM to the new version of the architecture. The
obsoleted encodings for unsigned integers are now decoding errors, and
only the still-valid encoding is ever emitted. This shouldn't break
any existing assembly code, because the old signed and unsigned
versions of the mnemonic are still accepted by the assembler (which is
standard practice anyway for all signedness-agnostic MVE integer
instructions).

Reviewed By: dmgreen, lenary

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

20 months ago[Test] Update tests for LoopPredication constant ranges widening
Dmitry Makogon [Tue, 29 Nov 2022 07:08:42 +0000 (14:08 +0700)]
[Test] Update tests for LoopPredication constant ranges widening

20 months ago[NFC][X86] Correct _axor_i32 's pseudo code.
Freddy Ye [Tue, 29 Nov 2022 07:08:17 +0000 (15:08 +0800)]
[NFC][X86] Correct _axor_i32 's pseudo code.

20 months ago[lsan] Add logs for debugging
Vitaly Buka [Tue, 29 Nov 2022 06:58:46 +0000 (22:58 -0800)]
[lsan] Add logs for debugging

20 months agoRevert "[clang][deps] During scanning don't emit warnings-as-errors that are ignored...
Douglas Yung [Tue, 29 Nov 2022 05:22:29 +0000 (21:22 -0800)]
Revert "[clang][deps] During scanning don't emit warnings-as-errors that are ignored with diagnostic pragmas."

This reverts commit eac90d1236cfd2935fac5cbe5634f09e2cd0981a.

This change is causing a test failure on the PS4/PS5 bots:
https://lab.llvm.org/buildbot/#/builders/139/builds/31784
https://lab.llvm.org/buildbot/#/builders/216/builds/13476

20 months ago[CMake] Use LLVM_TARGET_TRIPLE in runtimes
Petr Hosek [Wed, 16 Feb 2022 06:59:08 +0000 (22:59 -0800)]
[CMake] Use LLVM_TARGET_TRIPLE in runtimes

This variable is derived from LLVM_DEFAULT_TARGET_TRIPLE by default,
but using a separate variable allows additional normalization to be
performed if needed.

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

20 months agoReland "[mlir][Vector] Re-define masking semantics in vector.transfer ops""
Diego Caballero [Fri, 18 Nov 2022 18:35:32 +0000 (18:35 +0000)]
Reland "[mlir][Vector] Re-define masking semantics in vector.transfer ops""

This relands commit 847b5f82a4a34218bf16d6f83f1b7c32df3117ba.

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

20 months ago[mlir][gpu] Adding support for transposed mma_load_matrix
Quinn Dawkins [Tue, 29 Nov 2022 03:25:09 +0000 (03:25 +0000)]
[mlir][gpu] Adding support for transposed mma_load_matrix

Enables transposed gpu.subgroup_mma_load_matrix and updates the lowerings in Vector to GPU and GPU to SPIRV. Needed to enable B transpose matmuls lowering to wmma ops.

Taken over from author: stanley-nod <stanley@nod-labs.com>

Reviewed By: ThomasRaoux, antiagainst

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

20 months ago[MLIR] Make promote single iteration optional on affine-loop-normalize
Uday Bondhugula [Tue, 29 Nov 2022 02:28:04 +0000 (07:58 +0530)]
[MLIR] Make promote single iteration optional on affine-loop-normalize

Make promote single iteration optional on affine-loop-normalize:
introduce a command-line flag and an argument on the utility. Disable it
by default since such a promotion isn't normally expected with loop
normalization: it could drop certain structure or information on the
loops that a user wanted to preserve.

Reviewed By: dcaballe

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

20 months ago[MLIR] NFC. Change debug name LoopUtils -> loop-utils
Uday Bondhugula [Tue, 29 Nov 2022 01:28:14 +0000 (06:58 +0530)]
[MLIR] NFC. Change debug name LoopUtils -> loop-utils

Rename DEBUG_TYPE for LoopUtils -> loop-utils to be consistent with the
names used for the other files. Fix clang-tidy warnings on argument name
mismatches.

Reviewed By: bondhugula

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

20 months ago[FuzzMutate] New strategy `ShuffleBlockStrategy`
Peter Rong [Sat, 19 Nov 2022 00:17:08 +0000 (16:17 -0800)]
[FuzzMutate] New strategy `ShuffleBlockStrategy`

`ShuffleBlockStrategy` will shuffle the instructions in a basic block without breaking the dependency of instructions.
It is implemented as a topological sort, only we randomly select instructions with no dependency.

Reviewed By: arsenm

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

20 months ago[check-openmp] fix bug49334 bot fails - temporary
Ron Lieberman [Tue, 29 Nov 2022 01:10:43 +0000 (19:10 -0600)]
[check-openmp] fix bug49334 bot fails - temporary

20 months ago[llvm_stats] Do not import llvm.stats metadata for thinlto
wlei [Mon, 28 Nov 2022 18:02:14 +0000 (10:02 -0800)]
[llvm_stats] Do not import llvm.stats metadata for thinlto

The stats are computed per module and will all be merged in the binary, importing the metadata will cause duplication of the stats.

Reviewed By: hoy, wenlei

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

20 months ago[AMDGPU] Fine tune LDS misaligned access speed
Stanislav Mekhanoshin [Fri, 22 Apr 2022 00:02:40 +0000 (17:02 -0700)]
[AMDGPU] Fine tune LDS misaligned access speed

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

20 months ago[Flang][Test] Add support to change the default target triple for tests
Usman Nadeem [Mon, 28 Nov 2022 23:51:15 +0000 (15:51 -0800)]
[Flang][Test] Add support to change the default target triple for tests

In this patch I added support to change the default target triple used
by flang tests using the cmake variable: FLANG_TEST_TARGET_TRIPLE.

This functionality is implemented using the LLVM_TARGET_TRIPLE_ENV
variable, so that must be defined as well.

An example use:
`-DLLVM_TARGET_TRIPLE_ENV="LLVM_TARGET_TRIPLE_ENV" -DFLANG_TEST_TARGET_TRIPLE="aarch64-linux-gnu"`

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

Change-Id: I38e4a46a65109d415a9b72c8a0bf8a955e937280

20 months ago[mlir][Vector] Remove 'lower-permutation-maps' option from VectorToSCF
Diego Caballero [Mon, 28 Nov 2022 23:48:38 +0000 (23:48 +0000)]
[mlir][Vector] Remove 'lower-permutation-maps' option from VectorToSCF

This patch is part of a larger simplification effort of vector transfer
operations. It removes the flag `lower-permutation-maps` from
VectorToSCF conversion and enables the lowering of permutation maps
by default. This means that VectorToSCF will always lower permutation
maps to independent broadcast/transpose operations before lowering
vector operations to SCF.

Reviewed By: nicolasvasilache

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

20 months ago[LoadStoreVectorizer] Consider if operation is faster than before
Stanislav Mekhanoshin [Thu, 21 Apr 2022 23:45:19 +0000 (16:45 -0700)]
[LoadStoreVectorizer] Consider if operation is faster than before

Compare a relative speed of misaligned accesses before and
after vectorization, not just check the new instruction is
not going to be slower.

Since no target now returns anything but 0 or 1 for Fast
argument of the allowsMisalignedMemoryAccesses this is still NFCI.

The subsequent patch will tune actual vaues of Fast on AMDGPU.

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

20 months ago[Analysis] Remove unused fields in MemorySSA.cpp (NFC)
Kazu Hirata [Mon, 28 Nov 2022 23:39:32 +0000 (15:39 -0800)]
[Analysis] Remove unused fields in MemorySSA.cpp (NFC)

The last uses of AR were removed on July 28, 2022 in commit
f96ea53e892e0dfc1ee778868c1ed33616b95a82.

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

20 months ago[mlir][NFC] Remove trailing whitespaces from `*.td` and `*.mlir` files.
Hanhan Wang [Mon, 28 Nov 2022 22:17:55 +0000 (14:17 -0800)]
[mlir][NFC] Remove trailing whitespaces from `*.td` and `*.mlir` files.

This is generated by running

```
sed --in-place 's/[[:space:]]\+$//' mlir/**/*.td
sed --in-place 's/[[:space:]]\+$//' mlir/**/*.mlir
```

Reviewed By: rriddle, dcaballe

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

20 months ago[SPARC][clang] Enable frame pointer optimization by default
Koakuma [Sun, 27 Nov 2022 04:45:45 +0000 (23:45 -0500)]
[SPARC][clang] Enable frame pointer optimization by default

Enable frame pointer optimization by default to match it with other targets.

This brings a small reduction in generated binary sizes.

Fixes bug #48327

Reviewed By: arsenm

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

20 months ago[mlir][tensor] Add a custom builder for pack op.
Hanhan Wang [Mon, 28 Nov 2022 21:40:17 +0000 (13:40 -0800)]
[mlir][tensor] Add a custom builder for pack op.

The `paddingValue` and `outerDimsPerm` are optional to the op;
`innerTiles` can be variadic in terms of static sizes and dynamic sizes.
Add a custom builder for building pack op easier.

Reviewed By: mravishankar

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

20 months ago[OpenMP][Test] Fixed the issue that lit complains test doesn't have run line
Shilei Tian [Mon, 28 Nov 2022 23:13:55 +0000 (18:13 -0500)]
[OpenMP][Test] Fixed the issue that lit complains test doesn't have run line

20 months ago[OpenMP][Test] Disable bug49334.cpp because of its flaky failure
Shilei Tian [Mon, 28 Nov 2022 23:08:14 +0000 (18:08 -0500)]
[OpenMP][Test] Disable bug49334.cpp because of its flaky failure

20 months agoclang/HIP: Add another math header test
Matt Arsenault [Tue, 22 Nov 2022 17:47:32 +0000 (12:47 -0500)]
clang/HIP: Add another math header test

This needs more exhaustive checks for the other things here;
for now just test the ones directly calling ocml functions.

20 months ago[flang] Add RISCV-64 support to Optimizer/CodeGen/Target.cpp
Qihan Cai [Sun, 23 Oct 2022 07:52:09 +0000 (18:52 +1100)]
[flang] Add RISCV-64 support to Optimizer/CodeGen/Target.cpp

As an attempt to fix errors in Flang regression tests on RISCV64 platform, RISCV64 target was added, and subsequent tests were provided.

Reviewed By: vzakhari

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

20 months agoRevert "[VPlan] Add VPDerivedIVRecipe, use for VPScalarIVStepsRecipe."
Florian Hahn [Mon, 28 Nov 2022 22:43:11 +0000 (22:43 +0000)]
Revert "[VPlan] Add VPDerivedIVRecipe, use for VPScalarIVStepsRecipe."

This reverts commit 0fa666ecedc3f36471c0fee925d664512e7525a8.

This triggers an assertion during AArch64 stage2 builds. Revert while I
investigate.

See https://lab.llvm.org/buildbot/#/builders/179/builds/4967/steps/11/logs/stdio

20 months agoCWG2635: Disallow constrained structured bindings.
Erich Keane [Mon, 28 Nov 2022 20:09:58 +0000 (12:09 -0800)]
CWG2635: Disallow constrained structured bindings.

CWG2635 prohibits adding a constraint to a structured as a defect
report.  This patch implements that restriction.

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

20 months ago[libc++] Fix incorrect guard against the presence of wide characters
Louis Dionne [Mon, 28 Nov 2022 16:49:23 +0000 (11:49 -0500)]
[libc++] Fix incorrect guard against the presence of wide characters

TEST_HAS_NO_WIDE_CHARACTERS should only be used in the tests.

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

20 months ago[mlir][spirv] Add lowering for gpu shuffle idx
Thomas Raoux [Mon, 28 Nov 2022 21:58:37 +0000 (21:58 +0000)]
[mlir][spirv] Add lowering for gpu shuffle idx

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

20 months ago[Clang] Update the status of mostly-editorial defect reports
Corentin Jabot [Mon, 28 Nov 2022 22:09:54 +0000 (23:09 +0100)]
[Clang] Update the status of mostly-editorial defect reports

- CWG2644 and CWG2650 fix examples
- CWG2636 updates Annex E
- CWG2642 is editorial

20 months ago[mlir][linalg] Add a new pattern to handle folding unit reduction dims.
Hanhan Wang [Wed, 23 Nov 2022 18:46:46 +0000 (10:46 -0800)]
[mlir][linalg] Add a new pattern to handle folding unit reduction dims.

The output operands will be added to input operands if the generic op (on tensors)
becomes an elementwise operation. The outputs of the generic op is still the same.
They will be cleaned up by ReplaceWithEmptyTensorIfUnused pattern.

This is https://reviews.llvm.org/D138251, plus a cmake dep fix.

Reviewed By: mravishankar

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

20 months ago[clang][deps] During scanning don't emit warnings-as-errors that are ignored with...
Volodymyr Sapsai [Fri, 18 Nov 2022 02:12:48 +0000 (18:12 -0800)]
[clang][deps] During scanning don't emit warnings-as-errors that are ignored with diagnostic pragmas.

Before the fix the scanning would fail with
`-Werror,-Wnon-modular-include-in-module` despite the warning being
suppressed in the source code.

Existing approach with `-Wno-error` is not sufficient because it negates
only general `-Werror` but not specific `-Werror=...` and some warnings
can still emitted as errors. Make the approach stricter by using `-w`
flag and ignore all warnings, including those upgraded to errors. This
approach is still valid as it doesn't affect the dependencies.

rdar://101588531

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