platform/upstream/llvm.git
21 months ago[test][StackLifetime] Add new test created debugging an issue
Vitaly Buka [Wed, 28 Sep 2022 06:13:43 +0000 (23:13 -0700)]
[test][StackLifetime] Add new test created debugging an issue

The issue is not confirmened, but tests can stay.

21 months ago[NFC][StackLifetime] Remove local variable
Vitaly Buka [Wed, 28 Sep 2022 06:06:15 +0000 (23:06 -0700)]
[NFC][StackLifetime] Remove local variable

21 months ago[Support] Class for response file expansion (NFC)
Serge Pavlov [Sun, 21 Aug 2022 17:30:28 +0000 (00:30 +0700)]
[Support] Class for response file expansion (NFC)

Functions that implement expansion of response and config files depend
on many options, which are passes as arguments. Extending the expansion
requires new options, it in turn causes changing calls in various places
making them even more bulky.

This change introduces a class ExpansionContext, which represents set of
options that control the expansion. Its methods implements expansion of
responce files including config files. It makes extending the expansion
easier.

No functional changes.

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

21 months ago[Clang] Don't warn if deferencing void pointers in unevaluated context
Jun Zhang [Wed, 28 Sep 2022 04:30:02 +0000 (12:30 +0800)]
[Clang] Don't warn if deferencing void pointers in unevaluated context

After https://reviews.llvm.org/D134461, Clang will diagnose a warning if
trying to deference void pointers in C mode. However, this causes a lot
of noises when compiling a 5.19.11 Linux kernel.

This patch reduces the warning by marking deferencing void pointers in
unevaluated context OK, like `sizeof(*void_ptr)`, `typeof(*void_ptr)`
and etc.

Fixes https://github.com/ClangBuiltLinux/linux/issues/1720

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D134702

21 months ago[LangRef][Doc] Fix warning for too short title underline
eopXD [Wed, 28 Sep 2022 02:53:28 +0000 (19:53 -0700)]
[LangRef][Doc] Fix warning for too short title underline

21 months ago[VP][RISCV] Add vp.floor, vp.round, vp.roundeven and their RISC-V support
eopXD [Tue, 27 Sep 2022 20:03:25 +0000 (13:03 -0700)]
[VP][RISCV] Add vp.floor, vp.round, vp.roundeven and their RISC-V support

Reviewed By: craig.topper

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

21 months ago[LoongArch] Expand FSIN/FCOS/FSINCOS/FPOW/FREM
gonglingqin [Wed, 28 Sep 2022 01:25:32 +0000 (09:25 +0800)]
[LoongArch] Expand FSIN/FCOS/FSINCOS/FPOW/FREM

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

21 months ago[mlir][sparse] Support sparse2sparse collapse for dynamic sizes
Anlun Xu [Tue, 27 Sep 2022 23:25:20 +0000 (16:25 -0700)]
[mlir][sparse] Support sparse2sparse collapse for dynamic sizes

This patch implements sparse2sparse collapse for operands with dynamic shape.

Reviewed By: aartbik

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

21 months agoRevert "[clang-doc] Add typedef/using information."
Haowei Wu [Wed, 28 Sep 2022 01:35:34 +0000 (18:35 -0700)]
Revert "[clang-doc] Add typedef/using information."

This reverts commit eed22583fd78d4d657fb70b99e62fbdc1f83b8f9, which
breaks clang build with -Werror.

21 months ago[HWASan] [NFC] use auto* over auto& for pointers
Florian Mayer [Wed, 28 Sep 2022 01:19:25 +0000 (18:19 -0700)]
[HWASan] [NFC] use auto* over auto& for pointers

21 months ago[mlir-opt] Support parsing operations other than 'builtin.module' as top-level
rkayaith [Wed, 28 Sep 2022 01:09:34 +0000 (21:09 -0400)]
[mlir-opt] Support parsing operations other than 'builtin.module' as top-level

This adds a `--no-implicit-module` option, which disables the insertion
of a top-level `builtin.module` during parsing. In this mode any op may
be top-level, however it's required that there be exactly one top-level
op in the source.

`parseSource{File,String}` now support `Operation *` as the container op
type, which disables the top-level-op-insertion behaviour.

Following patches will add the same option to the other tools as well.

Depends on D133644

Reviewed By: rriddle

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

21 months ago[mlir-opt] Delay pass manager creation until after parsing
rkayaith [Fri, 9 Sep 2022 01:39:55 +0000 (21:39 -0400)]
[mlir-opt] Delay pass manager creation until after parsing

Currently the pass manager is created before parsing, which requires an
assumption that the top-level operation will be `builtin.module`.
Delaying the creation allows for using the parsed top-level operation as
the PassManager operation instead.

A followup change will allow for parsing top-level operations other than
`builtin.module`.

Reviewed By: rriddle

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

21 months ago[RISCV] Lower BUILD_VECTOR to RISCVISD::VID_VL if it is floating-point type.
Han-Kuan Chen [Tue, 27 Sep 2022 05:48:52 +0000 (22:48 -0700)]
[RISCV] Lower BUILD_VECTOR to RISCVISD::VID_VL if it is floating-point type.

Reviewed By: craig.topper

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

21 months ago[gn build] re-add hlsl.h after e432108bf254
Nico Weber [Wed, 28 Sep 2022 00:16:56 +0000 (20:16 -0400)]
[gn build] re-add hlsl.h after e432108bf254

21 months ago[PowerPC][NFC] Pre-commit test case for an upcoming atomics patch
Nemanja Ivanovic [Tue, 27 Sep 2022 23:50:56 +0000 (18:50 -0500)]
[PowerPC][NFC] Pre-commit test case for an upcoming atomics patch

Just a new test case with auto generated checks.

21 months ago[llvm-jitlink] Remove stray global.
Lang Hames [Tue, 27 Sep 2022 23:32:19 +0000 (16:32 -0700)]
[llvm-jitlink] Remove stray global.

This was accidentally introduced in an earlier commit.

21 months agoFix the test added in 55cd5bc50964449627f6f1
Yuanfang Chen [Tue, 27 Sep 2022 23:42:55 +0000 (16:42 -0700)]
Fix the test added in 55cd5bc50964449627f6f1

It is hard to test the functionality for multiple platforms. Just test it
on Linux as similar patches did in the past.

21 months ago[mlir][sparse] change memref argument to proper SSA components
Aart Bik [Thu, 22 Sep 2022 00:40:50 +0000 (17:40 -0700)]
[mlir][sparse] change memref argument to proper SSA components

The indices for insert/compress were previously provided as
a memref<?xindex> with proper rank, since that matched the
argument for the runtime support libary better. However, with
proper codegen coming, providing the indices as SSA values
is much cleaner. This also brings the sparse_tensor.insert
closer to unification with tensor.insert, planned in the
longer run.

Reviewed By: Peiming

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

21 months ago[clang-doc] Add typedef/using information.
Brett Wilson [Tue, 27 Sep 2022 23:33:29 +0000 (23:33 +0000)]
[clang-doc] Add typedef/using information.

Read typedef and "using" type alias declarations and serialize into the internal structures. Emit this information in the YAML output. The HTML and MD generators are unchanged.

Separate out the logic to create the parent namespace or record object and insert the newly created child into it. This logic was previously duplicated for every "info" type and is now shared.

To help this, a struct containing the child vectors was separated out so children can be added generically and without having too many templates.

A small change was made to populateParentNamespaces() to allow using types that aren't themselves DeclContexts (typedefs are the first example of this).

Reviewed By: paulkirth, haowei

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

21 months ago[clang-doc] Clean up *Info constructors.
Brett Wilson [Tue, 27 Sep 2022 23:29:04 +0000 (23:29 +0000)]
[clang-doc] Clean up *Info constructors.

The *Info object (for the copy of the AST") constructors had many duplicated variants. Many of the variants seemed to be in an attempt to avoid default arguments. But default arguments are not prohibited and using them allows most of the variants to be removed which improves readability.

Remove the IsInGlobalNamespace flag on a Reference. This is set when the path is empty, and only read once in the HTML generator with the identical condition. The constructor cleanup exposed a problem where this was set to false when the constructor with no path was used, but true when the path was set to empty.

There should be no observable change with the exception that IsInGlobalNamespace is no longer emitted in YAML.

Reviewed By: paulkirth, haowei

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

21 months agoClear old section-to-addr entry when loading Section at new addr
Jason Molenda [Tue, 27 Sep 2022 23:17:22 +0000 (16:17 -0700)]
Clear old section-to-addr entry when loading Section at new addr

SectionLoadList has a section-to-address map (m_sect_to_addr) and
an address-to-section map (m_addr_to_sect).  When the load address
of a section is updated, the old entry from m_addr_to_sect would
never be cleared, resulting in incorrect address-to-section address
lookups from that point forward.

Differential Revision: https://reviews.llvm.org/D130534
rdar://97308773

21 months ago[flang] Add co_min and co_max to the list of intrinsics
Katherine Rasmussen [Thu, 25 Aug 2022 17:09:47 +0000 (10:09 -0700)]
[flang] Add co_min and co_max to the list of intrinsics

Add the collective subroutines, co_min and co_max, to the list
of intrinsic subroutines. Add those two subroutines to the check
for coindexed objects for the first, third, and fourth dummy
arguments. Update the co_min and co_max semantics tests.

Reviewed By: klausler

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

21 months ago[libc][windows] fix small build issues.
Michael Jones [Mon, 26 Sep 2022 21:28:23 +0000 (14:28 -0700)]
[libc][windows] fix small build issues.

The windows build has fallen behind a little, this patch fixes some
issues that were preventing it from building.
Specifically: Some subfolders weren't being included, leading to missing
targets in the cmake.

Reviewed By: sivachandra

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

21 months ago[LAA] Make getPtrStride return Option instead of overloading zero as error value...
Philip Reames [Tue, 27 Sep 2022 22:55:44 +0000 (15:55 -0700)]
[LAA] Make getPtrStride return Option instead of overloading zero as error value [nfc]

This is purely NFC restructure in advance of a change which actually exposes zero strides.  This is mostly because I find this interface confusing each time I look at it.

21 months ago[LV] Remove two unused default arguments [nfc]
Philip Reames [Tue, 27 Sep 2022 21:33:41 +0000 (14:33 -0700)]
[LV] Remove two unused default arguments [nfc]

21 months ago[NFCI] Refactor FormatterContainerPair into TieredFormatterContainer.
Jorge Gorbe Moya [Thu, 15 Sep 2022 00:20:33 +0000 (17:20 -0700)]
[NFCI] Refactor FormatterContainerPair into TieredFormatterContainer.

`FormatterContainerPair` is (as its name indicates) a very thin wrapper
over two formatter containers, one for exact matches and another one for
regex matches. The logic to decide which subcontainer to access is
replicated everywhere `FormatterContainerPair`s are used.

So, for example, when we look for a formatter there's some adhoc code
that does a lookup in the exact match formatter container, and if it
fails it does a lookup in the regex match formatter container. The same
logic is then copied and pasted for summaries, filters, and synthetic
child providers.

This change introduces a new `TieredFormatterContainer` that has two
main characteristics:

- It generalizes `FormatterContainerPair` from 2 to any number of
  subcontainers, that are looked up in priority order.
- It centralizes all the logic to choose which subcontainer to use for
  lookups, add/delete, and indexing.

This allows us to have a single copy of the same logic, templatized for
each kind of formatter. It also simplifies the upcoming addition of a
new tier of callback-based matches. See
https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204
for more details about this.

The rest of the change is mostly replacing copy-pasted code with calls
to methods of the relevant `TieredFormatterContainer`, and adding some
methods to the `TypeCategoryImpl` class so we can remove some of this
copy-pasted code from `SBTypeCategory`.

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

21 months agoChange constant in cmov-promotion to avoid optimizations
Amaury Séchet [Tue, 27 Sep 2022 21:08:23 +0000 (21:08 +0000)]
Change constant in cmov-promotion to avoid optimizations

21 months ago[X86] Add test case for D134736. NFC
Amaury Séchet [Tue, 27 Sep 2022 20:47:41 +0000 (20:47 +0000)]
[X86] Add test case for D134736. NFC

21 months agoFix test after 5839fb6d25b4ba6edb
Yuanfang Chen [Tue, 27 Sep 2022 21:00:44 +0000 (14:00 -0700)]
Fix test after 5839fb6d25b4ba6edb

The test is not expected for Windows.

21 months ago[mlir][sparse] fix signed/unsigned warning
Aart Bik [Tue, 27 Sep 2022 20:11:16 +0000 (13:11 -0700)]
[mlir][sparse] fix signed/unsigned warning

Reviewed By: wrengr

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

21 months ago[InstCombine] Add support for stpncpy folding
Martin Sebor [Mon, 1 Aug 2022 21:12:44 +0000 (15:12 -0600)]
[InstCombine] Add support for stpncpy folding

Reviewed By: nikic

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

21 months agoFix test after 5839fb6d25b4ba6edb
Yuanfang Chen [Tue, 27 Sep 2022 20:37:36 +0000 (13:37 -0700)]
Fix test after 5839fb6d25b4ba6edb

The test is not expected for PS4.

21 months ago[RISCV][ISel] Remove the commutative flag on SUB
Quentin Colombet [Mon, 26 Sep 2022 22:10:01 +0000 (22:10 +0000)]
[RISCV][ISel] Remove the commutative flag on SUB

I wasn't able to produce a testcase for that because right now VWSUB is
only generated from VWSUB_W and from there to trigger the commutative
bug we would need to grab VWSUB where the splat value is on the LHS,
which is currently not matched.

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

21 months ago[Driver] pass -fjmc to LTO
Yuanfang Chen [Tue, 27 Sep 2022 20:06:18 +0000 (13:06 -0700)]
[Driver] pass -fjmc to LTO

So the behavior is consistent with non-LTO mode.

Reviewed By: MaskRay

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

21 months ago[Driver][PS4] pass -fcrash-diagnostics-dir to LTO
Yuanfang Chen [Tue, 27 Sep 2022 20:06:00 +0000 (13:06 -0700)]
[Driver][PS4] pass -fcrash-diagnostics-dir to LTO

Also refactor the existing code a little bit.

Reviewed By: probinson

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

21 months ago[Driver] pass -fcrash-diagnostics-dir to LTO
Yuanfang Chen [Tue, 27 Sep 2022 20:05:15 +0000 (13:05 -0700)]
[Driver] pass -fcrash-diagnostics-dir to LTO

So the behavior is consistent with non-LTO mode.

Reviewed By: MaskRay

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

21 months ago[MLIR] Migrate Arithmetic -> LLVM conversion pass to the auto-generated constructor
Michele Scuttari [Tue, 27 Sep 2022 17:41:08 +0000 (19:41 +0200)]
[MLIR] Migrate Arithmetic -> LLVM conversion pass to the auto-generated constructor

See #57475

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

21 months ago[PhaseOrdering] Add missing x86 registered target requirement to fast-basictest.ll
Simon Pilgrim [Tue, 27 Sep 2022 19:59:51 +0000 (20:59 +0100)]
[PhaseOrdering] Add missing x86 registered target requirement to fast-basictest.ll

21 months ago[RISCV] Extend strided load/store pattern matching to non-loop cases
Philip Reames [Tue, 27 Sep 2022 19:49:05 +0000 (12:49 -0700)]
[RISCV] Extend strided load/store pattern matching to non-loop cases

The motivation here is to enable a change I'm exploring in vectorizer to prefer base + offset_vector addressing for scatter/gather. The form the vectorizer would end up emitting would be a gep whose vector operand is an add of the scalar IV (splated) and the index vector. This change makes sure we can recognize that pattern as well as the current code structure. As a side effect, it might improve scatter/gathers from other sources.

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

21 months ago[clang-format] Fix alignment in #else preprocessor blocks
mitchell [Tue, 27 Sep 2022 19:40:39 +0000 (15:40 -0400)]
[clang-format] Fix alignment in #else preprocessor blocks
Summary:
clang-format makes multiple passes when #if/#else preprocessor blocks are found.  It will make
one pass for normal code and code in the #if block, and then it will make another pass for just
the code in #else blocks. This often results in invalid alignment inside the else blocks because
they do not have any scope or indentAndNestingLevel context from their surrounding tokens/lines.

This patch remedies that by caching any initial indentAndNestingLevel from a second pass and
not breaking/returning early when a scope change is detected.

Fixes #36070

Reviewers: HazardyKnusperkeks, MyDeveloperDay

Tags: clang, clang-format

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

21 months agoRename a duplicate test, also give the test class a useful name.
Jim Ingham [Tue, 27 Sep 2022 19:38:22 +0000 (12:38 -0700)]
Rename a duplicate test, also give the test class a useful name.

21 months ago[libc++][NFC] Fix some standard-mandated includes comments
Nikolas Klauser [Thu, 22 Sep 2022 16:05:08 +0000 (18:05 +0200)]
[libc++][NFC] Fix some standard-mandated includes comments

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

21 months ago[VP][RISCV] Add vp.ceil and RISC-V support
eopXD [Sat, 24 Sep 2022 12:52:55 +0000 (05:52 -0700)]
[VP][RISCV] Add vp.ceil and RISC-V support

Previous commit 8b00b24f8505 missed to add `int_ceil` anchor for the
llvm.ceil.* section under LangRef.rst

Reviewed By: craig.topper

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

21 months ago[mlir][sparse] Add sparse_tensor.sort operator.
bixia1 [Tue, 27 Sep 2022 18:45:02 +0000 (11:45 -0700)]
[mlir][sparse] Add sparse_tensor.sort operator.

Reviewed By: aartbik

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

21 months ago[Clang][OpenMP] Fix run time crash when use_device_addr is used.
Jennifer Yu [Fri, 23 Sep 2022 03:05:15 +0000 (20:05 -0700)]
[Clang][OpenMP] Fix run time crash when use_device_addr is used.

It is data mapping ordering problem.

According omp spec
If one or more map clauses are present, the list item conversions that
are performed for any use_device_ptr or use_device_addr clause occur
after all variables are mapped on entry to the region according to those
map clauses.

The change is to put mapping data for use_device_addr at end of data
mapping array.

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

21 months ago[LTO][clang] Using Single Dash Consistently when Passing LTO Options
Qiongsi Wu [Tue, 27 Sep 2022 18:22:40 +0000 (14:22 -0400)]
[LTO][clang] Using Single Dash Consistently when Passing LTO Options

The following three static functions in `clang/lib/Driver/ToolChains/CommonArgs.cpp`

```
static void renderRpassOptions(...)
static void renderRemarksOptions(...)
static void renderRemarksHotnessOptions(...)
```

use `--plugin-opt` for the plugin option prefix, while the function `tools::addLTOOptions`  uses `-plugin-opt`. This patch makes sure that we only use `-plugin-opt` (single dash) everywhere. It is not clear to me that why we decided to use `--plugin-opt` in https://reviews.llvm.org/D85810. If using `--plugin-opt` is intended, I'd love to hear the reason and I will close this patch.

We intend to followup this patch with a few other patches that teach `clang` to pass plugin options to the AIX linker, which uses a different prefix (`-bplugin_opt:`).

Reviewed By: w2yehia

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

21 months ago[AArch64] Add tests for selecting SMULL instruction where the operand is zero extende...
Zain Jaffal [Tue, 27 Sep 2022 18:43:43 +0000 (19:43 +0100)]
[AArch64] Add tests for selecting SMULL instruction where the operand is zero extended and the top bit value is 0

This covers the case where we can convert a zext instruction to a sext and then select smull

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

21 months ago[LLDB][NativePDB] Add class/union layout bit size.
Zequan Wu [Mon, 26 Sep 2022 17:20:18 +0000 (10:20 -0700)]
[LLDB][NativePDB] Add class/union layout bit size.

Missing it causes lldb to crash or give incorrect result.

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

21 months ago[RISCV] Expand strided store test coverage for missing opts during codegen
Philip Reames [Tue, 27 Sep 2022 18:15:38 +0000 (11:15 -0700)]
[RISCV] Expand strided store test coverage for missing opts during codegen

21 months agoRevert "[VP][RISCV] Add vp.ceil and RISC-V support"
eopXD [Tue, 27 Sep 2022 18:12:57 +0000 (11:12 -0700)]
Revert "[VP][RISCV] Add vp.ceil and RISC-V support"

This reverts commit 8b00b24f8505970f54eab85aad8db5845a635850.

21 months ago[VP][RISCV] Add vp.ceil and RISC-V support
eopXD [Sat, 24 Sep 2022 12:52:55 +0000 (05:52 -0700)]
[VP][RISCV] Add vp.ceil and RISC-V support

Reviewed By: craig.topper

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

21 months ago[LLDB][NativePDB] Let native pdb use class layout in debug info.
Zequan Wu [Fri, 23 Sep 2022 17:57:25 +0000 (10:57 -0700)]
[LLDB][NativePDB] Let native pdb use class layout in debug info.

Before, class layout in native pdb is not hooked up in [[https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp#L9375-L9380 | here]].
This changes hooked it up by refactoring SymbolFileNativePDB and PdbAstBuilder.
PdbIndex (corresponds to a single pdb file) is removed from PdbAstBuilder, so it
can only be accessed via SymbolFileNativePDB and we can construct PdbAstBuilder
with just TypeSystemClang.

Reviewed By: labath

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

21 months ago[Hexagon] Unify getSizeOfs in HexagonVectorCombine, NFC
Krzysztof Parzyszek [Tue, 27 Sep 2022 17:51:14 +0000 (10:51 -0700)]
[Hexagon] Unify getSizeOfs in HexagonVectorCombine, NFC

21 months ago[gn build] Port 13e1a653278b
LLVM GN Syncbot [Tue, 27 Sep 2022 17:33:35 +0000 (17:33 +0000)]
[gn build] Port 13e1a653278b

21 months ago[CMake] Add `CLANG_ENABLE_HLSL` CMake option
Chris Bieneman [Tue, 27 Sep 2022 02:44:13 +0000 (21:44 -0500)]
[CMake] Add `CLANG_ENABLE_HLSL` CMake option

The HLSL support in clang is in progress and not fully functioning. As
such we don't want to install the related optional build components by
default (yet), but we do need an option to build and install them
locally for testing and for some key users.

This adds the `CLANG_ENABLE_HLSL` option which is off by default and can
be enabled to install the HLSL clang headers and the clang-dxc symlink.

Reviewed By: phosek

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

21 months ago[Hexagon] Move function to a different class, NFC
Krzysztof Parzyszek [Tue, 27 Sep 2022 17:03:44 +0000 (10:03 -0700)]
[Hexagon] Move function to a different class, NFC

"Sector" is a concept from AlignVectors, so the check for it
should be there.

21 months ago[Driver] Silence a -Wparentheses error. NFC
Craig Topper [Tue, 27 Sep 2022 17:25:18 +0000 (10:25 -0700)]
[Driver] Silence a -Wparentheses error. NFC

21 months agoMove allocas converted from __kmpc_alloc_shared to entry block.
Doru Bercea [Tue, 27 Sep 2022 01:51:17 +0000 (01:51 +0000)]
Move allocas converted from __kmpc_alloc_shared to entry block.

21 months ago[libcxx] Make stdatomic.h work when included from a C source file
Gergely Nagy [Tue, 27 Sep 2022 11:59:55 +0000 (07:59 -0400)]
[libcxx] Make stdatomic.h work when included from a C source file

If a C source file includes the libc++ stdatomic.h, compilation will
break because (a) the C++ standard check will fail (which is expected),
and (b) `_LIBCPP_COMPILER_CLANG_BASED` won't be defined because the
logic defining it in `__config` is guarded by a `__cplusplus` check, so
we'll end up with a blank header. Move the detection logic outside of
the `__cplusplus` check to make the second check pass even in a C context
when you're using Clang. Note that `_LIBCPP_STD_VER` is not defined when
in C mode, hence stdatomic.h needs to check if in C++ mode before using
that macro to avoid a warning.

In an ideal world, a C source file wouldn't be including the libc++
header directory in its search path, so we'd never have this issue.
Unfortunately, certain build environments make this hard to guarantee,
and in this case it's easy to tweak this header to make it work in a C
context, so I'm hoping this is acceptable.

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

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

21 months ago[mlir][spirv] Use "SPIR-V" in the doc after dialect renaming
Lei Zhang [Tue, 27 Sep 2022 17:08:22 +0000 (13:08 -0400)]
[mlir][spirv] Use "SPIR-V" in the doc after dialect renaming

21 months ago[Driver] Prevent Mips specific code from claiming -mabi argument on other targets.
Craig Topper [Tue, 27 Sep 2022 17:04:30 +0000 (10:04 -0700)]
[Driver] Prevent Mips specific code from claiming -mabi argument on other targets.

Fixes PR57976.

Reviewed By: erichkeane, arichardson, MaskRay

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

21 months ago[ORC][JITLink] Retain Weak flags in JITDylib interfaces, propagate to LinkGraph.
Lang Hames [Tue, 27 Sep 2022 15:59:58 +0000 (08:59 -0700)]
[ORC][JITLink] Retain Weak flags in JITDylib interfaces, propagate to LinkGraph.

Previously we stripped Weak flags from JITDylib symbol table entries once they
were resolved (there was no particularly good reason for this). Now we want to
retain them and query them when setting the Linkage on external symbols in
LinkGraphs during symbol resolution (this was the motivation for 75404e9ef88).
Making weak linkage of external definitions discoverable in the LinkGraph will
in turn allow future plugins to implement correct handling for them (by
recording locations that depend on exported weak definitions and pointing all
of these at one chosen definition at runtime).

21 months ago[JITLink] Fix typo in debugging output.
Lang Hames [Tue, 27 Sep 2022 15:37:15 +0000 (08:37 -0700)]
[JITLink] Fix typo in debugging output.

21 months ago[lldb][TypeSystemClang] Honor DW_AT_rvalue_reference when creating C++ FunctionPrototypes
Michael Buch [Mon, 26 Sep 2022 16:38:37 +0000 (18:38 +0200)]
[lldb][TypeSystemClang] Honor DW_AT_rvalue_reference when creating C++ FunctionPrototypes

Currently funciton lookup in the expression evaluator
fails to disambiguate member functions the are overloaded
on lvalue/rvalue reference-qualifiers. This happens because
we unconditionally set a `FunctionPrototype`s
`ExtProtoInfo::RefQualifier` to `RQ_None`. We lose
the ref-qualifiers in the synthesized AST and `clang::Sema`
fails to pick a correct overload candidate.

DWARF emits information about a function's ref-qualifiers
in the form of a boolean `DW_AT_rvalue_reference` (for rvalues)
and `DW_AT_reference` (for lvalues).

This patch sets the `FunctionPrototype::ExtProtoInfo::RefQualifier`
based on the DWARF attributes above.

**Testing**

* Added API test

llvm/llvm-project issue #57866

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

21 months ago[VP][RISCV] Add vp.fmuladd.
Craig Topper [Tue, 27 Sep 2022 16:35:21 +0000 (09:35 -0700)]
[VP][RISCV] Add vp.fmuladd.

Expanded in SelectionDAGBuilder similar to llvm.fmuladd.

Reviewed By: frasercrmck, simoll

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

21 months ago[mlir][LLVMIR] Fix incorrect result type from llvm.fcmp
Min-Yih Hsu [Wed, 3 Aug 2022 21:08:33 +0000 (14:08 -0700)]
[mlir][LLVMIR] Fix incorrect result type from llvm.fcmp

If any of the operands for FCmpOp is a vector, returns a vector<Nxi1>,
rather than an i1 type result.

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

21 months ago[mlir][ExecutionEngine] Remove ScopedContext from ROCm wrappers
Krzysztof Drewniak [Tue, 27 Sep 2022 16:13:07 +0000 (16:13 +0000)]
[mlir][ExecutionEngine] Remove ScopedContext from ROCm wrappers

The push/pop context APIs are deprecated in HIP, and keeping the
default device set is handled in IHP using hipSetDevice().

Reviewed By: ThomasRaoux

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

21 months ago[ObjC][ARC] Fix target register for call expanded from CALL_RVMARKER on Windows
Stefan Gränitz [Tue, 27 Sep 2022 16:43:26 +0000 (18:43 +0200)]
[ObjC][ARC] Fix target register for call expanded from CALL_RVMARKER on Windows

Fix regression https://github.com/llvm/llvm-project/issues/56952 for Clang CodeGen on Windows. In the Windows ABI the instruction sequence that is expanded from CALL_RVMARKER should use RCX as target register and not RDI.

Reviewed By: rnk, fhahn

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

21 months ago[mlir] specify the values when notifying about op replacement
Alex Zinenko [Tue, 27 Sep 2022 16:08:44 +0000 (16:08 +0000)]
[mlir] specify the values when notifying about op replacement

It is useful for PatternRewriter listeners to know the values that are
replacing the op in addition to only the fact of the op being replaced
for being able to keep track of changes or for debugging.

Reviewed By: Mogball

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

21 months ago[AArch64] Remove incorrect zero element insert-bitcast patterns
David Green [Tue, 27 Sep 2022 16:08:17 +0000 (17:08 +0100)]
[AArch64] Remove incorrect zero element insert-bitcast patterns

These two patterns are not working as intended, as shown in D134022.
They need to insert the value into the new register, not override it.

21 months ago[LinkerWrapper] Fix optimized debugging builds for NVPTX LTO
Joseph Huber [Mon, 26 Sep 2022 18:39:11 +0000 (13:39 -0500)]
[LinkerWrapper] Fix optimized debugging builds for NVPTX LTO

The ptxas assembler does not allow the `-g` flag along with
optimizations. Normally this is degraded to line info in the driver, but
when using LTO we did not have this step and the linker wrapper was not
correctly degrading the option. Note that this will not work if the user
does not pass `-g` again to the linker invocation. That will require
setting some flags in the binary to indicate that debugging was used
when building.

This fixes #57990

Reviewed By: jdoerfert

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

21 months ago[RISCV] Rename getVectorImmCost to getStoreImmCost [nfc]
Philip Reames [Tue, 27 Sep 2022 15:20:49 +0000 (08:20 -0700)]
[RISCV] Rename getVectorImmCost to getStoreImmCost [nfc]

My original intent had been to reuse this for arithmetic instructions as well, but due to the availability of a immediate splat encoding there, we will need different heuristics.  So specialize the existing code for the store case.

21 months ago[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC) [reland]
Lorenzo Chelini [Tue, 27 Sep 2022 15:16:43 +0000 (11:16 -0400)]
[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC) [reland]

The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache, cota

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

21 months ago[RISCV][SLP] Add test coverage for stores of constants
Philip Reames [Tue, 27 Sep 2022 14:49:54 +0000 (07:49 -0700)]
[RISCV][SLP] Add test coverage for stores of constants

21 months ago[TTI] getExtractWithExtendCost - remove default Index = -1 value
Simon Pilgrim [Tue, 27 Sep 2022 14:44:21 +0000 (15:44 +0100)]
[TTI] getExtractWithExtendCost - remove default Index = -1 value

We currently always specify the index (even if we set it to -1), and a future patch will need to adjust this method to make it more compatible with getScalarizationOverhead

21 months ago[lld-macho] Fix -force_symbols_{,not_}weak_list arg type
Bernhard Urban-Forster [Tue, 27 Sep 2022 14:35:57 +0000 (10:35 -0400)]
[lld-macho] Fix -force_symbols_{,not_}weak_list arg type

This is still undocumented and unsupported, but if someone passed it before you
would end up with a missing file error since this takes an argument that
wouldn't be handled.

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

21 months ago[mlir] Correctly handle HIP_PATH when ROCM_PATH is set
Krzysztof Drewniak [Mon, 26 Sep 2022 20:46:17 +0000 (20:46 +0000)]
[mlir] Correctly handle HIP_PATH when ROCM_PATH is set

With the CMake file as written, if code elsewhere had set ROCM_PATH,
then HIP_PATH would not be set, breaking the rest of the ROCm
execution utility handling.

Reviewed By: mehdi_amini

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

21 months ago[mlir][linalg] Add getIteratorTypesArray to LinalgInterface.
Oleg Shyshkov [Tue, 27 Sep 2022 14:26:56 +0000 (14:26 +0000)]
[mlir][linalg] Add getIteratorTypesArray to LinalgInterface.

Summary:
Most of the code that gets `iterator_types` from LinalgInterface is forced to
extract values from an `Attribute`. As a result, the usage pattern looks like
this:

```
SmallVector<StringRef> iterators = llvm::to_vector<4>(linalgOp.iterator_types().getAsValueRange<StringAttr>());
```

It also forces all operations that implement LinalgOp interface to have
`iterator_types` attribute even when the information can be easily infered from
other parameters.

In perfect future, `getIteratorTypeArray` should be the only method to get
iterator types from the interface. The default implementation can rely on
`iterator_types` attribute though.

The name `getIteratorTypeArray` was picked to be consistent with existing
`getIndexingMapsArray`.

This patch add a few sample usages. More cleanups will follow.

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

21 months ago[LV] Adjust cost model to use uniform store lowering for unpredicated uniform stores
Philip Reames [Tue, 27 Sep 2022 14:22:41 +0000 (07:22 -0700)]
[LV] Adjust cost model to use uniform store lowering for unpredicated uniform stores

Follow up to D133580; adjust the cost model to prefer uniform store lowering for scalable stores which are unpredicated.

The impact here isn't in the uniform store lowering quality itself. InstCombine happily converts the scatter form into the single store form. The main impact is in letting the rest of the cost model make choices based on the knowledge that the vector will be scalarized on use.

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

21 months agoFix 'unused-lambda-capture' gcc warning. NFCI.
Simon Pilgrim [Tue, 27 Sep 2022 14:15:43 +0000 (15:15 +0100)]
Fix 'unused-lambda-capture' gcc warning. NFCI.

21 months ago[SLP] Add ScalarizationOverheadBuilder helper to track vector extractions
Simon Pilgrim [Tue, 27 Sep 2022 13:48:59 +0000 (14:48 +0100)]
[SLP] Add ScalarizationOverheadBuilder helper to track vector extractions

Instead of accumulating all extraction costs separately and then adjusting for repeated subvector extractions, this patch collects all the extractions and then converts to calls to getScalarizationOverhead to improve the accuracy of the costs.

I'm not entirely satisfied with the getExtractWithExtendCost handling yet - this still just adds all the getExtractWithExtendCost costs together - it really needs to be replaced with a "getScalarizationOverheadWithExtend", but that will require further refactoring first.

This replaces my initial attempt in D124769.

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

21 months agoFix regression from Deferred Concepts with lambda in var init
Erich Keane [Mon, 26 Sep 2022 18:02:39 +0000 (11:02 -0700)]
Fix regression from Deferred Concepts with lambda in var init

As reported in GH #57945, this would crash because the decl context for
the lambda was being loaded via 'getNonClosureContext', which only gets
CODE contexts, so a global lambda was getting 'nullptr' here instead.
This patch does some work to make sure we get a valid/valuable
declcontext here instead.

21 months ago[lldb][test] Remove failing ValueCheck on deprecated libcxx entity
Michael Buch [Tue, 27 Sep 2022 10:40:13 +0000 (11:40 +0100)]
[lldb][test] Remove failing ValueCheck on deprecated libcxx entity

A recent libcxx change renamed all internal variables starting with
`__`. As such, `std::reverse_iterator::__t` was renamed to
`std::reverse_iterator::__t_`. This breaks the `import-std-module`
tests with newer libcxx versions. Since this variable is deprecated
in libcxx anyway, this patch simply removes the explicit `ValueCheck`
on the variable name. We don't lose any interesting test-case here
since the purpose of the test is to see if we can call functions
from the `std` module.

We can now re-enable the tests on Darwin for all buildbot Clang
compiler variants.

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

21 months ago[lldb][test] Disable TestSBValueUnsignedEnumBitField.py for old DWARF versions
Michael Buch [Tue, 27 Sep 2022 13:00:24 +0000 (14:00 +0100)]
[lldb][test] Disable TestSBValueUnsignedEnumBitField.py for old DWARF versions

With older DWARF versions we don't encode the enum's underlying
type in DWARF. In those cases LLDB sign-extends the bitfield as
a signed integer. Without the actual enum type being present in
DWARF there's not much we can do.

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

21 months ago[DAG] select Cond, -1, C --> or (sext Cond), C if Cond is MVT::i1
Amaury Séchet [Fri, 5 Aug 2022 13:33:07 +0000 (13:33 +0000)]
[DAG] select Cond, -1, C --> or (sext Cond), C if Cond is MVT::i1

This seems to be beneficial overall, except for midpoint-int.ll .

The X86 backend seems to generate zeroing that are not necesary.

Reviewed By: shchenz

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

21 months ago[LoongArch] Add some comments for expand pseudo-inst pass. NFC
wanglei [Tue, 27 Sep 2022 11:03:18 +0000 (19:03 +0800)]
[LoongArch] Add some comments for expand pseudo-inst pass. NFC

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

21 months ago[ADT] Add IntervalTree - light tree data structure to hold intervals.
Carlos Alberto Enciso [Tue, 27 Sep 2022 11:48:44 +0000 (12:48 +0100)]
[ADT] Add IntervalTree - light tree data structure to hold intervals.

Fix build failure in:

  https://lab.llvm.org/buildbot/#/builders/36/builds/25424
  error: comparison of integers of different signs:
  'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

  Reviewed By: Orlando

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

21 months ago[VE] Change to expand FPOW
Kazushi (Jam) Marukawa [Mon, 26 Sep 2022 23:36:02 +0000 (08:36 +0900)]
[VE] Change to expand FPOW

VE doesn't have FPOW instruction, so this patch makes llvm expand it.

Reviewed By: efocht

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

21 months ago[LoongArch] Support lowering frames larger than 2048 bytes
WANG Xuerui [Tue, 27 Sep 2022 09:50:14 +0000 (17:50 +0800)]
[LoongArch] Support lowering frames larger than 2048 bytes

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

21 months ago[mlir] Refactor transform dialect's gpu block func
Guray Ozen [Tue, 27 Sep 2022 10:23:18 +0000 (12:23 +0200)]
[mlir] Refactor transform dialect's gpu block func

This revision refactors gpu block id generator lambda that is used in the transform dialect. It removes the lambda  and instead uses a static function that's name generateGpuBlockIds.

It also simplifies arguments that the function takes.

Reviewed By: nicolasvasilache

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

21 months ago[lldb] Improve display of absolute symbol lookup
Alvin Wong [Tue, 27 Sep 2022 10:09:59 +0000 (13:09 +0300)]
[lldb] Improve display of absolute symbol lookup

When running `target module lookup` command, show the name of absolute
symbols. Also fix indentation issue after printing an absolute symbol.

Reviewed By: clayborg, DavidSpickett

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

21 months ago[lldb] Add newline in output of `target modules lookup`
Alvin Wong [Tue, 27 Sep 2022 10:09:45 +0000 (13:09 +0300)]
[lldb] Add newline in output of `target modules lookup`

This adds a line break between each result address in the output of the
lldb command `target modules lookup`. Before this change, a new address
result will be printed on the same line as the summary of the last
result, making the output difficult to view.

Also adds a test for this command.

Reviewed By: labath

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

21 months ago[X86] Clean up prefixes for avoid-sfb.ll
Simon Pilgrim [Tue, 27 Sep 2022 10:01:17 +0000 (11:01 +0100)]
[X86] Clean up prefixes for avoid-sfb.ll

Simplifies the diff for D134697

21 months ago[LSR] Preserve LCSSA in expander when rewriting loop exit values.
Florian Hahn [Tue, 27 Sep 2022 08:58:48 +0000 (09:58 +0100)]
[LSR] Preserve LCSSA in expander when rewriting loop exit values.

The expanded values when rewriting exit values need to preserve LCSSA.
Ask SCEVExpander to preserve LCSSA to ensure that.

Fixes #58007.

21 months ago[BasicAA] Use ScopeExit to clear Visited set (NFC)
Nikita Popov [Tue, 27 Sep 2022 08:25:58 +0000 (10:25 +0200)]
[BasicAA] Use ScopeExit to clear Visited set (NFC)

21 months ago[AArch64] Add all predecessor archs in target info
Daniel Kiss [Tue, 27 Sep 2022 08:22:20 +0000 (10:22 +0200)]
[AArch64] Add all predecessor archs in target info

A given function is compatible with all previous arch versions.
To avoid compering values of the attribute this logic adds all predecessor
architecture values.

Reviewed By: dmgreen, DavidSpickett

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

21 months ago[FunctionAttrs] Infer precise FMRB
Nikita Popov [Fri, 23 Sep 2022 11:03:59 +0000 (13:03 +0200)]
[FunctionAttrs] Infer precise FMRB

This updates checkFunctionMemoryAccess() to infer a precise
FunctionModRefBehavior, rather than an approximation split into
read/write and argmemonly.

Afterwards, we still map this back to imprecise function attributes.
This still allows us to infer some cases that we previously did not
handle, namely inaccessiblememonly and inaccessiblemem_or_argmemonly.
In practice, this means we get better memory attributes in the
presence of intrinsics like @llvm.assume.

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

21 months ago[libcxx] Support LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY + LIBCXX_ENABLE_ABI_LIN...
Nikita Popov [Mon, 26 Sep 2022 13:42:35 +0000 (15:42 +0200)]
[libcxx] Support LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY + LIBCXX_ENABLE_ABI_LINKER_SCRIPT

Currently if both LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY (only
applies to static library) and LIBCXX_ENABLE_ABI_LINKER_SCRIPT (only
applies to shared library) are enabled, the former will be silently
ignored. The shared library will use a linker script, while the
static library fails to link libc++abi.a entirely.

This is caused by what appears to be an implementation bug: The
LIBCXX_STATICALLY_LINK_ABI_IN_*_LIBRARY options are declared as
dependent options of LIBCXX_ENABLE_STATIC_ABI_LIBRARY, rather than
simply using it as the default value.

Of course, the combination of
LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY and
LIBCXX_ENABLE_ABI_LINKER_SCRIPT still results in a cmake error,
because these would be conflicting requests for the shared library.

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

21 months ago[AArch64] Add Neoverse V2 CPU support
David Sherwood [Thu, 15 Sep 2022 12:18:14 +0000 (12:18 +0000)]
[AArch64] Add Neoverse V2 CPU support

Adds support for the Neoverse V2 CPU to the AArch64 backend.

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

21 months ago[LoopUnroll] Forget block and loop dispositions during unrolling.
Florian Hahn [Tue, 27 Sep 2022 07:47:19 +0000 (08:47 +0100)]
[LoopUnroll] Forget block and loop dispositions during unrolling.

After unrolling a loop, the block and loop dispositions need to be
cleared. As we don't know which SCEVs in the loop/blocks may be
impacted, completely clear the cache. This should also fix some cases
where deleted loops remained in the LoopDispositions cache.

This fixes a verification failure surfaced by D134531.

I am planning on reviewing/updating the existing uses of
forgetLoopDispositions to check if they should be replaced by
forgetBlockAndLoopDispositions.

Reviewed By: nikic

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