platform/upstream/llvm.git
16 months ago[BOLT] Robustify compile-time config check
Nathan Sidwell [Wed, 19 Apr 2023 20:07:25 +0000 (16:07 -0400)]
[BOLT] Robustify compile-time config check

The BOLT runtime is specifically hard coded for x86_64 linux or x86_64
darwin. (Using x86_64 syscalls, hardcoding syscall numbers.)

Make it very clear this is for those specific pair of systems.

Reviewed By: rafauler

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

16 months ago[SystemZ][z/OS] Make LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL available for external...
Zibi Sarbinowski [Fri, 21 Apr 2023 16:29:36 +0000 (11:29 -0500)]
[SystemZ][z/OS] Make LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL available for external unwind library.

On z/OS, we need to pass the location of unwind interface header when building cxxabi. The cmake macro `LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL` is available for this purpose but it is only used with conjunction with `LIBCXXABI_USE_LLVM_UNWINDER`. For the external unwind library we need to use LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL unconditionally whenever it is set.

Reviewed By: #libc_abi, muiez, phosek, SeanP

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

16 months ago[mlir][sparse][gpu] generate proper memcpy in/out host and device
Aart Bik [Wed, 19 Apr 2023 03:56:41 +0000 (20:56 -0700)]
[mlir][sparse][gpu] generate proper memcpy in/out host and device

The host registration is a convenient way to get CUDA kernels
running, but it may be slow and does not work for all buffer
(like global constants). This revision uses the proper alloc
copy dealloc chains for buffers, using asynchronous chains
to increase overlap. The host registration mechanism is
kept under a flag for the output, just for experimentation
purposes while this project ramps up.

Reviewed By: Peiming

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

16 months ago[SLP]Fix the cost for the extractelements, used in several nodes.
Alexey Bataev [Thu, 20 Apr 2023 14:11:48 +0000 (07:11 -0700)]
[SLP]Fix the cost for the extractelements, used in several nodes.

Currently the compiler calculates the compensation cost for the
extractelements, removed during vectorization. But if the extractelement
instruction is used in several nodes, we can calculate the compensation
for them several times.

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

16 months ago[LV][IndVars] Move test to correct directory and regenerate (NFC)
Nikita Popov [Fri, 21 Apr 2023 16:02:29 +0000 (18:02 +0200)]
[LV][IndVars] Move test to correct directory and regenerate (NFC)

For some reason, an IndVarSimplify test was in the LoopVectorize
directory.

16 months ago[gn build] Port 6c9066fe2ecc
LLVM GN Syncbot [Fri, 21 Apr 2023 15:51:37 +0000 (15:51 +0000)]
[gn build] Port 6c9066fe2ecc

16 months ago[CMake][AIX] Fixing AIX rpath
Qiongsi Wu [Fri, 21 Apr 2023 15:31:46 +0000 (11:31 -0400)]
[CMake][AIX] Fixing AIX rpath

Recent commit https://github.com/llvm/llvm-project/commit/8f833f88ab78265a8e0ebb0d1522771d67c708a9 modified the installation rpath and did not set `BUILD_WITH_INSTALL_RPATH` correctly on AIX, which led to installation failures on AIX. This patch sets `BUILD_WITH_INSTALL_RPATH` on AIX to fix the installation failures.

Reviewed By: buttaface, daltenty

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

16 months ago[Matrix] Handle integer types when distributing transposes across adds.
Florian Hahn [Fri, 21 Apr 2023 15:35:11 +0000 (16:35 +0100)]
[Matrix] Handle integer types when distributing transposes across adds.

The current code did not properly account for integer matrixes. Check
if the operands are floating point or integer matrixes and use FAdd/Add
accordingly.

This is already done for other cases, like multiplies.

Fixes #62281.

16 months agoMake diagnostics API safer to use
Adrian Prantl [Fri, 21 Apr 2023 15:20:39 +0000 (08:20 -0700)]
Make diagnostics API safer to use

I received a crash report in DiagnosticManager that was caused by a
nullptr diagnostic having been added. The API allows passing in a null
unique_ptr, but all the methods are written assuming that all pointers
a dereferencable. This patch makes it impossible to add a null
diagnostic.

rdar://107633615

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

16 months agoRecommit "[AArch64] Fix incorrect `isLegalAddressingMode`"
Momchil Velikov [Fri, 21 Apr 2023 14:27:36 +0000 (15:27 +0100)]
Recommit "[AArch64] Fix incorrect `isLegalAddressingMode`"

This patch recommits 0827e2fa3fd15b49fd2d0fc676753f11abb60cab after
reverting it in ed7ada259f665a742561b88e9e6c078e9ea85224.  Added
workround for `Targetlowering::AddrMode` no longer being an aggregate
in C++20.

`AArch64TargetLowering::isLegalAddressingMode` has a number of
defects, including accepting an addressing mode, which consists of
only an immediate operand, or not checking the offset range for an
addressing mode in the form `1*ScaledReg + Offs`.

This patch fixes the above issues.

Reviewed By: dmgreen

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

Change-Id: I41a520c13ce21da503ca45019979bfceb8b648fa

16 months ago[AArch64] Fix crash caused by performExtractVectorEltCombine on DUP nodes with float...
Zain Jaffal [Fri, 21 Apr 2023 15:20:03 +0000 (16:20 +0100)]
[AArch64] Fix crash caused by performExtractVectorEltCombine on DUP nodes with float operands.

Reviewed By: dmgreen

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

16 months ago[SLP]Fix a crash on scalarized vectors.
Alexey Bataev [Fri, 21 Apr 2023 14:44:36 +0000 (07:44 -0700)]
[SLP]Fix a crash on scalarized vectors.

Need to register in-vector for scalarized types to avoid crash in
further analysis.

16 months ago[ConstraintElim] Fix integer overflow in ConstraintSystem::negate.
Florian Hahn [Fri, 21 Apr 2023 15:09:46 +0000 (16:09 +0100)]
[ConstraintElim] Fix integer overflow in ConstraintSystem::negate.

This fixes another integer overflow that was exposed by a variant of the
test case from #62226.

16 months ago[CostModel][X86] Add i64 MUL latency/codesize/size-latency cost estimates
Simon Pilgrim [Fri, 21 Apr 2023 14:55:22 +0000 (15:55 +0100)]
[CostModel][X86] Add i64 MUL latency/codesize/size-latency cost estimates

16 months ago[CostModel][X86] Add i32 MUL latency/codesize/size-latency cost estimates
Simon Pilgrim [Fri, 21 Apr 2023 12:28:07 +0000 (13:28 +0100)]
[CostModel][X86] Add i32 MUL latency/codesize/size-latency cost estimates

16 months ago[CostModel][X86] Improve i16 and vXi16 MUL costs
Simon Pilgrim [Fri, 21 Apr 2023 09:31:24 +0000 (10:31 +0100)]
[CostModel][X86] Improve i16 and vXi16 MUL costs

Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates

16 months ago[lldb] Update QEMU git URL in setup.sh
David Spickett [Fri, 21 Apr 2023 14:30:51 +0000 (14:30 +0000)]
[lldb] Update QEMU git URL in setup.sh

The old name was maintained for a while but now it has been changed
to gitlab.

16 months ago[tests] Add missing REQUIRES: aarch64-registered-target to llvm-lib test
Jacek Caban [Fri, 21 Apr 2023 14:27:05 +0000 (17:27 +0300)]
[tests] Add missing REQUIRES: aarch64-registered-target to llvm-lib test

Fixes Buildbot failures introduced by eb56ef3edd9f1d21e625f0158dfc4edc48bd7349 and 85a2c50ec4979b87267e4f2068f2921beb0b98f2.

Reviewed By: TWeaver

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

16 months ago[llvm-exegesis][AArch64] Only run tests on aarch64 hosts
Tom Stellard [Fri, 21 Apr 2023 14:17:49 +0000 (07:17 -0700)]
[llvm-exegesis][AArch64] Only run tests on aarch64 hosts

The add-return.s test is failing on s390x.

See also e30ce634f75c01cc8784cb0c4972c42987178c1d.

Reviewed By: courbet

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

16 months ago[SLP][NFC]Make computeExtractCost a member of ShuffleCostEstimator, NFC.
Alexey Bataev [Thu, 20 Apr 2023 18:48:44 +0000 (11:48 -0700)]
[SLP][NFC]Make computeExtractCost a member of ShuffleCostEstimator, NFC.

Moved computeExtractCost to ShuffleCostEstimator class as another step
for unifying actual codegen/cost estimation for buildvectors.

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

16 months ago[asan][test][win] Fix demangled_names test on MSVC target
Alvin Wong [Fri, 21 Apr 2023 13:46:58 +0000 (21:46 +0800)]
[asan][test][win] Fix demangled_names test on MSVC target

Fix error with b5e3d131f9ed6687cacffb67de8f54214dd8d2b3 (D147444).

16 months ago[coroutine] Salvage dbg.values in the original function as well
Felipe de Azevedo Piovezan [Wed, 19 Apr 2023 13:04:54 +0000 (09:04 -0400)]
[coroutine] Salvage dbg.values in the original function as well

D97673 implemented salvaging o dbg.value inside coroutine funclets, but
left the original function untouched. Before, only dbg.addr and dbg.decl
would get salvaged.

D121324 implemented salvaging of dbg.addr and dbg.decl in the original
function as well, but not of dbg.values.

This patch unifies salvaging in the original function and related
funclets, so that all intrinsics are salvaged in all functions. This is
particularly useful for ABIs where the original function is also
rewritten to receive the frame pointer as an argument.

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

16 months ago[SCEV] Clarify inference in isAddRecNeverPoison()
Nikita Popov [Tue, 18 Apr 2023 10:33:58 +0000 (12:33 +0200)]
[SCEV] Clarify inference in isAddRecNeverPoison()

The justification in isAddRecNeverPoison() no longer applies, as
it dates back to a time where LLVM had an unconditional forward
progress guarantee. However, we also no longer need it, because we
can exploit branch on poison UB instead.

For a single exit loop (without abnormal exits) we know that all
instructions dominating the exit will be executed, so if any of
them trigger UB on poison that means that addrec is not poison.

This is slightly stronger than the previous code, because a) we
don't need the exit to also be the latch and b) we don't need the
value to be used in the exit branch in particular, any UB-producing
instruction is fine.

I don't expect much practical impact from this change, this is
mainly to clarify the reasoning behind this logic.

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

16 months agoAvoid capping heap to stack optimization for __kmpc_alloc_shared allocations.
Doru Bercea [Thu, 20 Apr 2023 20:54:46 +0000 (16:54 -0400)]
Avoid capping heap to stack optimization for __kmpc_alloc_shared allocations.

Review: https://reviews.llvm.org/D148849

16 months ago[asan][test][win] Port more tests to not use clang-cl on MinGW
Alvin Wong [Mon, 3 Apr 2023 14:50:14 +0000 (22:50 +0800)]
[asan][test][win] Port more tests to not use clang-cl on MinGW

Depends on D147432

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

16 months ago[asan][test][win] Port trivial tests to not use clang-cl on MinGW
Alvin Wong [Mon, 3 Apr 2023 08:37:31 +0000 (16:37 +0800)]
[asan][test][win] Port trivial tests to not use clang-cl on MinGW

Use clang driver on MinGW where clang-cl is not usable. MSVC target
still uses clang-cl to minimize changes to existing test runners.

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

16 months agoRevert "[ConstantFolding] Fix crash when folding vector llvm.is.fpclass"
Jay Foad [Fri, 21 Apr 2023 12:59:13 +0000 (13:59 +0100)]
Revert "[ConstantFolding] Fix crash when folding vector llvm.is.fpclass"

This reverts commit 5fc6425fb6c77052a26cf0cf7b886449fabe1af4.

It is reported to cause other crashes that require a larger fix.

16 months ago[llvm-lib] [llvm-readobj] [llvm-cvtres] Add Support for ARM64X object files.
Jacek Caban [Fri, 21 Apr 2023 12:32:07 +0000 (15:32 +0300)]
[llvm-lib] [llvm-readobj] [llvm-cvtres] Add Support for ARM64X object files.

Similar to D125411, but for ARM64X.

ARM64X PE binaries are hybrids containing both ARM64EC and pure ARM64
variants in one file. They are usually linked by passing separate
ARM64EC and ARM64 object files to linker. Linked binaries use ARM64
machine and contain additional CHPE metadata in their load config.
CHPE metadata support is not part of this patch, I plan to send that later.

Using ARM64X as a machine type of object files themselves is somewhat
ambiguous, but such files are allowed by MSVC. It treats them as ARM64
or ARM64EC object, depending on the context. Such objects can be
produced with cvtres.exe -machine:arm64x.

Reviewed By: efriedma

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

16 months ago[llvm-nm] Print EC symbol map.
Jacek Caban [Fri, 21 Apr 2023 12:31:54 +0000 (15:31 +0300)]
[llvm-nm] Print EC symbol map.

This is useful for examining ARM64EC static libraries and allows
better llvm-lib testing. Changes to Archive class will also be
useful for LLD to support ARM64EC, where it will need to use one
map or the other, depending on linking target (or both, in case of
ARM64X, but separately as they are in different namespaces).

Reviewed By: jhenderson, efriedma

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

16 months ago[llvm-lib] Add support for ARM64EC libraries.
Jacek Caban [Fri, 21 Apr 2023 12:31:21 +0000 (15:31 +0300)]
[llvm-lib] Add support for ARM64EC libraries.

ARM64EC allows having both pure ARM64 objects and ARM64EC in the
same archive. This allows using single static library for linking
pure ARM64, pure ARM64EC or mixed modules (what MS calls ARM64X:
a single module that may be used in both modes). To achieve that,
such static libraries need two separated symbol maps. The usual map
contains only pure ARM64 symbols, while a new /<ECSYMBOLS>/ section
contains EC symbols. EC symbols map has very similar format to the
usual map, except it doesn't contain object offsets and uses offsets
from regular map instead. This is true even for pure ARM64EC static
library: it will simply have 0 symbols in the symbol map.

Reviewed By: efriedma

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

16 months ago[BasicBlockUtils][NFCI] Extract branch inverting to a separate method
Max Kazantsev [Fri, 21 Apr 2023 12:06:06 +0000 (19:06 +0700)]
[BasicBlockUtils][NFCI] Extract branch inverting to a separate method

The motivation is to make possible branch inverting code reuse.

Patch by Aleksandr Popov!

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

16 months ago[libc++] Fix likely rebase conflict that was not resolved properly
Louis Dionne [Fri, 21 Apr 2023 12:37:35 +0000 (08:37 -0400)]
[libc++] Fix likely rebase conflict that was not resolved properly

16 months ago[LoopLoadElimination] Preserve DT and LI (NFCI)
Nikita Popov [Fri, 21 Apr 2023 12:31:59 +0000 (14:31 +0200)]
[LoopLoadElimination] Preserve DT and LI (NFCI)

This pass makes control-flow changes, but only via LoopSimplify
and LoopVersioning utilities, which perserve DT and LI.

16 months agoValueTracking: Recognize >=, <= compares with 0 as is.fpclass masks
Matt Arsenault [Wed, 19 Apr 2023 22:51:11 +0000 (18:51 -0400)]
ValueTracking: Recognize >=, <= compares with 0 as is.fpclass masks

Leave DAZ handling for a future change.

16 months agoInstCombine: Add some baseline tests for recognizing fcmp as is.fpclass
Matt Arsenault [Wed, 19 Apr 2023 23:08:29 +0000 (19:08 -0400)]
InstCombine: Add some baseline tests for recognizing fcmp as is.fpclass

We should be able to recognize > 0, < 0 indicates the sign.

16 months agoRevert "Reland [Modules] Remove unnecessary check when generating name lookup table...
Ilya Biryukov [Fri, 21 Apr 2023 11:49:27 +0000 (13:49 +0200)]
Revert "Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter"

This reverts commit 67b298f6d82e0b4bb648ac0dabe895e816a77ef1.

We got linker errors with undefined symbols during a compiler release
and tracked it down to this change. I am in the process of understanding
what is happening and getting a reproducer.

Sorry for reverting this again.

I will reopen #61065 until we fix this.

16 months ago[clang-format] Fix dropped 'else'.
Manuel Klimek [Fri, 21 Apr 2023 11:56:37 +0000 (11:56 +0000)]
[clang-format] Fix dropped 'else'.

'else' was dropped accidentally in 398cddf6acec.

Patch by Jared Grubb.

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

16 months ago[LLDB] Don't print register fields when asked for a specific format
David Spickett [Thu, 20 Apr 2023 10:07:21 +0000 (10:07 +0000)]
[LLDB] Don't print register fields when asked for a specific format

Previously if a register had fields we would always print them after the
value if the register was asked for by name.
```
(lldb) register read MDCR_EL3
MDCR_EL3 = 0x00000000
         = {
             ETBAD = 0
<...>
             RLTE = 0
           }
```
This can be quite annoying if there are a whole lot of fields but you
want to see the register in a specific format.
```
(lldb) register read MDCR_EL3 -f i
MDCR_EL3 = 0x00000000   unknown     udf    #0x0
         = {
             ETBAD = 0
<...lots of fields...>
```
Since it pushes the interesting bit far up the terminal. To solve this,
don't print fields if the user passes --format. If they're doing that
then I think it's reasonable to assume they know what they want and only
want to see that output.

This also gives users a way to silence fields, but not change the format.
By doing `register read foo -f x`. In case they are not useful or perhaps
they are trying to work around a crash.

I have customised the help text for --format for register read to explain this:
```
-f <format> ( --format <format> )
     Specify a format to be used for display. If this is set, register fields will not be dispayed.
```

Reviewed By: jasonmolenda

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

16 months ago[clang] trigger -Wcast-qual on functional casts
Jorge Pinto Sousa [Fri, 21 Apr 2023 11:45:05 +0000 (07:45 -0400)]
[clang] trigger -Wcast-qual on functional casts

-Wcast-qual does not trigger on the following code in Clang, but does
in GCC.

const auto i = 42;
using T = int*;
auto p = T(&i);

The expected behavior is that a functional cast should trigger
the warning the same as the equivalent C cast because
the meaning is the same, and nothing about the functional cast
makes it easier to recognize that a const_cast is occurring.

Fixes https://github.com/llvm/llvm-project/issues/62083
Differential Revision: https://reviews.llvm.org/D148276

16 months ago[X86][FastISel] Handle CRC32 intrinsics
Alexis Engelke [Fri, 10 Mar 2023 11:26:10 +0000 (12:26 +0100)]
[X86][FastISel] Handle CRC32 intrinsics

Some applications make heavy use of the crc32 operation (e.g., as part
of a hash function), so having a FastISel path avoids fallbacks to
SelectionDAG and improves compile times, in our case by ~1.5%.

Reviewed By: pengfei

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

16 months ago[IRCE] Support non-strict range check's predicate
Max Kazantsev [Fri, 21 Apr 2023 10:58:16 +0000 (17:58 +0700)]
[IRCE] Support non-strict range check's predicate

Patch by Aleksandr Popov!

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

16 months ago[Pipelines] Don't explicitly require ORE
Nikita Popov [Fri, 21 Apr 2023 11:15:15 +0000 (13:15 +0200)]
[Pipelines] Don't explicitly require ORE

LICM does not use ORE from the pass manager, it constructs its
own instance. As such, explicitly requiring the analysis in the
pipeline is unnecessary.

16 months ago[libc++] Use $CXX instead of 'c++' in run-buildbot
Louis Dionne [Thu, 20 Apr 2023 19:06:41 +0000 (15:06 -0400)]
[libc++] Use $CXX instead of 'c++' in run-buildbot

We don't have `c++` anymore in the Docker image, but the script does
require $CXX to be in the environment so that should always work.

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

16 months agoValueTracking: Add baseline tests for fma computeKnownFPClass
Matt Arsenault [Mon, 17 Apr 2023 18:48:50 +0000 (14:48 -0400)]
ValueTracking: Add baseline tests for fma computeKnownFPClass

16 months agoValueTracking: Add tests for fneg/fabs computeKnownFPClass
Matt Arsenault [Wed, 19 Apr 2023 13:25:00 +0000 (09:25 -0400)]
ValueTracking: Add tests for fneg/fabs computeKnownFPClass

16 months agoValueTracking: Implement computeKnownFPClass for fpext
Matt Arsenault [Mon, 10 Apr 2023 02:18:03 +0000 (22:18 -0400)]
ValueTracking: Implement computeKnownFPClass for fpext

16 months ago[Pipelines] Don't request BFI in LICM-only loop pass adaptors
Nikita Popov [Fri, 21 Apr 2023 10:55:12 +0000 (12:55 +0200)]
[Pipelines] Don't request BFI in LICM-only loop pass adaptors

LICM doesn't use BFI anymore, so requesting BFI in these loop
pass adaptors is just a waste of compile-time.

16 months ago[NewGVN] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 21 Apr 2023 10:42:22 +0000 (12:42 +0200)]
[NewGVN] Convert tests to opaque pointers (NFC)

16 months ago[NewGVN] Regenerate test checks (NFC)
Nikita Popov [Fri, 21 Apr 2023 10:40:36 +0000 (12:40 +0200)]
[NewGVN] Regenerate test checks (NFC)

16 months ago[IRCE][NFCI] Refactor parseRangeCheckICmp
Max Kazantsev [Fri, 21 Apr 2023 10:16:59 +0000 (17:16 +0700)]
[IRCE][NFCI] Refactor parseRangeCheckICmp

Simplify parseRangeCheckICmp:
- If RHS is loop-variant, swap LHS/RHS and swap predicate
- all checks are either IV >(=) const or IV <(=) RHS (maybe not const)

Patch by Aleksandr Popov!

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

16 months ago[CodeGen] Enable AArch64 SVE FCMLA/FCADD instruction generation in ComplexDeinterleaving
Igor Kirillov [Mon, 3 Apr 2023 16:22:01 +0000 (16:22 +0000)]
[CodeGen] Enable AArch64 SVE FCMLA/FCADD instruction generation in ComplexDeinterleaving

This commit adds support for scalable vector types in theComplexDeinterleaving
pass, allowing it to recognize and handle `llvm.vector.interleave2` and
`llvm.vector.deinterleave2` intrinsics for both fixed and scalable vectors

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

16 months ago[FlattenCFG] Replace branch condition with a created one correctly
Max Kazantsev [Fri, 21 Apr 2023 09:49:18 +0000 (16:49 +0700)]
[FlattenCFG] Replace branch condition with a created one correctly

Fix case when FlattenCFGOpt combines the conditions but doesn't update
branch with a new combined condition. It happens when one of the
combinable condition is inverted and has more then 1 user

Patch by Aleksandr Popov!

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

16 months ago[FlattenCFG] Add a test to demonstrate bug
Max Kazantsev [Fri, 21 Apr 2023 09:41:51 +0000 (16:41 +0700)]
[FlattenCFG] Add a test to demonstrate bug

FlattenCFGOpt combines the conditions but doesn't update branch with a
new combined condition. It happens when one of the combinable condition
is inverted and has more then 1 user.

Patch by Aleksandr Popov!

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

16 months ago[Coverity] Fix uninitialized scalar members in TableGen
Akshay Khadse [Fri, 21 Apr 2023 09:42:04 +0000 (17:42 +0800)]
[Coverity] Fix uninitialized scalar members in TableGen

This change fixes static code analysis warnings

Reviewed By: skan

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

16 months ago[libc++][PSTL] Copy the headers into libc++
Nikolas Klauser [Fri, 13 Jan 2023 17:48:17 +0000 (18:48 +0100)]
[libc++][PSTL] Copy the headers into libc++

We decided to integrate the PSTL into our own headers and only share the backend impletementations. This is a first step in that direction, specifically it copies the PSTL headers into the libc++ structure.

Reviewed By: ldionne, #libc

Spies: rodgert, mikhail.ramalho, jplehr, bcain, h-vetinari, Mordante, rarutyun, var-const, sstefan1, pcwang-thead, libcxx-commits, arichardson, mgrang, miyuki

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

16 months ago[X86][tablgen] Fix typo in comments, NFC
Shengchen Kan [Fri, 21 Apr 2023 09:20:00 +0000 (17:20 +0800)]
[X86][tablgen] Fix typo in comments, NFC

16 months ago[Test] Regenerate checks using update_test_checks.py
Max Kazantsev [Fri, 21 Apr 2023 08:54:19 +0000 (15:54 +0700)]
[Test] Regenerate checks using update_test_checks.py

16 months agoRevert "Reapply D146987 "[Assignment Tracking] Enable by default""
Carlos Alberto Enciso [Fri, 21 Apr 2023 08:11:40 +0000 (09:11 +0100)]
Revert "Reapply D146987 "[Assignment Tracking] Enable by default""

This reverts commit b74aeaccbae876ca348aa87a3db05d444052ae65.
Note: The author (Orlando) asked to revert this commit.

16 months ago[OpenMP] Replace libomp_check_linker_flag with llvm_check_compiler_linker_flag
Nikita Popov [Thu, 20 Apr 2023 12:59:27 +0000 (14:59 +0200)]
[OpenMP] Replace libomp_check_linker_flag with llvm_check_compiler_linker_flag

Replace the custom libomp_check_linker_flag() implementation with
llvm_check_compiler_linker_flag() from the common cmake utils. Due
to the way the custom implementation is implemented (capturing
output from an entire nested cmake invocation) it can easily end
up incorrectly detecting flags as unavailable, e.g. because "error",
"unknown" or similar occurs inside compiler flags, the directory
name, etc.

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

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

16 months ago[mlir][linalg] Refine `tensor.extract` vectorisation
Andrzej Warzynski [Wed, 12 Apr 2023 19:44:13 +0000 (12:44 -0700)]
[mlir][linalg] Refine `tensor.extract` vectorisation

This patch updates the vectorisation of the extract Op so that the
permutation map for the transfer_read Op is defined explicitly by the
vectoriser (as opposed to being constructed implicitly by the
transfer_read builder).

This change is needed for cases where the rank of the source tensor is
lower than the rank of the output vector generated by the vectoriser:
```mlir
    %17 = vector.transfer_read %arg1[%14, %16], %cst_4 {in_bounds = [true, true]} : tensor<257x24xf32>, vector<1x1x4xf32>
```
In cases like this, the vectorize will create the following permutation map:
```
  (d0, d1) -> (0, d0, d1)
```

In other cases the behaviour remains unchanged.

Fixes https://github.com/openxla/iree/issues/13036. That's also where
the test case was extracted from.

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

16 months ago[AMDGPU] Avoid using tuple where pair does suffice
Jay Foad [Fri, 21 Apr 2023 07:28:05 +0000 (08:28 +0100)]
[AMDGPU] Avoid using tuple where pair does suffice

Fixes the following building errors, happening with official Android prebuilt clang 14 shipped with Android 13:

external/llvm-project/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:5491:13: error: no viable constructor or deduction guide for deduction of template arguments of 'tuple'
          ? std::tuple(HSAMD::V3::AssemblerDirectiveBegin,
            ^
...
external/llvm-project/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:5493:13: error: no viable constructor or deduction guide for deduction of template arguments of 'tuple'
          : std::tuple(HSAMD::AssemblerDirectiveBegin,
            ^

Fixes: 6443c0e ("[AMDGPU] Stop using make_pair and make_tuple. NFC.")

Patch by Mauro Rossi!

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

16 months ago[OpenMP][AMDGPU] Refactor setting uniform work group size attribute
Dominik Adamski [Fri, 14 Apr 2023 19:04:35 +0000 (14:04 -0500)]
[OpenMP][AMDGPU] Refactor setting uniform work group size attribute

Work group size attribute was set in Clang specific class. That's why
we cannot reuse this code in Flang.

If we move setting of this attribute to OpenMPIRBuilder, then we can reuse this
code in Flang and Clang. Function createOffloadEntry from OpenMPIRBuilder is
already used by Clang (via OpenMPIRBuilder::createOffloadEntriesAndInfoMetadata
function).

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

Reviewed By: jdoerfert

16 months agoRevert "Fix handling of special and large vals in expand pattern for `round`" and...
Mehdi Amini [Fri, 21 Apr 2023 06:13:55 +0000 (00:13 -0600)]
Revert "Fix handling of special and large vals in expand pattern for `round`" and "Add pattern that expands `math.roundeven` into `math.round` + arith"

This reverts commit 8d2bae9abdc30e104bab00a4dd0f9d39f5bdda6e and
commit ab2fc9521ec606603412645d4a4b3cf456acd153.

Tests are broken on Mac M2

16 months ago[BreakFalseDeps] Respect dead blocks.
Serguei Katkov [Fri, 14 Apr 2023 07:05:03 +0000 (14:05 +0700)]
[BreakFalseDeps] Respect dead blocks.

The pass uses ReachingDefAnalysis which has no information about
instructions in dead blocks.
So do not process them.

Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D148329

16 months ago[RuntimeDyld] Disable some ppc64 tests on 32-bit architectures.
Lang Hames [Fri, 21 Apr 2023 04:47:49 +0000 (21:47 -0700)]
[RuntimeDyld] Disable some ppc64 tests on 32-bit architectures.

These tests have been failing on 32-bit machines.

https://github.com/llvm/llvm-project/issues/62184.

16 months ago[ORC-RT] Fix typo in include-guard comment.
Lang Hames [Fri, 21 Apr 2023 01:50:02 +0000 (18:50 -0700)]
[ORC-RT] Fix typo in include-guard comment.

16 months agoFix uninitialized scalar members in CodeGen
Akshay Khadse [Fri, 21 Apr 2023 04:22:28 +0000 (12:22 +0800)]
Fix uninitialized scalar members in CodeGen

This change fixes some static code analysis warnings.

Reviewed By: LuoYuanke

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

16 months ago[Attributor] Set up a dedicated simplification call back map for `GlobalVariable`
Shilei Tian [Fri, 21 Apr 2023 04:08:24 +0000 (00:08 -0400)]
[Attributor] Set up a dedicated simplification call back map for `GlobalVariable`

Currently we don't check call backs for global variable simplification.
What's more, the only way that we can register a simplification call back for
global variable is through its initializer (essentially a `Constant *`). It might
not correspond to the right global variable. In this patch, we set up a dedicated
simplification map for `GlobalVariable`.

Reviewed By: jdoerfert

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

16 months ago[lldb] Fix -Wctad-maybe-unsupported in PathMappingList.cpp (NFC)
Jie Fu [Fri, 21 Apr 2023 03:59:38 +0000 (11:59 +0800)]
[lldb] Fix -Wctad-maybe-unsupported in PathMappingList.cpp (NFC)

/home/jiefu/llvm-project/lldb/source/Target/PathMappingList.cpp:51:5: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
    std::scoped_lock locks(m_mutex, rhs.m_mutex);
    ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
    class scoped_lock
          ^
/home/jiefu/llvm-project/lldb/source/Target/PathMappingList.cpp:72:3: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
  std::scoped_lock locks(m_mutex, rhs.m_mutex);
  ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
    class scoped_lock
          ^
2 errors generated.

16 months ago[Coverity] Fix uninitialized scalar members
Akshay Khadse [Fri, 21 Apr 2023 03:41:42 +0000 (11:41 +0800)]
[Coverity] Fix uninitialized scalar members

This change fixes static code analysis errors

Reviewed By: LuoYuanke

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

16 months ago[gn build] Port c847b8e24cfd
LLVM GN Syncbot [Fri, 21 Apr 2023 03:37:17 +0000 (03:37 +0000)]
[gn build] Port c847b8e24cfd

16 months ago[libc++] Make bsd_locale_fallbacks.h modular and move it into __locale/locale_base_api/
Nikolas Klauser [Sat, 4 Mar 2023 01:37:37 +0000 (02:37 +0100)]
[libc++] Make bsd_locale_fallbacks.h modular and move it into __locale/locale_base_api/

This is a first step towards granularizing `<locale>`.

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, mikhail.ramalho

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

16 months ago[libc] Another fix to add a null-terminator to the pthread name.
Siva Chandra Reddy [Fri, 21 Apr 2023 03:29:36 +0000 (03:29 +0000)]
[libc] Another fix to add a null-terminator to the pthread name.

This fix is similar to the one done in https://reviews.llvm.org/D148844.
This miss was caught by the risv64 builder.

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

16 months ago[libc++][PSTL] Remove current integration
Nikolas Klauser [Sun, 16 Apr 2023 20:31:25 +0000 (22:31 +0200)]
[libc++][PSTL] Remove current integration

We decided to go a different route. To make the switch easier, rip out the old integration first and build on a clean base.

Reviewed By: ldionne, #libc, #libc_abi

Spies: arichardson, libcxx-commits

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

16 months ago[dataflow] allow specifying path to dot with $GRAPHVIZ_DOT
Sam McCall [Fri, 21 Apr 2023 03:23:46 +0000 (05:23 +0200)]
[dataflow] allow specifying path to dot with $GRAPHVIZ_DOT

I'd like to use this in a CI system where it's easier to tell the
program about paths than manipulate $PATH.

16 months ago[doc] [C++20] [Modules] Document that the interfaces of header units is experimental
Chuanqi Xu [Fri, 21 Apr 2023 02:39:15 +0000 (10:39 +0800)]
[doc] [C++20] [Modules] Document that the interfaces of header units is experimental

Close https://github.com/llvm/llvm-project/issues/62241

In tooling group (SG15), it is still unclear how tools should support
header units. Add a warning in the documentation to avoid further
confusions.

16 months ago[Vector][NFC] Fix DEBUG_TYPE in LowerVectorTranspose.cpp
Diego Caballero [Fri, 21 Apr 2023 01:16:22 +0000 (01:16 +0000)]
[Vector][NFC] Fix DEBUG_TYPE in LowerVectorTranspose.cpp

Fix wrong debug type.

Reviewed By: hanchung

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

16 months ago[nfc][thinlto] Separate `selectCallee` legality from cutoffs
Mircea Trofin [Wed, 19 Apr 2023 23:39:03 +0000 (16:39 -0700)]
[nfc][thinlto] Separate `selectCallee` legality from cutoffs

This makes it easier to reuse the legality part for other import
policies that wouldn't use thresholds.

Importing un-inlinable functions is also legal, because they could be
further specialized in a context-specific way, without inlining.

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

16 months ago[Demangle] fix another test on windows
Nick Desaulniers [Fri, 21 Apr 2023 00:23:22 +0000 (17:23 -0700)]
[Demangle] fix another test on windows

Alan spotted another test failure that was a result of
https://reviews.llvm.org/D148546 when running expensive checks tests
locally on windows.

Reviewed By: ayzhao

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

16 months ago[CMake] Add llvm-lib to Clang bootstrap dependency for LTO builds on Windows
Igor Kudrin [Fri, 21 Apr 2023 00:02:17 +0000 (17:02 -0700)]
[CMake] Add llvm-lib to Clang bootstrap dependency for LTO builds on Windows

Without this dependency, it is possible that llvm-lib.exe will not be
built, in which case CMake will try to use lib.exe to build libraries,
but this tool cannot handle bitcode files.

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

16 months ago[Demangle] fix windows tests
Nick Desaulniers [Thu, 20 Apr 2023 22:59:10 +0000 (15:59 -0700)]
[Demangle] fix windows tests

My reland of https://reviews.llvm.org/D148546 has caused a few windows
demangler tests to fail when run with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON
on windows.

I have a sneaking suspicion that MSVC's
std::string_view::iterator::operator* may be missing a nullptr check.

Link: https://lab.llvm.org/buildbot/#/builders/42/builds/9723/steps/7/logs/stdio
Reviewed By: ayzhao

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

16 months ago[libc] Added checks to src and dest types in bit_cast
Mikhail R. Gadelha [Thu, 20 Apr 2023 23:30:23 +0000 (20:30 -0300)]
[libc] Added checks to src and dest types in bit_cast

This patch adds assertions to prevent the compilation when we try to
bit cast a type that is not trivially copyable when using
__builtin_bit_cast, or when we try to bit cast a type that is not
trivially copyable and trivially constructable when using memcpy.

Reviewed By: sivachandra

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

16 months ago[libc] Set minimum CUDA PTX feature to +ptx60
Joseph Huber [Thu, 20 Apr 2023 22:59:21 +0000 (17:59 -0500)]
[libc] Set minimum CUDA PTX feature to +ptx60

Summary:
The `+ptx` features correspond to the related CUDA version. We require a
certain set of features from the `ptxas` assembler, which is tied to the
CUDA version. Some of the ones set here were insufficient, so I am
simply setting a cutoff to the CUDA 9.0 release as the minimum. This
roughly corresponds to what should be required for sm_60 to be compiled
with the source.

16 months agoFix i1 vector reduction miscompilation
Sp00ph [Thu, 20 Apr 2023 22:26:49 +0000 (15:26 -0700)]
Fix i1 vector reduction miscompilation

Previously, `vecreduce_{and,or} vNi1` could lead to miscompilations because the legalizer first decides to `any_ext` the operand (which is correct for `vecreduce_{and,or}`) and then decides to use `vecreduce_u{min,max}` instead (for which `any_ext` is incorrect). This patch changes it so the `vecreduce_u{min,max}` operations use `sign_ext` instead of `any_ext`.

Issue: https://github.com/llvm/llvm-project/issues/62211

Reviewed By: craig.topper

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

16 months ago[mlir][openacc] Restrict types for acc.bounds operands to index or integer type
Valentin Clement [Thu, 20 Apr 2023 21:42:56 +0000 (14:42 -0700)]
[mlir][openacc] Restrict types for acc.bounds operands to index or integer type

Values in bounds are expected to have integer or index types. Enforce
this expectation by restricting the type to be IntOrIndex.

Reviewed By: razvanlupusoru

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

16 months ago[libc] Add null-terminator to the thread name obtained from the syscall.
Siva Chandra Reddy [Thu, 20 Apr 2023 21:30:36 +0000 (21:30 +0000)]
[libc] Add null-terminator to the thread name obtained from the syscall.

This bug was caught by the aarch64 full build builder.

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

16 months ago[lld-macho] Tweak the names we give to archive members
Jez Ng [Thu, 20 Apr 2023 21:23:36 +0000 (17:23 -0400)]
[lld-macho] Tweak the names we give to archive members

In particular, make it `foo.a(foo.o)$ARCHIVE_OFFSET`. The goal is to
make it more similar to both ld64 implementation, which uses the
`foo.a(foo.o)$MODULE_ID` format. We dump some of these names in LTO
code, so matching ld64's format is helpful. This format is also more
similar to LLD-ELF's, which is `foo.a(foo.o at $ARCHIVE_OFFSET)`.

Reviewed By: #lld-macho, oontvoo

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

16 months ago[mlir][sparse] fix crash when generating coiteration loop with compressed-hi DLT.
Peiming Liu [Thu, 20 Apr 2023 21:12:12 +0000 (21:12 +0000)]
[mlir][sparse] fix crash when generating coiteration loop with compressed-hi DLT.

Reviewed By: aartbik

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

16 months ago[RISCV][WIP] Use vsetvli x0, x0 in more cases.
Craig Topper [Thu, 20 Apr 2023 20:58:24 +0000 (13:58 -0700)]
[RISCV][WIP] Use vsetvli x0, x0 in more cases.

If the AVL is a virtual register defined by a vsetvli with the same
vlmax we need and the previous vsetvli we saw in the data flow also
has that vlmax, we can use the x0, x0 form when we insert a vsetvli.

Not only does this avoid an update of the VL physical register, but
it may allow doLocalPostpass to completely remove the inserted vsetvli
by rewriting the vtype of the previous vsetvli.

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

16 months ago[RISCV] Pre-commit test case for D148735. NFC
Craig Topper [Thu, 20 Apr 2023 20:58:19 +0000 (13:58 -0700)]
[RISCV] Pre-commit test case for D148735. NFC

16 months ago[flang] Relax two !DIR$ IGNORE_TKR error cases with descriptor arguments
Peter Klausler [Thu, 20 Apr 2023 19:07:09 +0000 (12:07 -0700)]
[flang] Relax two !DIR$ IGNORE_TKR error cases with descriptor arguments

Allow two currently erroneous cases of !DIR$ IGNORE_TKR errors: allocatable
and pointers, and IGNORE_TKR(R) on (other) arguments passed via descriptors.
Downgrade these cases to warnings when they appear in external interfaces,
since their implementations may well be in C.  But retain the error status
on these cases for module procedures, since the Fortran implementation
probably can't work.

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

16 months ago[mlir] Prevent implicit downcasting to interfaces
Rahul Kayaith [Sun, 16 Apr 2023 21:28:48 +0000 (17:28 -0400)]
[mlir] Prevent implicit downcasting to interfaces

Currently conversions to interfaces may happen implicitly (e.g.
`Attribute -> TypedAttr`), failing a runtime assert if the interface
isn't actually implemented. This change marks the `Interface(ValueT)`
constructor as explicit so that a cast is required.

Where it was straightforward to I adjusted code to not require casts,
otherwise I just made them explicit.

Depends on D148491, D148492

Reviewed By: rriddle

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

16 months ago[mlir] Make ElementsAttr inherit from TypedAttr
Rahul Kayaith [Sun, 16 Apr 2023 19:47:44 +0000 (15:47 -0400)]
[mlir] Make ElementsAttr inherit from TypedAttr

This allows implicit conversion from `ElementsAttr` to `TypedAttr`, but
required renaming the `ElementsAttr::getType()` interface method to
`getShapedType`.

Reviewed By: rriddle

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

16 months ago[mlir][arith] Add arith.constant materialization helper
Rahul Kayaith [Sun, 16 Apr 2023 21:26:03 +0000 (17:26 -0400)]
[mlir][arith] Add arith.constant materialization helper

This adds `arith::ConstantOp::materialize`, which builds a constant from
an attribute and type only if it would result in a valid op. This is
useful for dialect `materializeConstant` hooks, and allows for removing
the previous `Attribute, Type` builder which was only used during
materialization.

Reviewed By: rriddle

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

16 months ago[SLP][NFC]Add a test with an extra cost of the reused extractelement
Alexey Bataev [Thu, 20 Apr 2023 20:27:18 +0000 (13:27 -0700)]
[SLP][NFC]Add a test with an extra cost of the reused extractelement
instruction, NFC.

16 months agouse heap memory for position buffer allocated for PackOp.
Peiming Liu [Thu, 20 Apr 2023 17:42:19 +0000 (17:42 +0000)]
use heap memory for position buffer allocated for PackOp.

Reviewed By: aartbik

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

16 months agoAdd documentation for -Wwrite-strings
Aaron Ballman [Thu, 20 Apr 2023 20:11:42 +0000 (16:11 -0400)]
Add documentation for -Wwrite-strings

This is the first instance where we've really needed to add
documentation for a diagnostic group, but -Wwrite-strings really
deserves it.

This warning option changes the semantic behavior of code, so enabling
it can cause code to break (and disabling it can too). That's worth
calling out loudly in our documentation.

16 months ago[libc] Actually run integration tests.
Siva Chandra Reddy [Thu, 20 Apr 2023 07:47:31 +0000 (07:47 +0000)]
[libc] Actually run integration tests.

After the switch to `add_custom_target` to run integration tests, most
of them were not actually being run because of the difference in the way
the COMMAND value is treated between `add_custom_target` and
`add_custom_command`. This patch gets the integration tests to run
again by passing the correct set of arguments to `add_custom_target`.

Reviewed By: michaelrj

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

16 months ago[libc] Support constexpr uint initialization
Michael Jones [Wed, 19 Apr 2023 23:51:33 +0000 (16:51 -0700)]
[libc] Support constexpr uint initialization

Uint addition and subtraction normally use builtins which aren't
constexpr. This patch adds an rvalue overload version of the addition
and subtraction operation that is always constexpr.

Reviewed By: sivachandra

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

16 months agoModify test to explicitely use the size of the mapped array.
Doru Bercea [Thu, 20 Apr 2023 18:55:58 +0000 (14:55 -0400)]
Modify test to explicitely use the size of the mapped array.

Review: https://reviews.llvm.org/D148832