platform/upstream/llvm.git
16 months agoRevert "Reland "[BOLT] Parallelize legacy profile merging""
Yi Kong [Thu, 18 May 2023 23:26:27 +0000 (16:26 -0700)]
Revert "Reland "[BOLT] Parallelize legacy profile merging""

This reverts commit 611fb179b19857ffb87df81c926902fc7e3412ab.

Broken tests

16 months ago[lldb][NFCI] Pre-allocate storage in ObjCLanguage::MethodName::GetFullNameWithoutCategory
Alex Langford [Thu, 18 May 2023 22:31:25 +0000 (15:31 -0700)]
[lldb][NFCI] Pre-allocate storage in ObjCLanguage::MethodName::GetFullNameWithoutCategory

The size of a full ObjC MethodName can vary somewhat, but it is
computable ahead of time.

Using a reasonably sized ObjC application, this actually improves the
time it takes to initialize symbol indexes for ObjC names ever so
slightly. Additionally, I found that the variability in time also was
improved considerably.

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

16 months ago[mlir][openacc] Add reduction representation
Valentin Clement [Thu, 18 May 2023 23:20:57 +0000 (16:20 -0700)]
[mlir][openacc] Add reduction representation

Similarly to D150622 for private clause, the reduction is currently not
modeled in a good way. This patch is inspired by the reduction representation
in the omp dialect (D105358) and make a new representation for the reduction in
the OpenACC dialect.

A new operation is introduced to model the sequences of operation needed to
initialize a local reduction value and how to combine two values during the
reduction. The operation requires two mandatory regions.

  1. The init region specifies how to initialize the local reduction
     value. The region has an argument that contains the value of the
     reduction accumulator at the start of the reduction. It is expected to
     `acc.yield` the new value.
  2. The reduction region contains a sequences of operations to combine two
     values of the reduction type into one. It has two arguments and it is
     expected to `acc.yield` the combined value.

Example:

```mlir
acc.reduction.recipe @reduction_add_i64 : i64 init reduction_operator<add> {
^bb0(%0: i64):
  // init region contains a sequence of operations to initialize the local
  // reduction value as specified in 2.5.15
  %c0 = arith.constant 0 : i64
  acc.yield %c0 : i64
} reduction {
^bb0(%0: i64, %1: i64)
  // reduction region contains a sequence of operations to combine
  // two values into one.
  %2 = arith.addi %0, %1 : i64
  acc.yield %2 : i64
}

// The reduction symbol is then used in the corresponding operation.
acc.parallel reduction(@reduction_add_i64 -> %a : i64) {
}

Reviewed By: razvanlupusoru, vzakhari

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

16 months agoReland "[BOLT] Parallelize legacy profile merging"
Yi Kong [Fri, 28 Apr 2023 12:26:16 +0000 (21:26 +0900)]
Reland "[BOLT] Parallelize legacy profile merging"

This reverts commit 78d8d016490909ac759c6f76c5f8679bc7a58b2e.

16 months ago[RegisterCoalescer] Remove DbgMergedVRegNums (NFC)
Heejin Ahn [Mon, 15 May 2023 20:12:43 +0000 (13:12 -0700)]
[RegisterCoalescer] Remove DbgMergedVRegNums (NFC)

Not sure what this was originally intended for, but this seems to be
unused. It didn't seem to be used when it was first added in D64630
either.

Reviewed By: jmorse

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

16 months ago[DebugInfo][InstrRef] Prettyprint metadata
Heejin Ahn [Tue, 25 Apr 2023 08:44:25 +0000 (01:44 -0700)]
[DebugInfo][InstrRef] Prettyprint metadata

Some metadata prettyprinting, including variable prettyprinting and
debug line info comments, is currently only supported for `DBG_VALUE`.
This allows `DBG_INSTR_REF` can be printed in the same way.

Reviewed By: jmorse

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

16 months ago[flang] Fixed initialization of c_ptr/c_funptr arrays.
Slava Zakharin [Thu, 18 May 2023 21:51:45 +0000 (14:51 -0700)]
[flang] Fixed initialization of c_ptr/c_funptr arrays.

When lowering ends up outlining the initialization of an entity
containing an array of c_ptr/c_funptr it is treating the array
initializer as scalar due to the missing check for the rank.
When initializing non-0 rank c_ptr/c_funptr entity it has to
recurse via genConstantValue().

Reviewed By: clementval

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

16 months ago[RISCV] Remove unused CHECK-ILP lines from attr-riscv-rvv-vector-bits-types.c. NFC
Craig Topper [Thu, 18 May 2023 22:47:29 +0000 (15:47 -0700)]
[RISCV] Remove unused CHECK-ILP lines from attr-riscv-rvv-vector-bits-types.c. NFC

I must have copied these from SVE by accident. They aren't relevant
for RISC-V.

16 months ago[libc++][NFC] Rename iterator category checks to make it obvious that they check...
Nikolas Klauser [Wed, 17 May 2023 17:34:51 +0000 (10:34 -0700)]
[libc++][NFC] Rename iterator category checks to make it obvious that they check //only// the iterator category

We plan to add concepts for checking that iterators actually provide what they claim to. This is to avoid people thinking that these type traits actually check the iterator requirements in more detail.

Reviewed By: ldionne, #libc

Spies: Mordante, libcxx-commits, wenlei

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

16 months ago[mlir][linalg] Fix tensor.pad sizes computation in lowerPack.
Hanhan Wang [Tue, 16 May 2023 21:08:44 +0000 (14:08 -0700)]
[mlir][linalg] Fix tensor.pad sizes computation in lowerPack.

The padded sizes should be derived from destination tensor, not source
tensor. There could be more than one incomplete tile in padding domain.

Reviewed By: qedawkins

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

16 months ago[lldb] Remove decl for non-existent ResolveSymbolContextForAddress overload (NFC)
Dave Lee [Thu, 18 May 2023 22:30:07 +0000 (15:30 -0700)]
[lldb] Remove decl for non-existent ResolveSymbolContextForAddress overload (NFC)

16 months agoInstSimplify: Use isKnownNeverInfOrNaN
Matt Arsenault [Tue, 11 Apr 2023 20:41:02 +0000 (16:41 -0400)]
InstSimplify: Use isKnownNeverInfOrNaN

16 months agoInstSimplify: Combine computeKnownFPClass calls and pass AssumptionCache
Matt Arsenault [Tue, 11 Apr 2023 20:32:50 +0000 (16:32 -0400)]
InstSimplify: Combine computeKnownFPClass calls and pass AssumptionCache

16 months agoAMDGPU: Pattern match fract instructions in AMDGPUCodeGenPrepare
Matt Arsenault [Fri, 5 May 2023 15:25:29 +0000 (11:25 -0400)]
AMDGPU: Pattern match fract instructions in AMDGPUCodeGenPrepare

This will allow eliminating the intrinsic uses in the device
libraries, which will remove a subtarget dependency on the f16
version of the intrinsic.

We previously had some wrong patterns for this under unsafe math
which I've removed.

Do it in IR partially to take advantage of the much better isKnownNeverNaN
handling, and partially out of laziness to avoid repeating this in the DAG
and GlobalISel path. Plus I think this should be done much earlier. Ideally
this would be in InstCombine, but you can't introduce target intrinsics
from a generic instruction rooted pattern.

16 months ago[lldb] Guarantee the lifetimes of all strings returned from SBAPI
Alex Langford [Wed, 17 May 2023 17:44:38 +0000 (10:44 -0700)]
[lldb] Guarantee the lifetimes of all strings returned from SBAPI

LLDB should guarantee that the strings returned by SBAPI methods
live forever. I went through every method that returns a string and made
sure that it was added to the ConstString StringPool before returning if
it wasn't obvious that it was already doing so.
I've also updated the docs to document this behavior.

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

16 months ago[mlir][linalg] Add support for dynamic pad op masking vectorization.
Hanhan Wang [Fri, 12 May 2023 23:26:30 +0000 (16:26 -0700)]
[mlir][linalg] Add support for dynamic pad op masking vectorization.

Reviewed By: dcaballe, awarzynski

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

16 months ago[mlir][sparse] Adjusting error message wording, to better match new field names
wren romano [Wed, 17 May 2023 20:23:04 +0000 (13:23 -0700)]
[mlir][sparse] Adjusting error message wording, to better match new field names

This is a followup to D150330, split out because it's not purely mechanical.

Depends On D150330

Reviewed By: aartbik

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

16 months ago[lldb] Refactor ObjCLanguage::MethodName
Alex Langford [Thu, 4 May 2023 00:09:32 +0000 (17:09 -0700)]
[lldb] Refactor ObjCLanguage::MethodName

The goal of this patch is to make it easier to reason about the state of
ObjCLanguage::MethodName. I do that in several ways:
- Instead of using the constructor directly, you go through a factory
  method. It returns a std::optional<MethodName> so either you got an
  ObjCLanguage::MethodName or you didn't. No more checking if it's valid
  to know if you can use it or not.
- ObjCLanguage::MethodName is now immutable. You cannot change its
  internals once it is created.
- ObjCLanguage::MethodName::GetFullNameWithoutCategory previously had a
  parameter that let you get back an empty string if the method had no
  category. Every caller of this method was enabling this behavior so I
  dropped the parameter and made it the default behavior.
- No longer store all the various components of the method name as
  ConstStrings. The relevant `Get` methods now return llvm::StringRefs
  backed by the MethodName's internal storage. The lifetime of these
  StringRefs are tied to the MethodName itself, so if you need to
  persist these you need to create copies.

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

16 months ago[gn build] Port 16eb14806d1e
LLVM GN Syncbot [Thu, 18 May 2023 21:29:09 +0000 (21:29 +0000)]
[gn build] Port 16eb14806d1e

16 months ago[lldb][NFCI] Switch to using llvm::DWARFAbbreviationDeclaration
Alex Langford [Fri, 12 May 2023 22:32:51 +0000 (15:32 -0700)]
[lldb][NFCI] Switch to using llvm::DWARFAbbreviationDeclaration

Both LLVM and LLDB implement DWARFAbbreviationDeclaration. As of
631ff46cbf51, llvm's implementation of
DWARFAbbreviationDeclaration::extract behaves the same as LLDB's
implementation, making it easier to merge the implementations.

The only major difference between LLDB's implementation and LLVM's
implementation is that LLVM's DWARFAbbreviationDeclaration is slightly
larger. Specifically, it has some metadata that keeps track of the size
of a declaration (if it has a fixed size) so that it can potentially
optimize extraction in some scenarios. I think this increase in size
should be acceptable and possibly useful on the LLDB side.

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

16 months ago[flang] Don't complain about dummy subroutine under IMPLICIT NONE
Peter Klausler [Wed, 17 May 2023 17:23:18 +0000 (10:23 -0700)]
[flang] Don't complain about dummy subroutine under IMPLICIT NONE

The compiler emits a bogus 'No explicit type declared for...' error
when a dummy procedure turns out to be a subroutine (or at least not
a function or object) under control of IMPLICIT NONE.

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

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

16 months ago[libcxxabi] allow downstreams to override _LIBCPP_VERBOSE_ABORT
Nick Desaulniers [Thu, 18 May 2023 20:52:25 +0000 (13:52 -0700)]
[libcxxabi] allow downstreams to override _LIBCPP_VERBOSE_ABORT

@asbirlea reports that Google does this for sanitizer analysis
downstream. Looks like a few #defines are added into a header which is
then injected into the build.

Reviewed By: vitalybuka, ldionne, #libc_abi

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

16 months ago[OpenMP 5.2] Deprecate MINUS(-) operator on 'reduction' clause
Fazlay Rabbi [Thu, 11 May 2023 18:18:02 +0000 (11:18 -0700)]
[OpenMP 5.2] Deprecate MINUS(-) operator on 'reduction' clause

16 months ago[libc] Use the new wide integer to hex string facility in LibcTest.
Siva Chandra Reddy [Thu, 18 May 2023 19:25:41 +0000 (19:25 +0000)]
[libc] Use the new wide integer to hex string facility in LibcTest.

The old code, which has regressed over many cleanups, has been replaced
with the new wide integer to hex string facility.

Reviewed By: michaelrj

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

16 months ago[mlir][sparse] Make sparse_tensor::StorageLayout publicly available.
Peiming Liu [Tue, 16 May 2023 23:52:45 +0000 (23:52 +0000)]
[mlir][sparse] Make sparse_tensor::StorageLayout publicly available.

Reviewed By: aartbik

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

16 months ago[Attributor][OpenMP-Opt][NFC] Run the update test checks script
Johannes Doerfert [Mon, 15 May 2023 23:02:38 +0000 (16:02 -0700)]
[Attributor][OpenMP-Opt][NFC] Run the update test checks script

16 months ago[OpenMP] Add JIT and IR tests
Johannes Doerfert [Mon, 15 May 2023 22:37:40 +0000 (15:37 -0700)]
[OpenMP] Add JIT and IR tests

The OpenMP target JIT needs testing, so does the IR we actually generate
for the device. This is the initial commit with variations of an "empty
OpenMP kernel" that should all result in a empty IR kernel.

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

16 months ago[Attributor] Teach AAMemoryLocation about constant GPU memory
Johannes Doerfert [Mon, 15 May 2023 20:52:20 +0000 (13:52 -0700)]
[Attributor] Teach AAMemoryLocation about constant GPU memory

AS(4), when targeting GPUs, is constant. Accesses to constant memory are
(historically) not treated as "memory accesses", hence we should deduce
`memory(none)` for those.

16 months ago[OpenMP][NFC] Eliminate warning
Johannes Doerfert [Mon, 15 May 2023 19:38:20 +0000 (12:38 -0700)]
[OpenMP][NFC] Eliminate warning

16 months ago[RISCV] Fix test that was still using __RISCV_RVV_VLEN_BITS. NFC
Craig Topper [Thu, 18 May 2023 20:25:28 +0000 (13:25 -0700)]
[RISCV] Fix test that was still using __RISCV_RVV_VLEN_BITS. NFC

This constant was renamed to __riscv_v_fixed_vlen during code
review. I missed this in my search and replace.

16 months ago[libc] Add comparison specialization for cpp:string type
Joseph Huber [Thu, 18 May 2023 20:20:17 +0000 (15:20 -0500)]
[libc] Add comparison specialization for cpp:string type

We compare this type in the string_test. It had no specialization here
so it could cause linker errors. This patch simply extends the interface
to support it.

Reviewed By: sivachandra

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

16 months agoAMDGPU/GlobalISel: Fix broken test
Matt Arsenault [Thu, 18 May 2023 20:19:19 +0000 (21:19 +0100)]
AMDGPU/GlobalISel: Fix broken test

16 months ago[NFC][Driver] Fix -Wdangling-else warning
Michael Platings [Thu, 18 May 2023 20:14:56 +0000 (21:14 +0100)]
[NFC][Driver] Fix -Wdangling-else warning

GCC emits this warning because the EXPECT_STREQ macro contains an
if-else statement:

  warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]

16 months ago[Clang] Fix typo in ReleaseNotes.rst
Alexander Shaposhnikov [Thu, 18 May 2023 20:08:54 +0000 (20:08 +0000)]
[Clang] Fix typo in ReleaseNotes.rst

16 months ago[Clang] Update release notes
Alexander Shaposhnikov [Thu, 18 May 2023 20:02:07 +0000 (20:02 +0000)]
[Clang] Update release notes

Update release notes.
This is a follow-up to https://reviews.llvm.org/D146178

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

16 months ago[AArch64] Predicate for ROR immediate
Evandro Menezes [Thu, 18 May 2023 00:07:02 +0000 (19:07 -0500)]
[AArch64] Predicate for ROR immediate

Add a common predicate for when the `ROR` immediate or "Bitfield
extract, one register" idiom is used for `EXTR` or "Bitfield extract,
two registers".

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

16 months ago[mlir][linalg] Unify generic vectorization interface.
Hanhan Wang [Fri, 12 May 2023 23:30:59 +0000 (16:30 -0700)]
[mlir][linalg] Unify generic vectorization interface.

It breaks the logic of maskedVectorize (on tensor.pad ops) into
precondition checks and vectorization implementation; unifies the
interface.

The revision also rename`s vectorizeLinalgOpPrecondition` to
`vectorizeOpPrecondition` because we can vectorize ops other
than LinalgOps.

Reviewed By: dcaballe

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

16 months agoFix LLVM Sphinx build
Aaron Ballman [Thu, 18 May 2023 19:57:56 +0000 (15:57 -0400)]
Fix LLVM Sphinx build

Addresses the issue found in:
https://lab.llvm.org/buildbot/#/builders/30/builds/35298

16 months ago[bindings] Remove LLVM python bindings
Anders Waldenborg [Tue, 16 May 2023 06:19:55 +0000 (08:19 +0200)]
[bindings] Remove LLVM python bindings

The LLVM python bindings are defunct.

They have not seen any substantial active development since 2014.

The version number, which is used to find the libLLVM-NN.so library, has
not been updated since LLVM 10.0 (2019) (and even then they were
probably mostly broken)

After fixing the version number to be able to run them at all, a large
number of tests in the test suite fails.

Already in 2017 the removal was discussed:
 https://discourse.llvm.org/t/is-anyone-using-still-using-the-python-bindings/46063
 https://lists.llvm.org/pipermail/llvm-dev/2017-August/116857.html

There exist external projects providing python bindings for LLVM, e.g:
 https://github.com/numba/llvmlite

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

16 months ago[clang/Driver] Also consider `gnu++` standard when checking for modules support
Argyrios Kyrtzidis [Fri, 12 May 2023 19:30:06 +0000 (12:30 -0700)]
[clang/Driver] Also consider `gnu++` standard when checking for modules support

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

16 months ago[mlir][sparse] Calling `SparseTensorType::get{Pos,Crd}Type` directly
wren romano [Wed, 17 May 2023 20:44:45 +0000 (13:44 -0700)]
[mlir][sparse] Calling `SparseTensorType::get{Pos,Crd}Type` directly

The `SparseTensorType` versions of these methods have some special handling to ensure that they work for unannotated tensors; whereas, the `stt.getEncoding().get{Pos,Crd}Type()` idiom can cause segfaults.

Reviewed By: Peiming

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

16 months ago[flang] Allow redudant attributes on use-/host- associated names
Peter Klausler [Wed, 17 May 2023 21:29:25 +0000 (14:29 -0700)]
[flang] Allow redudant attributes on use-/host- associated names

Constraint C815 in F'2018 allows a name to acquire an attribute at
most once per scope.  For some attributes, the attribute may have
already been inherited, and the compiler was emitting a bogus error
message for a redundant application of the same attribute in another
scope.

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

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

16 months ago[mlir][Vector] Add folding for vector.mask with all-true masks
Diego Caballero [Thu, 18 May 2023 17:35:42 +0000 (17:35 +0000)]
[mlir][Vector] Add folding for vector.mask with all-true masks

This patch removes `vector.mask` operations with all-true masks (i.e.,
all lanes enabled).

Reviewed By: hanchung

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

16 months ago[libc] Disable newly added test from running on NVPTX
Joseph Huber [Thu, 18 May 2023 19:04:04 +0000 (14:04 -0500)]
[libc] Disable newly added test from running on NVPTX

A recent patch enabled this test which turns out to segfault on the
NVPTX architecture. We disable it for now.

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

16 months ago[NFC][DAG] Simplify a giant expression in visitMul.
Amaury Séchet [Thu, 18 May 2023 18:33:01 +0000 (18:33 +0000)]
[NFC][DAG] Simplify a giant expression in visitMul.

16 months ago[flang] Fix bogus error under IMPLICIT NONE(EXTERNAL)
Peter Klausler [Wed, 17 May 2023 15:34:35 +0000 (08:34 -0700)]
[flang] Fix bogus error under IMPLICIT NONE(EXTERNAL)

Don't emit an error message for a possible implicit use of an
external procedure when it is known that the symbol is not
a procedure (e.g., an array).

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

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

16 months agoRevert "[NVPTX/CUDA] added an optional src_size argument to __nvvm_cp_async*"
Artem Belevich [Thu, 18 May 2023 18:41:14 +0000 (11:41 -0700)]
Revert "[NVPTX/CUDA] added an optional src_size argument to __nvvm_cp_async*"

Breaks MLIR which happens to be using the intrinsics.

This reverts commit e7b9c2f00fa04ef8d9b69ee0e36d7775823dbe6b.

16 months agoSimplifyLibCalls: Pass AssumptionCache to isKnownNeverInfinity
Matt Arsenault [Tue, 11 Apr 2023 19:44:37 +0000 (15:44 -0400)]
SimplifyLibCalls: Pass AssumptionCache to isKnownNeverInfinity

Let's assumes work for determining no infinities.

16 months agoAMDGPU: Fix missing C++ mode comment
Matt Arsenault [Sun, 7 May 2023 10:41:39 +0000 (11:41 +0100)]
AMDGPU: Fix missing C++ mode comment

16 months agoAMDGPU: Drop broken fast math patterns for fract matching
Matt Arsenault [Tue, 9 May 2023 15:21:19 +0000 (16:21 +0100)]
AMDGPU: Drop broken fast math patterns for fract matching

These didn't make much sense and we can match the real
pattern.

16 months agoAMDGPU: Add baseline tests for fract matching
Matt Arsenault [Thu, 4 May 2023 20:25:26 +0000 (16:25 -0400)]
AMDGPU: Add baseline tests for fract matching

16 months agoAMDGPU: Add baseline test for gfx8 fptrunc combine
Matt Arsenault [Sun, 7 May 2023 10:19:36 +0000 (11:19 +0100)]
AMDGPU: Add baseline test for gfx8 fptrunc combine

16 months ago[flang] Better error recovery for missing THEN in IF construct
Peter Klausler [Wed, 17 May 2023 14:57:38 +0000 (07:57 -0700)]
[flang] Better error recovery for missing THEN in IF construct

Presented with "IF (...)" with no following tokens in the statement,
diagnose a missing "THEN" instead of complaining about all of the
possible action statement initial tokens that could have been there
for a non-construct IF statement.

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

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

16 months ago[RISCV] Fix comment about what version of Zvk* we support. NFC
Craig Topper [Thu, 18 May 2023 18:37:22 +0000 (11:37 -0700)]
[RISCV] Fix comment about what version of Zvk* we support. NFC

We support 0.5.1.

Reviewed By: asb

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

16 months ago[test] Driver/code-coverage.c: chdir to a temporary directory
Fangrui Song [Thu, 18 May 2023 18:31:38 +0000 (11:31 -0700)]
[test] Driver/code-coverage.c: chdir to a temporary directory

-coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda creates aaa.gcno in
the current directory (a pattern to be avoided; which may be read-only in an
alternative lit runner).

16 months ago[flang] Respect !DIR$ IGNORE_TKR in generic matching
Peter Klausler [Wed, 17 May 2023 18:19:14 +0000 (11:19 -0700)]
[flang] Respect !DIR$ IGNORE_TKR in generic matching

Generic matching needs to relax argument compatibility checks when
dummy arguments have !DIR$ IGNORE_TKR directives.

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

16 months ago[NVPTX/CUDA] added an optional src_size argument to __nvvm_cp_async*
Artem Belevich [Wed, 17 May 2023 21:41:47 +0000 (14:41 -0700)]
[NVPTX/CUDA] added an optional src_size argument to __nvvm_cp_async*

The optional argument is needed for CUDA-11+ headers when we're compiling for
sm_80+ GPUs.

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

16 months ago[flang] Allow compiler directives in macros
Peter Klausler [Wed, 17 May 2023 13:44:56 +0000 (06:44 -0700)]
[flang] Allow compiler directives in macros

Modify the prescanner to allow compiler directives to appear in
macro expansions, and adjust the parser to accept a semicolon
as a directive terminator.

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

16 months ago[lldb] Implement GetValueTypeFromAddressType
Augusto Noronha [Wed, 26 Apr 2023 11:00:01 +0000 (12:00 +0100)]
[lldb] Implement GetValueTypeFromAddressType

Value::ValueType is a superset of AddressType. Add a function to
convert an AddressType into a Value::ValueType.

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

16 months ago[RFC][MC][MachO]Only emits compact-unwind format for "canonical" personality symbols...
Vy Nguyen [Tue, 28 Feb 2023 20:17:44 +0000 (15:17 -0500)]
[RFC][MC][MachO]Only emits compact-unwind format for "canonical" personality symbols. For the rest, use DWARFs.

Details: https://github.com/rust-lang/rust/issues/102754

The MachO format uses 2 bits to encode these personality funtions, with 0 reserved for "no-personality".
This means we can only have up to 3 personality. There are already three popular personalities:  __gxx_personality_v0, __gcc_personality_v0, and __objc_personality_v0.
As a result, any system that needs custom-personality will run into a problem.

This patch implemented jyknight's proposal to simply force DWARFs for all non-canonical personality functions.

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

16 months ago[RISCV] Reduce dependency on RISCV::RVVBitsPerBlock for calculating vector size for...
Craig Topper [Thu, 18 May 2023 17:09:50 +0000 (10:09 -0700)]
[RISCV] Reduce dependency on RISCV::RVVBitsPerBlock for calculating vector size for -mrvv-vector-bits.

We can use the minimum value of the BuiltinType's ElementCount and
the element size.

This needs to be done to support LMUL!=1 types anyway.

I did have to make an ordering change in the error checks in
HandleRISCVRVVVectorBitsTypeAttr to check if the type is an RVV
VLS type before checking the size.

16 months ago[libc] Add a functioning realloc for hermetic tests.
Siva Chandra Reddy [Thu, 18 May 2023 06:35:59 +0000 (06:35 +0000)]
[libc] Add a functioning realloc for hermetic tests.

Reviewed By: jhuber6

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

16 months ago[libc] Extend IntegerToString to convert UInt* numbers to hex string.
Siva Chandra Reddy [Thu, 18 May 2023 08:19:24 +0000 (08:19 +0000)]
[libc] Extend IntegerToString to convert UInt* numbers to hex string.

This new functionality will help us avoid duplicated code in various
places in the testing infrastructure. Since the string representation
of the wide numbers is to be used by tests, to keep it simple, we
zero-pad the strings.

Reviewed By: lntue

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

16 months ago[lldb] Delay removal of persistent results
Dave Lee [Mon, 15 May 2023 21:36:17 +0000 (14:36 -0700)]
[lldb] Delay removal of persistent results

Follow up to "Suppress persistent result when running po" (D144044).

This change delays removal of the persistent result until after `Dump` has been called.
In doing so, the persistent result is available for the purpose of getting its object
description.

In the original change, the persistent result removal happens indirectly, by setting
`EvaluateExpressionOptions::SetSuppressPersistentResult`. In practice this has worked,
however this exposed a latent bug in swift-lldb. The subtlety, and the bug, depend on
when the persisteted result variable is removed.

When the result is removed via `SetSuppressPersistentResult`, it happens within the call
to `Target::EvaluateExpression`. That is, by the time the call returns, the persistent
result is already removed.

The issue occurs shortly thereafter, when `ValueObject::Dump` is called, it cannot make
use of the persistent result variable (instead it uses the `ValueObjectConstResult`). In
swift-lldb, this causes an additional expression evaluation to happen. It first tries an
expression that reference `$R0` etc, but that always fails because `$R0` is removed. The
fallback to this failure does work most of the time, but there's at least one bug
involving imported Clang types.

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

16 months agoClean up Clang's index page slightly
Aaron Ballman [Thu, 18 May 2023 16:37:53 +0000 (12:37 -0400)]
Clean up Clang's index page slightly

Set the charset to UTF-8, link to the actual liscense we used,
claim support for targets LLVM supports instead of listing them
manually, and stop listing individual language standards we support.

16 months agoRemoved outdated information from Clang's webpage menu
Aaron Ballman [Thu, 18 May 2023 16:22:30 +0000 (12:22 -0400)]
Removed outdated information from Clang's webpage menu

This removes the link to Planet Clang as well as the LLVM coverage
reports, as neither has been actively worked on for several years.

16 months ago[RISCV] Fix assertion when casting LMUL!=1 RVV types to GNU types with -mrvv-vector...
Craig Topper [Thu, 18 May 2023 16:21:38 +0000 (09:21 -0700)]
[RISCV] Fix assertion when casting LMUL!=1 RVV types to GNU types with -mrvv-vector-bits.

We need to call isRVVVLSBuiltinType() before calling getRVVTypeSize().

16 months agoEnsure comparison of constraints creates a code synth context
Erich Keane [Thu, 18 May 2023 16:05:51 +0000 (09:05 -0700)]
Ensure comparison of constraints creates a code synth context

This is a regression from 6db007a0 that was reported in:
https://github.com/llvm/llvm-project/issues/62697

The assertion was because we require a code synthesis context for the
instantiation of templates, and this reproducer causes a comparison that
doesn't have a parent-template causing one to exists.

This patch fixes it by creating a ConstraintNormalization context.

16 months agoRemove unreferenced files from Clang's website
Aaron Ballman [Thu, 18 May 2023 15:49:33 +0000 (11:49 -0400)]
Remove unreferenced files from Clang's website

None of these files are referenced by anything else on the website, and
the content for these files is quite dated or experiments that did not
pan out. I used a few search engines to see if others were linking to
this content (esp the libstdc++ patches) and did not find significant
evidence that they were.

16 months ago[WebAssembly] Add wasm_simd128.h intrinsics for relaxed SIMD
Thomas Lively [Thu, 18 May 2023 15:24:58 +0000 (08:24 -0700)]
[WebAssembly] Add wasm_simd128.h intrinsics for relaxed SIMD

Add user-friendly intrinsic functions for all relaxed SIMD instructions
alongside the existing SIMD128 intrinsic functions in wasm_simd128.h. Test that
the new instrinsics lower to the expected instructions in the existing
cross-project-tests test file.

Reviewed By: aheejin, sbc100

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

16 months ago[libc++] Avoid dereferencing a const iterator in std::sort
Louis Dionne [Wed, 17 May 2023 14:17:53 +0000 (07:17 -0700)]
[libc++] Avoid dereferencing a const iterator in std::sort

This is a workaround to provide a grace period for folks that were
broken by D147089. As a fly-by, also apply comments by Mark I had
somehow missed in the review.

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

16 months agoSummary:
zhijian [Thu, 18 May 2023 15:22:35 +0000 (11:22 -0400)]
Summary:

  Fixed a test case llvm\test\Object\bigarchive-malformed-header.test fail caused by  windowi OS has 'llvm-ar.exe' instead of llvm-ar.

16 months agoRevert "[AMDGPU] Trim zero components from buffer and image stores"
Mateja Marjanovic [Thu, 18 May 2023 14:15:57 +0000 (16:15 +0200)]
Revert "[AMDGPU] Trim zero components from buffer and image stores"

This reverts commit 3181a6e3e7dae9292782216a55c5e1f0583c1668.

16 months ago[AIX] support 64bit global symbol table for big archive
zhijian [Thu, 18 May 2023 14:54:14 +0000 (10:54 -0400)]
[AIX] support 64bit global symbol table for big archive

Summary:

In big archive , there is 32bit global symbol table and 64 bit global symbol table. llvm-ar only support 32bit global symbol table this moment, we need to support the 64 bit global symbol table.

https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big

Global Symbol Tables

Immediately following the member table, the archive file contains two global symbol tables. The first global symbol table locates 32-bit file members that define global symbols; the second global symbol table does the same for 64-bit file members. If the archive has no 32-bit or 64-bit file members, the respective global symbol table is omitted. The strip command can be used to delete one or both global symbol tables from the archive. The fl_gstoff field in the fixed-length header contains the offset to the 32-bit global symbol table, and the fl_gst64off contains the offset to the 64-bit global symbol table.

Reviewers: James Henderson,Stephen Peckham
Differential Revision: https://reviews.llvm.org/D142479

16 months ago[NFC] Flatten the logic in RISCVTargetLowering::decomposeMulByConstant
Amaury Séchet [Thu, 18 May 2023 14:44:53 +0000 (14:44 +0000)]
[NFC] Flatten the logic in RISCVTargetLowering::decomposeMulByConstant

16 months ago[PowerPC] Add DFP multiply and divide instructions.
Stefan Pintilie [Wed, 17 May 2023 14:36:23 +0000 (10:36 -0400)]
[PowerPC] Add DFP multiply and divide instructions.

This patch adds the DFP mul and div instructions. This includes both the
double and quad forms of the instructions as well as the record form.

Reviewed By: amyk

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

16 months ago[Flang][OpenMP][OMPIRBuilder] Add lowering of TargetOp for device codegen
Sergio Afonso [Mon, 10 Apr 2023 13:24:25 +0000 (14:24 +0100)]
[Flang][OpenMP][OMPIRBuilder] Add lowering of TargetOp for device codegen

This patch adds support in the `OpenMPIRBuilder` for generating working
device code for OpenMP target regions. It generates and handles the
result of a call to `__kmpc_target_init()` at the beginning of the
function resulting from outlining each target region, and it also
generates the matching `__kmpc_target_deinit()` call before returning.

It relies on the implementation of target region outlining for host
codegen to handle the production of the new function and the lowering of
its body based on the contents of the associated target region.

Depends on D147172

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

16 months ago[clang][RISCV] Set HasLegalHalfType to true if zhinx is enabled
Alex Bradbury [Thu, 18 May 2023 14:01:48 +0000 (15:01 +0100)]
[clang][RISCV] Set HasLegalHalfType to true if zhinx is enabled

Now that codegen support for zhinx in landed (D149811), we should set
HasLegalHalfType=true for zhinx (see D145071 for the patch doing this
for zfh).

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

16 months ago[clang] Convert several tests to opaque pointers
Sergei Barannikov [Wed, 17 May 2023 23:10:52 +0000 (02:10 +0300)]
[clang] Convert several tests to opaque pointers

Reviewed By: nikic

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

16 months agoRevert "[clang][AST] Print name instead of type when diagnosing uninitialized subobje...
Erich Keane [Thu, 18 May 2023 13:23:24 +0000 (06:23 -0700)]
Revert "[clang][AST] Print name instead of type when diagnosing uninitialized subobject in constexpr variables"

This reverts commit 0e167fc0a2147c9b673b8afd5fea001b0d127781.

This patch causes its assertion to fire when doing AST-dump, so
reverting so that the author has time to fix this.

16 months agoValueTracking: Check context instruction is in a function
Matt Arsenault [Thu, 18 May 2023 13:39:32 +0000 (14:39 +0100)]
ValueTracking: Check context instruction is in a function

16 months ago[X86][MC] Add labels for BSF in the switch-cases of X86MCInstLower::Lower, NFCI
Shengchen Kan [Thu, 18 May 2023 11:59:09 +0000 (19:59 +0800)]
[X86][MC] Add labels for BSF in the switch-cases of X86MCInstLower::Lower, NFCI

BSF is not special here and leaving it in default label looked weird.

16 months agoReapply "ValueTracking: Handle phi in computeKnownFPClass"
Matt Arsenault [Thu, 18 May 2023 11:56:53 +0000 (12:56 +0100)]
Reapply "ValueTracking: Handle phi in computeKnownFPClass"

This reverts commit e13f88d1ff5234946af6349a9a7cf56fcb6c040e.

Fix off by one recursion limit check.

16 months agoEarlyCSE: Add regression test for computeKnownFPClass phi handling
Matt Arsenault [Thu, 18 May 2023 11:41:28 +0000 (12:41 +0100)]
EarlyCSE: Add regression test for computeKnownFPClass phi handling

This was reduced from the failure that caused the revert in
e13f88d1ff5234946af6349a9a7cf56fcb6c040e

16 months ago[X86][MC] Move the code about fixed register encoding optimization to X86EncodingOpti...
Shengchen Kan [Thu, 18 May 2023 11:40:33 +0000 (19:40 +0800)]
[X86][MC] Move the code about fixed register encoding optimization to X86EncodingOptimization.cpp, NFCI

16 months agoValueTracking: Check instruction is in a parent in computeKnownFPClass
Matt Arsenault [Thu, 18 May 2023 11:16:04 +0000 (12:16 +0100)]
ValueTracking: Check instruction is in a parent in computeKnownFPClass

For some reason the inliner calls simplifyInstruction with disembodied
instructions. I consider this to be an API defect. Either the instruction
should always be inserted prior to simplification, or we at least
should pass in the new function for the context.

16 months agoMachineTraceMetrics: modernize loops (NFC)
Ramkumar Ramachandra [Thu, 18 May 2023 09:22:14 +0000 (10:22 +0100)]
MachineTraceMetrics: modernize loops (NFC)

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

16 months ago[flang][runtime] Add dynamically allocated temporary storage
Tom Eccles [Thu, 27 Apr 2023 09:53:54 +0000 (09:53 +0000)]
[flang][runtime] Add dynamically allocated temporary storage

These functions will be used as part of the HLFIR lowering for
forall/where. The contents of the API were requested by @jeanPerier.

The API is designed around that use case, assuming that the caller knows
through some side channel what size to allocate for boxes returned from
the pop() function.

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

16 months ago[flang][hlfir] Add pass to inline elementals
Tom Eccles [Tue, 25 Apr 2023 09:07:11 +0000 (09:07 +0000)]
[flang][hlfir] Add pass to inline elementals

Implement hlfir.elemental inlining as proposed in
flang/docs/HighLevelFIR.md.

This is a separate pass to make the code easier to understand. One
alternative would have been to modify the hlfir.elemental lowering in
the HLFIR bufferization pass.

Currently, a hlfir.elemental can only be inlined once; if there are
more uses, the existing bufferization is used instead.

Usage of mlir::applyPatternsAndFoldGreedily was suggested by @jeanPerier

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

16 months ago[AArch64][LoopVectorize] Enable tail-folding of simple loops on neoverse-v1
David Sherwood [Tue, 25 Apr 2023 08:46:41 +0000 (08:46 +0000)]
[AArch64][LoopVectorize] Enable tail-folding of simple loops on neoverse-v1

This patch enables the tail-folding of simple loops by default
when targeting the neoverse-v1 CPU. Simple loops exclude those
with recurrences or reductions or loops that are reversed.

New tests have been added here:

Transforms/LoopVectorize/AArch64/sve-tail-folding-option.ll

In terms of SPEC2017 only one benchmark is really affected when
building with "-Ofast -mcpu=neoverse-v1 -flto", which is
(+ faster, - slower):

525.x264: +7.0%

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

16 months ago[LV] Add extra uniformity tests with UDIV and UREM.
Florian Hahn [Thu, 18 May 2023 10:35:17 +0000 (11:35 +0100)]
[LV] Add extra uniformity tests with UDIV and UREM.

Extra tests for D148841.

16 months ago[X86][MC] Move encoding optimization for VCMP to X86::optimizeInstFromVEX3ToVEX2...
Shengchen Kan [Thu, 18 May 2023 10:30:54 +0000 (18:30 +0800)]
[X86][MC] Move encoding optimization for VCMP to X86::optimizeInstFromVEX3ToVEX2, NFCI

This is a follow-up for c13ed1cc7578

16 months ago[X86][MC] Simplify code for X86::optimizeInstFromVEX3ToVEX2
Shengchen Kan [Thu, 18 May 2023 10:08:57 +0000 (18:08 +0800)]
[X86][MC] Simplify code for X86::optimizeInstFromVEX3ToVEX2

16 months ago [X86][MC] Move the code about MOV encoding optimization to X86EncodingOptimization...
Shengchen Kan [Thu, 18 May 2023 09:26:00 +0000 (17:26 +0800)]
 [X86][MC] Move the code about MOV encoding optimization to X86EncodingOptimization.cpp, NFCI

16 months ago[clang][analyzer] Improve documentation of StdCLibraryFunctionArgs checker (NFC)
Balázs Kéri [Thu, 18 May 2023 09:16:17 +0000 (11:16 +0200)]
[clang][analyzer] Improve documentation of StdCLibraryFunctionArgs checker (NFC)

Documentation is made more exact, term "constraint" is removed entirely,
description of checker option is corrected.

Reviewed By: Szelethus, gamesh411

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

16 months ago[DebugInfo][SelectionDAG] Do not drop dbg intrinsics with empty metadata locs
OCHyams [Wed, 17 May 2023 17:15:57 +0000 (18:15 +0100)]
[DebugInfo][SelectionDAG] Do not drop dbg intrinsics with empty metadata locs

Without this patch SelectionDAG silently drops dbg.values using `!{}` operands.

Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value

This causes assignment-tracking to behaviour to match non-assignment-tracking
behaviour after a recent change (see D140990).

Reviewed By: jmorse

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

16 months ago[XCore] Use backwards scavenging in frame index elimination
Jay Foad [Tue, 16 May 2023 10:26:30 +0000 (11:26 +0100)]
[XCore] Use backwards scavenging in frame index elimination

This is preferred because it does not rely on accurate kill flags.

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

16 months ago[Lanai] Use backwards scavenging in frame index elimination
Jay Foad [Mon, 15 May 2023 15:58:16 +0000 (16:58 +0100)]
[Lanai] Use backwards scavenging in frame index elimination

This is preferred because it does not rely on accurate kill flags.

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

16 months ago[ARC] Use backwards scavenging in frame index elimination
Jay Foad [Mon, 15 May 2023 15:52:59 +0000 (16:52 +0100)]
[ARC] Use backwards scavenging in frame index elimination

This is preferred because it does not rely on accurate kill flags.

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

16 months agoRevert "ValueTracking: Handle phi in computeKnownFPClass"
Matt Arsenault [Thu, 18 May 2023 08:42:54 +0000 (09:42 +0100)]
Revert "ValueTracking: Handle phi in computeKnownFPClass"

This reverts commit cac9e427eb1ff3dabda8ac08968b998c3bc5ab47.

Causing crashes in lencod