platform/upstream/llvm.git
18 months ago[lldb][test] Skip TestRerunAndExprDylib on Ubuntu 18.04
Dave Lee [Thu, 19 Jan 2023 18:38:21 +0000 (10:38 -0800)]
[lldb][test] Skip TestRerunAndExprDylib on Ubuntu 18.04

Disable this test on Ubuntu 18.04, where it fails for yet to be determined reasons.

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

18 months ago[OpenMP] Only test kmp_atomic_float10_max_min.c on X86
Shilei Tian [Fri, 20 Jan 2023 15:52:47 +0000 (10:52 -0500)]
[OpenMP] Only test kmp_atomic_float10_max_min.c on X86

The test `openmp/runtime/test/atomic/kmp_atomic_float10_max_min.c` uses a compiler
flag `-mlong-double-80` that might not be supported by all targets. Currently it
requires `x86-registered-target`, but that requirement can be true when LLVM
supports X86 while the actual `libomp` arch is not X86. For example, when LLVM
is built on AArch64 with all targets enabled, `x86-registered-target` can be met.
If `libomp` is built with native target, aka. AArch64, the test will still be enabled,
causing test failure.

This patch only enables the test if the actual target is X86. The actual target
is determined by `LIBOMP_ARCH`.

Fix #53696.

Reviewed By: jlpeyton

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

18 months ago[MLIR] Remove scf.if builder with explicit result types and callbacks
Frederik Gossen [Fri, 20 Jan 2023 15:51:16 +0000 (10:51 -0500)]
[MLIR] Remove scf.if builder with explicit result types and callbacks

Instead, use the builder and infer the return type based on the inner `yield` ops.
Also, fix uses that do not create the terminator as required for the callback builders.

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

18 months ago[Mem2Reg] Only convert !nonnull to assume if !noundef present
Nikita Popov [Thu, 12 Jan 2023 13:57:34 +0000 (14:57 +0100)]
[Mem2Reg] Only convert !nonnull to assume if !noundef present

After D141386 !nonnull violation returns poison rather than
resulting in immediate undefined behavior. However, converting
it into an assume would result in IUB. As such, we can only
perform this transform if !noundef is also present.

18 months ago[MLIR] Address post-submit comments on scf.if's InferTypeOpInterface
Frederik Gossen [Fri, 20 Jan 2023 15:36:40 +0000 (10:36 -0500)]
[MLIR] Address post-submit comments on scf.if's InferTypeOpInterface

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

18 months ago[DWARF][dsymutil][llvm-dwarfutil] Create a placeholder library DWARFLinkerParallel.
Alexey Lapshin [Fri, 20 Jan 2023 14:43:11 +0000 (15:43 +0100)]
[DWARF][dsymutil][llvm-dwarfutil] Create a placeholder library DWARFLinkerParallel.

This patch is extracted from D96035. It creates an empty library DWARFLinkerParallel.

Reviewed By: JDevlieghere

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

18 months ago[mlir][LLVM] Add passthrough import support
Christian Ulmann [Fri, 20 Jan 2023 15:28:56 +0000 (16:28 +0100)]
[mlir][LLVM] Add passthrough import support

This commit extends the LLVMIR import to support function attributes by
adding them to the passthrough array attribute.

Depends on D142013

Reviewed By: gysit

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

18 months ago[MLIR][LLVM] Support inlining LLVM::CallOp to LLVM::FuncOp.
Johannes de Fine Licht [Fri, 20 Jan 2023 15:13:48 +0000 (16:13 +0100)]
[MLIR][LLVM] Support inlining LLVM::CallOp to LLVM::FuncOp.

Extend `LLVMInlinerInterface` to handle calls from an `LLVM::CallOp` to
an `LLVM::FuncOp` when there are no attributes present that require
special handling.

Depends on D141676

Reviewed By: gysit

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

18 months ago[clang][nfc] refactor Module::Header to use OptionalFileEntryRef
Richard Howell [Wed, 18 Jan 2023 22:58:15 +0000 (14:58 -0800)]
[clang][nfc] refactor Module::Header to use OptionalFileEntryRef

Refactor the `Module::Header` class to use an `OptionalFileEntryRef`
instead of a `FileEntry*`. This is preparation for refactoring the
`TopHeaderNames` to use `FileEntryRef` so that we preserve the
lookup path of the headers when serializing.

This is mostly based on https://reviews.llvm.org/D90497

Reviewed By: jansvoboda11

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

18 months agosanmd: refine selection of functions for UAR checking
Dmitry Vyukov [Fri, 20 Jan 2023 09:26:20 +0000 (10:26 +0100)]
sanmd: refine selection of functions for UAR checking

There are no intrinsic functions that leak arguments.
If the called function does not return, the current function
does not return as well, so no possibility of use-after-return.
Sanitizer function also don't leak or don't return.
It's safe to both pass pointers to local variables to them
and to tail-call them.

Reviewed By: melver

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

18 months ago[Assignment Tracking] Fix tests for buildbot failure
OCHyams [Fri, 20 Jan 2023 15:16:39 +0000 (15:16 +0000)]
[Assignment Tracking] Fix tests for buildbot failure

Follow-up for 4ece50737d5385fb80cfa23f5297d1111f8eed39 (D142027).

Assignment Tracking Analysis now always runs and is skipped internally if
assignment tracking is disabled. Update these tests to expect to see the
pass run.

Buildbot failure: https://lab.llvm.org/buildbot/#/builders/216/builds/16085

18 months ago[flang] Add lowering of move_alloc to IntrinsicCall
David Truby [Fri, 20 Jan 2023 14:32:14 +0000 (14:32 +0000)]
[flang] Add lowering of move_alloc to IntrinsicCall

This patch relies on D141286 for the runtime implementation of
move_alloc.

Reviewed By: jeanPerier

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

18 months ago[mlir][Linalg] fix comparison of integers with different signs
Tom Eccles [Fri, 20 Jan 2023 12:14:10 +0000 (12:14 +0000)]
[mlir][Linalg] fix comparison of integers with different signs

Since https://reviews.llvm.org/D142053, building mlir with clang using -Werror
fails reporting comparison of integers with different signs.

Fix this by using unsigned return types for
RelayoutOp::getSourceRank,getDestRank

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

18 months ago[mlgo] Stream the training data
Mircea Trofin [Fri, 20 Jan 2023 01:37:08 +0000 (17:37 -0800)]
[mlgo] Stream the training data

This leverages the new logging format in that we don't need to buffer
the training data, we can just write it out.

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

18 months ago[DAG] visitINSERT_VECTOR_ELT - move mergeInsertEltWithShuffle / combineInsertEltToShu...
Simon Pilgrim [Fri, 20 Jan 2023 14:25:55 +0000 (14:25 +0000)]
[DAG] visitINSERT_VECTOR_ELT - move mergeInsertEltWithShuffle / combineInsertEltToShuffle folds after canonicalization

Noticed while triaging D127115 regressions - there's no need to attempt these costly folds until after the easy canonicalization cases have been addressed

18 months ago[DirectX] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:40:49 +0000 (15:40 +0100)]
[DirectX] Fix i8 alignment in datalayout of lit test

An llc lit test used overaligned i8, apparently originating from the old DXIL data layout.
The new DXIL data layout uses naturally aligned i8.

llc ignores the data layout of a module and instead sets the data layout based
on the target. Change the data layout string in the test to match that target-derived
data layout.

18 months ago[Transforms] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:38:28 +0000 (15:38 +0100)]
[Transforms] Fix i8 alignment in datalayout of lit test

A lit test used overaligned i8, apparently due to an old copy-paste
error, intending to specify i16 alignment.

Change the datalayout string to use naturally aligned i8.

18 months ago[X86] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:37:25 +0000 (15:37 +0100)]
[X86] Fix i8 alignment in datalayout of lit test

A lit test used overaligned i8, apparently due to an old copy-paste
error, intending to specify i32 alignment.

Change the datalayout string to use naturally aligned i8.

18 months ago[polly] Fix i8 alignment in datalayout of lit test
Jannik Silvanus [Fri, 20 Jan 2023 14:36:13 +0000 (15:36 +0100)]
[polly] Fix i8 alignment in datalayout of lit test

Two lit test used overaligned i8, without the test case actually
depending on i8 alignment.
Change the datalayout string to use naturally aligned i8,
preparing for the upcoming requirement of naturally aligned i8.

18 months ago[docs] Update release notes to mention that LoongArch supports JITLink
wanglei [Fri, 20 Jan 2023 14:49:23 +0000 (22:49 +0800)]
[docs] Update release notes to mention that LoongArch supports JITLink

18 months ago[DebugInfo] Store instr-ref mode of MachineFunction in member
Jeremy Morse [Fri, 20 Jan 2023 14:14:39 +0000 (14:14 +0000)]
[DebugInfo] Store instr-ref mode of MachineFunction in member

Add a flag state (and a MIR key) to MachineFunctions indicating whether they
contain instruction referencing debug-info or not. Whether DBG_VALUEs or
DBG_INSTR_REFs are used needs to be determined by LiveDebugValues at least, and
using the current optimisation level as a proxy is proving unreliable.

Test updates are purely adding the flag to tests, in a couple of cases it
involves separating out VarLocBasedLDV/InstrRefBasedLDV tests into separate
files, as they can no longer share the same input.

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

18 months ago[LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`
Shilei Tian [Fri, 20 Jan 2023 14:46:24 +0000 (09:46 -0500)]
[LLVM][OpenMP] Correct the function signature of `__kmpc_parallel_level`

`__kmpc_parallel_level` used to be a function w/o any argument, but in the new
device runtime, it accepts two. This patch simply corrects it in `OMPKinds.def`.
```
uint16_t __kmpc_parallel_level(IdentTy *Loc, uint32_t);
```

Reviewed By: jhuber6

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

18 months ago[Mem2Reg] Add additional noundef variations to nonnull tests (NFC)
Nikita Popov [Fri, 20 Jan 2023 14:39:00 +0000 (15:39 +0100)]
[Mem2Reg] Add additional noundef variations to nonnull tests (NFC)

18 months ago[Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag
OCHyams [Fri, 20 Jan 2023 14:30:58 +0000 (14:30 +0000)]
[Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag

This change allows `-fexperimental-assignment-tracking` to be negated using the
negative equivalent `-fno-experimental-assignment-tracking`, and fixes the flag
so that the default behaviour can be changed (currently the default is still
false / disabled).

Reviewed By: StephenTozer

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

18 months ago[ARM] Fix condition in cmov to csinc combine.
David Green [Fri, 20 Jan 2023 14:35:23 +0000 (14:35 +0000)]
[ARM] Fix condition in cmov to csinc combine.

This fixes the cmov fold from 90f24bef47227d58f2ccdcc481ca22eff32248ca,
where the condition needs to be inverted between the cmov and the csinc.

18 months ago[Assignment Tracking] Fix invalidated iterator usage
OCHyams [Fri, 20 Jan 2023 14:24:57 +0000 (14:24 +0000)]
[Assignment Tracking] Fix invalidated iterator usage

The iterator `FirstOverlap` is invalidated after the call to `insert` - avoid
dereferencing the iterator after the call to `insert`.

Reviewed By: CarlosAlbertoEnciso

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

18 months ago[Local] Preserve range metadata if the type did not change
Nikita Popov [Fri, 20 Jan 2023 14:27:19 +0000 (15:27 +0100)]
[Local] Preserve range metadata if the type did not change

In copyRangeMetadata() and by extension copyLoadMetadata(),
handle the trivial case where the type did not change, in which
case we can simply preserve the range metadata as is.

18 months ago[Assignment Tracking][NFC] Replace LLVM command line option with a module flag
OCHyams [Fri, 20 Jan 2023 14:19:14 +0000 (14:19 +0000)]
[Assignment Tracking][NFC] Replace LLVM command line option with a module flag

Remove LLVM flag -experimental-assignment-tracking. Assignment tracking is
still enabled from Clang with the command line -Xclang
-fexperimental-assignment-tracking which tells Clang to ask LLVM to run the
pass declare-to-assign. That pass converts conventional debug intrinsics to
assignment tracking metadata. With this patch it now also sets a module flag
debug-info-assignment-tracking with the value `i1 true` (using the flag conflict
rule `Max` since enabling assignment tracking on IR that contains only
conventional debug intrinsics should cause no issues).

Update the docs and tests too.

Reviewed By: CarlosAlbertoEnciso

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

18 months ago[SROA] Use copyMetadataForLoad() helper
Nikita Popov [Thu, 19 Jan 2023 16:04:06 +0000 (17:04 +0100)]
[SROA] Use copyMetadataForLoad() helper

Instead of copying just nonnull metadata, use the generic helper
to copy metadata to the new load. This helper is specifically
designed for the case where the load type may change, so it's
safe to use in this context.

18 months ago[arith] Allow integer casts of 0-D vectors
Benjamin Kramer [Thu, 19 Jan 2023 17:44:31 +0000 (18:44 +0100)]
[arith] Allow integer casts of 0-D vectors

This just works, no reason to disallow it.

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

18 months ago[clang] Fix typos in member initializers
Kadir Cetinkaya [Fri, 20 Jan 2023 08:43:48 +0000 (09:43 +0100)]
[clang] Fix typos in member initializers

This was regressed in ca619613801233ef2def8c3cc7d311d5ed0033cb. As we
attached InitExprs as-is to the AST, without performing transformations.

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

18 months ago[SROA] Add additional metadata preservation tests (NFC)
Nikita Popov [Fri, 20 Jan 2023 14:07:18 +0000 (15:07 +0100)]
[SROA] Add additional metadata preservation tests (NFC)

18 months ago[clang] Use FP options from AST for emitting code for casts
Serge Pavlov [Tue, 17 Jan 2023 14:38:00 +0000 (21:38 +0700)]
[clang] Use FP options from AST for emitting code for casts

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

18 months ago[clang-format] SortUsingDeclarations support lexicographic order
Backl1ght [Fri, 20 Jan 2023 12:22:51 +0000 (20:22 +0800)]
[clang-format] SortUsingDeclarations support lexicographic order

fix https://github.com/llvm/llvm-project/issues/59930

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

18 months ago[Assignment Tracking] Update test to use opaque pointers
OCHyams [Fri, 20 Jan 2023 13:07:12 +0000 (13:07 +0000)]
[Assignment Tracking] Update test to use opaque pointers

18 months ago[NFC] Precommit tests
Samuel Parker [Fri, 20 Jan 2023 13:17:12 +0000 (13:17 +0000)]
[NFC] Precommit tests

For (trunc (fp-to-int)).

18 months ago[flang][hlfir] Enable allocate, deallocate, pointer assignment lowering
Jean Perier [Fri, 20 Jan 2023 13:05:42 +0000 (14:05 +0100)]
[flang][hlfir] Enable allocate, deallocate, pointer assignment lowering

The previous patches allowed lowering allocatable/and pointer designator
expressions with HLFIR.
This patch updates the bridge genExprMutableBox to use HLFIR lowering
when HLFIR flag is set. For allocate and deallocate lowering that use
genExprMutableBox, no other change is needed.

For pointer assignments, the code doing the pointer assignments in the
bridge can be reused and is simply moved so that it can be shared, and
the "explicit context" special cases of the previous lowering are
by-passed.

The code doing pointer assignment revealed that convertExprToAddress
did not match the previous genExprAddr behavior (that actually
does not create temps for "x" where x is not contiguous).
Instead of trying to copy the old behavior that is a bit weird (was
dictated by the implementation rather than design). Update
convertExprToAddress to do something sensible and that works with
the current genExprAddr usages (if anything, it should saves bogus
array section temps).

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

18 months ago[AArch64][SME2] Add LLVM IR intrinsics for the vertical dot products
David Sherwood [Wed, 18 Jan 2023 09:02:15 +0000 (09:02 +0000)]
[AArch64][SME2] Add LLVM IR intrinsics for the vertical dot products

Adds intrinsics for the following SME2 instructions:

* BFVDOT (32-bit)
* FVDOT (32-bit)
* SVDOT (2-way) (32-bit)
* SVDOT (4-way) (32-bit and 64-bit)
* UVDOT (2-way) (32-bit)
* UVDOT (4-way) (32-bit and 64-bit)
* SUVDOT (32-bit)
* USVDOT (32-bit)

NOTE: These intrinsics are still in development and are subject to future changes.

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

18 months ago[mlir] Introduce a pattern to lower `gpu.subgroup_reduce` to `nvvm.redux_op`
Guray Ozen [Fri, 20 Jan 2023 11:44:03 +0000 (12:44 +0100)]
[mlir] Introduce a pattern to lower `gpu.subgroup_reduce` to `nvvm.redux_op`

This revision introduces a pattern to lower `gpu.subgroup_reduce` op into to the `nvvm.redux_sync` op. The op must be run by the entire subgroup, otherwise it is undefined behaviour.

It also adds a flag and populate function, because the op is not avaiable for every gpu (sm80+), so it can be used when it is desired.

Depends on D142088

Reviewed By: nicolasvasilache

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

18 months ago[mlir][Linalg] Fix ignoring nodiscard return value
Tom Eccles [Fri, 20 Jan 2023 12:51:11 +0000 (04:51 -0800)]
[mlir][Linalg] Fix ignoring nodiscard return value

ff94419a287c changed the return value of appendMangledType() to
LogicalResult, which is marked as nodiscard. Ignoring the result
generates a warning when building with clang.

Reviewed By: nicolasvasilache, chelini

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

18 months ago[OpenMP][libomptarget] Fix deinit of NextGen AMDGPU plugin
Kevin Sala [Thu, 19 Jan 2023 18:47:57 +0000 (19:47 +0100)]
[OpenMP][libomptarget] Fix deinit of NextGen AMDGPU plugin

This patch fixes a segfault that was appearing when the plugin fails to
initialize and then is deinitialized. Also, do not call hsa_shut_down if
the hsa_init failed.

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

18 months ago[mlir][llvm] Drop cyclic dependencies during debug metadata import.
Tobias Gysi [Fri, 20 Jan 2023 12:03:36 +0000 (13:03 +0100)]
[mlir][llvm] Drop cyclic dependencies during debug metadata import.

This revision fixes the import of LLVM IR to handle debug metadata with
cyclic dependencies. It deletes the elements list of the composite type
if a cyclic dependency is detected. The revision is meant as a band aid
to avoid infinite recursion during the import of cyclic debug metadata.
Long term solutions are currently discussed here:
https://discourse.llvm.org/t/handling-cyclic-dependencies-in-debug-info/67526/4

Reviewed By: Dinistro

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

18 months ago[OpenCL] Always add nounwind attribute for OpenCL
Sven van Haastregt [Thu, 19 Jan 2023 13:42:43 +0000 (13:42 +0000)]
[OpenCL] Always add nounwind attribute for OpenCL

Neither OpenCL nor C++ for OpenCL support exceptions, so add the
`nounwind` attribute unconditionally for those languages.

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

18 months ago[InstCombine] Add multi-use tests for gep of gep fold (NFC)
Nikita Popov [Fri, 20 Jan 2023 11:46:31 +0000 (12:46 +0100)]
[InstCombine] Add multi-use tests for gep of gep fold (NFC)

18 months ago[AArch64][SME2] Add multi-vector multiply-add long intrinsics.
Kerry McLaughlin [Fri, 20 Jan 2023 11:17:17 +0000 (11:17 +0000)]
[AArch64][SME2] Add multi-vector multiply-add long intrinsics.

Adds (single, multi & indexed) intrinsics for the following:
 - bfmlal/bfmlsl
 - fmlal/fmlsl
 - smlal/smlsl
 - umlal/umlsl

This patch also extends SelectSMETileSlice to handle scaled vector select offsets.

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: CarolineConcatto

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

18 months ago[ValueTracking] Take poison-generating metadata into account (PR59888)
Nikita Popov [Thu, 19 Jan 2023 14:34:35 +0000 (15:34 +0100)]
[ValueTracking] Take poison-generating metadata into account (PR59888)

In canCreateUndefOrPoison(), take not only poison-generating flags,
but also poison-generating metadata into account. The helpers are
written generically, but I believe the only case that can actually
matter is !range on calls -- !nonnull and !align are only valid on
loads, and those can create undef/poison anyway.

Unfortunately, this negatively impacts logical to bitwise and/or
conversion: For ctpop/ctlz/cttz we always attach !range metadata,
which will now block the transform, because it might introduce
poison. It would be possible to recover this regression by supporting
a ConsiderFlagsAndMetadata=false mode in impliesPoison() and clearing
flags/metadata on visited instructions.

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

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

18 months ago[AArch64][SME2] Add multi-vector fused multiply-add/subtract intrinsics
Kerry McLaughlin [Fri, 20 Jan 2023 10:44:39 +0000 (10:44 +0000)]
[AArch64][SME2] Add multi-vector fused multiply-add/subtract intrinsics

Adds intrinsics for the following:
 - fmla (single, multi & indexed)
 - fmls (single, multi & indexed)

NOTE: These intrinsics are still in development and are subject
to future changes.

Reviewed By: CarolineConcatto

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

18 months ago[mlir][nvvm] Introduce redux op
Guray Ozen [Thu, 19 Jan 2023 09:09:02 +0000 (10:09 +0100)]
[mlir][nvvm] Introduce redux op

Ptx model has `redux.sync` that performs reduction operation on the data from each predicated active thread in the thread group. It only is available sm80+.

This revision adds redux as on op to nvvm dialect.

Reviewed By: nicolasvasilache

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

18 months ago[ReleaseNotes] Add mention of complex number support for ARM and AArch64 backends.
Nicholas Guy [Wed, 18 Jan 2023 14:03:56 +0000 (14:03 +0000)]
[ReleaseNotes] Add mention of complex number support for ARM and AArch64 backends.

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

18 months ago[InstCombine] Add tests for constant memcpy with select (NFC)
Anshil Gandhi [Fri, 20 Jan 2023 10:52:17 +0000 (11:52 +0100)]
[InstCombine] Add tests for constant memcpy with select (NFC)

Tests for D136524.

18 months agotsan: Consider SI_TIMER signals always asynchronous
Marco Elver [Fri, 20 Jan 2023 09:20:41 +0000 (10:20 +0100)]
tsan: Consider SI_TIMER signals always asynchronous

POSIX timer can be configured to send any kind of signal, however, it
fundamentally does not make sense to consider a timer a synchronous
signal. Teach TSan that timers are never synchronous.

The tricky bit here is correctly defining compiler-rt's siginfo
replacement, which is a rather complex struct. Extend it in a limited
way that is mostly cross-platform compatible and add offset tests in
sanitizer_platform_limits_posix.cpp.

Reviewed By: dvyukov

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

18 months ago[flang][hlfir] Lower pointer and allocatable sub-part references
Jean Perier [Fri, 20 Jan 2023 10:30:39 +0000 (11:30 +0100)]
[flang][hlfir] Lower pointer and allocatable sub-part references

The previous patches dealt with allocatable and pointer symbol
and component whole references.
This one deals with the remaining sub-part case where a dereference
must be created before applying the sub-part reference on the target.

With this patch the support to designate allocatable and pointer in
HLFIR is complete, but some use points will need to be updated to
use HLFIR designator lowering (at least allocate/deallocate statement
and whole allocatable assignment).

The partInfo.base had to be turned into an std::optional<hlfir::Entity>
because loads of allocatable/pointers do create a
fir::FortranVariableOpInterface (there is no need to). The optional part
comes from the fact that the partInfo.base is not set when creating the
partInfo, but later when visiting the designator parts.

They are three cases when dereferences must be inserted:
- The pointer/allocatable is a symbol followed by a sub-part that is not
a component ref. This is done in visit(Symbol).
- The pointer/allocatable is a component followed by a sub-part that is
not another component ref. This is done in visit(Component).
- The pointer/allocatable is followed by a component ref. This case is
special since it does not call the above "visit" but instead calls "gen"
to break the visit and generate an hlfir.designate for the component
base (since one hlfir.designate can only represent one Fortran part-ref,
and must be chained to implement a Fortran designator with several part
refs). This is done in visitComponentImpl().

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

18 months ago[bazel] Add missing dependencies for 790f237012
Benjamin Kramer [Fri, 20 Jan 2023 10:05:29 +0000 (11:05 +0100)]
[bazel] Add missing dependencies for 790f237012

18 months ago[gn build] Port 0e13ccc69cf2
LLVM GN Syncbot [Fri, 20 Jan 2023 09:52:08 +0000 (09:52 +0000)]
[gn build] Port 0e13ccc69cf2

18 months ago[VPlan] Add initial VPDT test. (NFC)
Florian Hahn [Fri, 20 Jan 2023 09:51:06 +0000 (09:51 +0000)]
[VPlan] Add initial VPDT test. (NFC)

18 months ago[libomp] Explicitly include <string> header (NFC)
Nikita Popov [Fri, 20 Jan 2023 09:11:01 +0000 (10:11 +0100)]
[libomp] Explicitly include <string> header (NFC)

This is required to build against libstdc++ 13. Debug.h uses
std::stoi() from <string> without explicitly including it.

18 months ago[clang] fix crash on generic lambda with lambda in decltype
v1nh1shungry [Mon, 2 Jan 2023 05:13:38 +0000 (13:13 +0800)]
[clang] fix crash on generic lambda with lambda in decltype

Relevant issue: https://github.com/llvm/llvm-project/issues/59771

During the instantiation of a generic lambda, a non-generic lambda in
the trailing `decltype` is a `DeclContext` but not a dependent context,
so we shouldn't call `PerformDependentDiagnostics` on it.

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

18 months ago[mlir] GreedyPatternRewriteDriver: Add new strict mode option
Matthias Springer [Fri, 20 Jan 2023 09:01:27 +0000 (10:01 +0100)]
[mlir] GreedyPatternRewriteDriver: Add new strict mode option

There are now three options:
* `AnyOp` (previously `false`)
* `ExistingAndNewOps` (previously `true`)
* `ExistingOps`: this one is new.

The last option corresponds to what the `applyOpPatternsAndFold(Operation*, ...)` overload is doing. It is now also supported on the `applyOpPatternsAndFold(ArrayRef<Operation *>, ...)` overload.

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

18 months ago[clang][Interp] Initialize remaining InlineDescriptor fields
Timm Bäder [Fri, 20 Jan 2023 08:09:55 +0000 (09:09 +0100)]
[clang][Interp] Initialize remaining InlineDescriptor fields

for local variables. Hoping this will please msan.

18 months ago[Flang] Explicitly include cstdint (NFC)
Nikita Popov [Thu, 19 Jan 2023 13:28:58 +0000 (14:28 +0100)]
[Flang] Explicitly include cstdint (NFC)

This header uses std::int8_t, but does not include cstdint.

This fixes the build against libstc++ 13, where some indirect
header includes have been removed.

18 months ago[GVN] Refactor findDominatingLoad function
Sergey Kachkov [Fri, 13 Jan 2023 13:02:21 +0000 (16:02 +0300)]
[GVN] Refactor findDominatingLoad function

Improve findDominatingLoad implementation:
1. Result is saved into gvn::AvailableValue struct
2. Search is done in extended BB (while there is a single predecessor or
   limit is reached)

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

18 months ago[include-mapping] Parse zombie_names.html into a removed symbols map.
Viktoriia Bakalova [Mon, 16 Jan 2023 16:17:47 +0000 (16:17 +0000)]
[include-mapping] Parse zombie_names.html into a removed symbols map.

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

18 months agoAdd security group 2022 transparency report.
Kristof Beyls [Fri, 20 Jan 2023 08:49:16 +0000 (09:49 +0100)]
Add security group 2022 transparency report.

18 months agoRevert "[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on...
Craig Topper [Fri, 20 Jan 2023 08:41:14 +0000 (00:41 -0800)]
Revert "[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on Windows."

This reverts commit 928a1764d6bdf84073c9d85875f45c1716d6ff12.

Committed accidentally

18 months ago[RISCV][TableGen] Use getAllDerivedDefinitions in RISCVTargetDefEmitter to simplify...
Craig Topper [Fri, 20 Jan 2023 08:20:13 +0000 (00:20 -0800)]
[RISCV][TableGen] Use getAllDerivedDefinitions in RISCVTargetDefEmitter to simplify the code. NFC

18 months ago[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on Windows.
Craig Topper [Fri, 20 Jan 2023 05:34:23 +0000 (21:34 -0800)]
[X86][WIP] Change precision control to FP80 during u64->fp32 conversion on Windows.

This is an alternative to D141074 to fix the problem by adjusting
the precision control dynamically.

This isn't quite complete yet. I want to support fadd with an load
folded into it too. That's the code we will usually generate.

Posting for early review so we can do some testing of this solution.

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

18 months ago[mlir][Linalg] Add a structured.pack_transpose transform op
Nicolas Vasilache [Wed, 18 Jan 2023 20:26:13 +0000 (12:26 -0800)]
[mlir][Linalg] Add a structured.pack_transpose transform op

This transform is complementary to the `structured.pack` op which
allows packing a whole op but does not allow transposes on the individual
operands.

`structured.pack_transpose` allows transposing single operands connected to
pack or unpack ops after the fact.

This makes the system overall more composable than e.g. a giant transform
op with all permutation specified at once.

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

18 months ago[mlir][Linalg] Fix crash in LinalgToStandard
Nicolas Vasilache [Fri, 20 Jan 2023 08:06:34 +0000 (00:06 -0800)]
[mlir][Linalg] Fix crash in LinalgToStandard

Properly handle `appendMangledType` failure instead of asserting.

Fixes #59986.

18 months ago[mlir][Linalg] Add missing test
Nicolas Vasilache [Fri, 20 Jan 2023 08:06:34 +0000 (00:06 -0800)]
[mlir][Linalg] Add missing test

c3f0efe753e27105b519ae9283796d41fe574741 lacked a test, added here.

18 months ago[clangd] Fix shared lib builds
Kadir Cetinkaya [Fri, 20 Jan 2023 07:57:08 +0000 (08:57 +0100)]
[clangd] Fix shared lib builds

18 months agoNFC. Refactor affine fusion code for readability
Uday Bondhugula [Fri, 20 Jan 2023 06:53:32 +0000 (12:23 +0530)]
NFC. Refactor affine fusion code for readability

Replace a couple of check instances with llvm::any_of (clang-tidy
warnings).  Factor out "canCreatePrivateMemRef" and
"performFusionsIntoDest" into separate methods to reduce the
length/indent of the containing methods. Add doc comments and debug messages.

Mark some of the methods that should have been const const.

NFC.

Reviewed By: vinayaka-polymage

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

18 months ago[mlir][Linalg] Fix crash in LinalgToStandard
Nicolas Vasilache [Fri, 20 Jan 2023 07:29:16 +0000 (23:29 -0800)]
[mlir][Linalg] Fix crash in LinalgToStandard

Use rewriter.notifyMatchFailure instead of assert.

Fixes #59986.

18 months ago[gn build] Port 21f4232dd963
LLVM GN Syncbot [Fri, 20 Jan 2023 06:58:57 +0000 (06:58 +0000)]
[gn build] Port 21f4232dd963

18 months ago[libc++] Enable segmented iterator optimizations for join_view::iterator
Nikolas Klauser [Mon, 21 Nov 2022 11:41:15 +0000 (12:41 +0100)]
[libc++] Enable segmented iterator optimizations for join_view::iterator

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

18 months ago[ADT,Support] Include compiler.h
Kazu Hirata [Fri, 20 Jan 2023 06:49:31 +0000 (22:49 -0800)]
[ADT,Support] Include compiler.h

This restores builds with gcc-9, which does not have __has_builtin.

18 months ago[ORC][ORC-RT] Add support for callback-based lookup of JIT'd MachO unwind info.
Lang Hames [Fri, 20 Jan 2023 05:33:41 +0000 (21:33 -0800)]
[ORC][ORC-RT] Add support for callback-based lookup of JIT'd MachO unwind info.

In LLVM the MachOPlatform class is modified to identify unwind info sections
and the address ranges of the functions these sections cover. These address
ranges are then communicated to the ORC runtime by attaching them to the
register-object-platform-sections allocation action.

In the ORC runtime the unwind-info section addresses are recorded and used to
support lookup of unwind info via the new `findDynamicUnwindSections` function.
At bootstrap time the ORC runtime checks for the presence of new
unwind-info-lookup-registration functions in libunwind (see
https://reviews.llvm.org/D142176), and if available uses them to register the
`findDynamicUnwindSections` function with libunwind to enable callback-based
lookup. If the new unwind-info-lookup-registration functions are not available
then the ORC runtime falls back to using the existing libunwind registration
APIs.

The callback-based scheme is intended to address three shortcomings in the
current registration scheme for JIT'd unwind info on Darwin: (1) Lack of
compact-unwind support, (2) inability to describe the subarchitecture of JIT'd
frames, and (3) lack of efficient address-based lookup data structures in
libunwind.

For more details see the proposed libunwind changes in
https://reviews.llvm.org/D142176.

18 months ago[libc++] Mark LWG3349 as complete
Nikolas Klauser [Fri, 20 Jan 2023 06:06:40 +0000 (07:06 +0100)]
[libc++] Mark LWG3349 as complete

18 months agoRevert "[X86] Avoid converting u64 to f32 using x87 on Windows"
Craig Topper [Fri, 20 Jan 2023 05:36:07 +0000 (21:36 -0800)]
Revert "[X86] Avoid converting u64 to f32 using x87 on Windows"

This reverts commit a6e3027db7ebe6863e44bafcfeaacc16bdc88a3f.

Chrome and Halide are both reporting issues with importing builtins.

Maybe the better direction is to manually adjust FPCW for the inline
sequence on Windows.

18 months ago[llvm] Move bit counting functions to bit.h (NFC)
Kazu Hirata [Fri, 20 Jan 2023 05:15:39 +0000 (21:15 -0800)]
[llvm] Move bit counting functions to bit.h (NFC)

This patch provides C++20-style countl_zero, countr_zero, countl_one,
and countr_one in bit.h.  Existing functions like countLeadingZeros
become wrappers around the new functions.

Note that I cannot quite declare countLeadingZeros as:

  template <class T> using countLeadingZeros = countl_zero<T>;

because countl_zero returns int, whereas countLeadingZeros returns
unsigned.

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

18 months ago[gn build] Port b40a3d73dc9c
LLVM GN Syncbot [Fri, 20 Jan 2023 05:06:41 +0000 (05:06 +0000)]
[gn build] Port b40a3d73dc9c

18 months ago[libc++] Remove old CI configurations and update the supported compiler versions
Nikolas Klauser [Tue, 6 Sep 2022 17:01:17 +0000 (19:01 +0200)]
[libc++] Remove old CI configurations and update the supported compiler versions

`_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` doesn't do anything anymore in C++23 mode, so it's now just a duplicate of the C++23 configuration.
Also add new steps to the post-release checklist for updating the supported compilers.

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, arphaman

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

18 months ago[libc++] Implement P2446R2 (views::as_rvalue)
Nikolas Klauser [Sun, 11 Dec 2022 10:32:54 +0000 (11:32 +0100)]
[libc++] Implement P2446R2 (views::as_rvalue)

Reviewed By: ldionne, var-const, #libc

Spies: libcxx-commits

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

18 months agoAdding missing colon
Advenam Tacet [Fri, 20 Jan 2023 04:52:18 +0000 (20:52 -0800)]
Adding missing colon

Simple typo fix.
The absence of this colon may be confusing and result in misinterpretation of the result.

In normal libfuzzer mode, that colon is present.

You can compare with:
https://github.com/llvm/llvm-project/blob/aa0e9046c16bf27a8affbd903e2e3cad924a5217/compiler-rt/lib/fuzzer/FuzzerLoop.cpp#L356

Reviewed By: #sanitizers, vitalybuka

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

18 months ago[Clang][OpenMP] Allow `f16` literal suffix when compiling OpenMP target offloading...
Shilei Tian [Fri, 20 Jan 2023 03:24:23 +0000 (22:24 -0500)]
[Clang][OpenMP] Allow `f16` literal suffix when compiling OpenMP target offloading for NVPTX

Fix #58087.

Reviewed By: jhuber6

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

18 months ago[HIP] Unbundler allows missing host entry
Yaxun (Sam) Liu [Thu, 19 Jan 2023 15:37:55 +0000 (10:37 -0500)]
[HIP] Unbundler allows missing host entry

Reviewed by: Artem Belevich

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

18 months ago[clang] Don't short-circuit constant evaluation for array or record types
Charles Magahern [Mon, 9 Jan 2023 22:28:29 +0000 (14:28 -0800)]
[clang] Don't short-circuit constant evaluation for array or record types

FastEvaluateAsRValue returns `true` without setting a result value for when a
given constant expression is an array or record type.

Clang attributes must be able to support constant expressions that are array or
record types, so proceed with the slower path for evaluation in the case where
`FastEvaluateAsRValue` does not yield an evaluation result.

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

18 months agollvm-reduce: Trim includes and avoid using namespace in a header
Matt Arsenault [Sat, 14 Jan 2023 13:50:55 +0000 (08:50 -0500)]
llvm-reduce: Trim includes and avoid using namespace in a header

18 months ago[AVR] Fix incorrectly printed global symbol operands in inline-asm
Ben Shi [Thu, 19 Jan 2023 10:06:27 +0000 (18:06 +0800)]
[AVR] Fix incorrectly printed global symbol operands in inline-asm

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

Reviewed By: aykevl

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

18 months ago[mlir][LLVM] Tidy up DebugTranslation casting
River Riddle [Fri, 20 Jan 2023 01:42:30 +0000 (17:42 -0800)]
[mlir][LLVM] Tidy up DebugTranslation casting

Add a specific class for local scope attributes and remove
some unnecessary casts.

18 months agollvm-reduce: Fix typo in help text
Matt Arsenault [Thu, 19 Jan 2023 21:21:05 +0000 (17:21 -0400)]
llvm-reduce: Fix typo in help text

18 months agollvm-reduce: Use WithColor in another error message
Matt Arsenault [Thu, 19 Jan 2023 20:13:37 +0000 (16:13 -0400)]
llvm-reduce: Use WithColor in another error message

18 months agollvm-reduce: Account for initializer complexity
Matt Arsenault [Tue, 17 Jan 2023 19:31:17 +0000 (14:31 -0500)]
llvm-reduce: Account for initializer complexity

18 months agollvm-reduce: Account for aliases and ifuncs in IR complexity score
Matt Arsenault [Tue, 17 Jan 2023 00:41:49 +0000 (19:41 -0500)]
llvm-reduce: Account for aliases and ifuncs in IR complexity score

18 months agollvm-reduce: Use consistent ReductionFunc types
Matt Arsenault [Mon, 16 Jan 2023 16:00:01 +0000 (11:00 -0500)]
llvm-reduce: Use consistent ReductionFunc types

Some of these were relying on ReducerWorkItem's operator Module&.

18 months ago[lldb] Re-enable xmm/ymm/zmm tests with the system debugserver
Jonas Devlieghere [Fri, 20 Jan 2023 01:07:12 +0000 (17:07 -0800)]
[lldb] Re-enable xmm/ymm/zmm tests with the system debugserver

Re-enable the xmm/ymm/zmm tests now that the system debugserver used by
our CI is capable or writing xmm/ymm/zmm registers.

18 months agoRevert "[gn] port a033dbbe5c43 (clang-stat-cache)"
Nico Weber [Fri, 20 Jan 2023 01:06:44 +0000 (20:06 -0500)]
Revert "[gn] port a033dbbe5c43 (clang-stat-cache)"

This reverts commit 8d498e08deaf6e06a578cfedb4eb259b722ac7f6.
a033dbbe5c43 was reverted in cf12709222a4.

18 months agoRevert "[clang][Darwin] Try to guess the SDK root with xcrun when unspecified"
Nico Weber [Fri, 20 Jan 2023 01:04:38 +0000 (20:04 -0500)]
Revert "[clang][Darwin] Try to guess the SDK root with xcrun when unspecified"

This reverts commit ecade80d93960ad01d8665db02c23841e055a80f.
Breaks tests on macOS and tries to run xcrun on non-mac platforms,
see comments on https://reviews.llvm.org/D136315

18 months agoRevert "[LoopUnroll] Directly update DT instead of DTU."
Arthur Eubanks [Fri, 20 Jan 2023 00:59:36 +0000 (16:59 -0800)]
Revert "[LoopUnroll] Directly update DT instead of DTU."

This reverts commit d0907ce7ed9f159562ca3f4cfd8d87e89e93febe.

Causes `opt -passes=loop-unroll-full` to crash on

```
define void @foo() {
bb:
  br label %bb1

bb1:                                              ; preds = %bb1, %bb1, %bb
  switch i1 true, label %bb1 [
    i1 true, label %bb2
    i1 false, label %bb1
  ]

bb2:                                              ; preds = %bb1
  ret void
}
```

18 months ago[Linalg] Don't create complex vectors when vectorizing copies
Benjamin Kramer [Thu, 19 Jan 2023 16:58:54 +0000 (17:58 +0100)]
[Linalg] Don't create complex vectors when vectorizing copies

vector<complex<...>> is currently not valid. This is a reduced version
of https://reviews.llvm.org/D141578

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

18 months ago[Lex] For dependency directive lexing, angled includes in `__has_include` should...
Argyrios Kyrtzidis [Thu, 19 Jan 2023 18:40:11 +0000 (10:40 -0800)]
[Lex] For dependency directive lexing, angled includes in `__has_include` should be lexed as string literals

rdar://104386604

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