platform/upstream/llvm.git
19 months ago[Test] Add two tests showing unprofitable case of Guard Widening
Max Kazantsev [Tue, 28 Mar 2023 07:29:09 +0000 (14:29 +0700)]
[Test] Add two tests showing unprofitable case of Guard Widening

Guard Widening is ignorant about blocks frequency. As result, it may
end up widening conditions from cold/effectively dead code into some
much hotter place, harming average performance.

19 months agoRevert "[SLP] Check with target before vectorizing GEP Indices."
Florian Hahn [Tue, 28 Mar 2023 07:06:53 +0000 (08:06 +0100)]
Revert "[SLP] Check with target before vectorizing GEP Indices."

This reverts commit 1387a13e1d0bac94457626ef3e7427c84caf6e65.

This introduced performance regressions on AArch64, when the cost of a
vector GEP + extracts is offset by the benefits of vectorizing the rest
of the tree.

The test in llvm/test/Transforms/SLPVectorizer/AArch64/vector-getelementptr.ll
illustrates the issue. It was extracted from code that regressed a SPEC
benchmark by 15%.

19 months ago[clang-tidy] Ignore unevaluated exprs in rvalue-reference-param-not-moved
Chris Cotter [Tue, 28 Mar 2023 06:30:34 +0000 (06:30 +0000)]
[clang-tidy] Ignore unevaluated exprs in rvalue-reference-param-not-moved

Ignore unevaluated expressions in rvalue-reference-param-not-moved
check since they are not actual uses of a move().

Reviewed By: PiotrZSL

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

19 months ago[NVPTX] Enforce half type support is present for builtins
Jakub Chlanda [Thu, 23 Mar 2023 11:05:34 +0000 (11:05 +0000)]
[NVPTX] Enforce half type support is present for builtins

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

19 months ago[mlir][Linalg][Transform] Add support to let `transform.structured.pack_greedily...
Nicolas Vasilache [Mon, 27 Mar 2023 15:00:43 +0000 (08:00 -0700)]
[mlir][Linalg][Transform] Add support to let `transform.structured.pack_greedily` pad to the next multiple of a static constant

This increase the flexibility of the transformation to allow mixed packing / padding specifications.

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

19 months agoworkflows/release-tasks: Fix missing suffix on doxygen tarballs
Tom Stellard [Tue, 28 Mar 2023 06:27:28 +0000 (23:27 -0700)]
workflows/release-tasks: Fix missing suffix on doxygen tarballs

Reviewed By: thieta

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

19 months agoworkflows/release-tasks: Upload release notes as an artifact
Tom Stellard [Tue, 28 Mar 2023 06:14:59 +0000 (23:14 -0700)]
workflows/release-tasks: Upload release notes as an artifact

This make sure the docs are always available and can be manually uploaded
if a later step fails.

Reviewed By: thieta

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

19 months ago[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
Petr Hosek [Thu, 9 Mar 2023 18:23:04 +0000 (18:23 +0000)]
[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag

These will be replaced by CMake's check_linker_flag once we update
the minimum CMake version 3.20.

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

19 months ago[dsymutil] Initialize the debug map before loading the main binary
Jonas Devlieghere [Tue, 28 Mar 2023 05:29:54 +0000 (22:29 -0700)]
[dsymutil] Initialize the debug map before loading the main binary

Fix a crash when a warning is emitted while loading the symbols from the
main binary. The warning helper assumes that the resulting debug map is
initialized, but this happened after loading the main binary. Since
there's no dependency between the two the initialization can be moved
up.

rdar://107298776

19 months ago[llvm] Use isIntOrFPConstant (NFC)
Kazu Hirata [Tue, 28 Mar 2023 05:32:23 +0000 (22:32 -0700)]
[llvm] Use isIntOrFPConstant (NFC)

19 months ago[OpenMP] Resolve const cast issue introduced in D123446
Johannes Doerfert [Tue, 28 Mar 2023 05:13:38 +0000 (22:13 -0700)]
[OpenMP] Resolve const cast issue introduced in D123446

19 months ago[OpenMP][FIX] More AAExecutionDomain fixes
Johannes Doerfert [Fri, 24 Mar 2023 21:53:02 +0000 (14:53 -0700)]
[OpenMP][FIX] More AAExecutionDomain fixes

We missed certain updates, mostly to call site information, and
dependent AAs did not get recomputed. We also did not properly
distinguish and propagate incoming and outgoing information of call
sites.

The runtime tests passes now, I'll add a proper test for
AAExecutionDomain soon that covers all the cases and ensures we haven't
forgotten more updates. To help unblock some apps, I'll put the fix
first.

19 months ago[OpenMP] Adjust generic state machine simplification CB
Johannes Doerfert [Mon, 27 Mar 2023 06:23:22 +0000 (23:23 -0700)]
[OpenMP] Adjust generic state machine simplification CB

This callback caused us to potentially miss out on call edges if we were
expecting a custom state machine since the custom state machine was not
created but the workers also did not enter the generic one. I have not
observed an issue and don't know how to create a test for sure, but it
is saver to err on the conservative side for now.

19 months ago[Attributor][FIX] Account for blocks w/o predecessors
Johannes Doerfert [Mon, 27 Mar 2023 05:02:15 +0000 (22:02 -0700)]
[Attributor][FIX] Account for blocks w/o predecessors

19 months ago[OpenMP] Be smarter about the insertion point for deduplication
Johannes Doerfert [Sun, 26 Mar 2023 06:50:23 +0000 (23:50 -0700)]
[OpenMP] Be smarter about the insertion point for deduplication

We can use dominance and avoid the special handling of kernels and
prevent inserting code before allocas accidentally (as happend in the
runtime test).

19 months ago[OpenMP][NFC] Delete dead code
Johannes Doerfert [Fri, 24 Mar 2023 18:51:39 +0000 (11:51 -0700)]
[OpenMP][NFC] Delete dead code

This code may have served a purpose at some point but it has been dead
for a long while. `FromMapperBase` was always `nullptr` which is `false`
which makes the rest of the code dead. Since this has not
affected tests, I delete it for now.

19 months ago[OpenMP] Allow more tests to run on AMDGPU
Johannes Doerfert [Fri, 24 Mar 2023 18:43:38 +0000 (11:43 -0700)]
[OpenMP] Allow more tests to run on AMDGPU

This basically works around the printf issue to increase test coverage.

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

19 months ago[mlir] Fix unit tests after LLVM commit 8b1771bd9f3.
Lang Hames [Tue, 28 Mar 2023 02:38:21 +0000 (19:38 -0700)]
[mlir] Fix unit tests after LLVM commit 8b1771bd9f3.

19 months ago[mlir] Update JitRunner, ExecutionEngine after LLVM commit 8b1771bd9f3.
Lang Hames [Tue, 28 Mar 2023 02:16:45 +0000 (19:16 -0700)]
[mlir] Update JitRunner, ExecutionEngine after LLVM commit 8b1771bd9f3.

LLVM commit 8b1771bd9f3 replaced JITEvaluatedSymbol with ExecutorSymbolDef.

19 months ago[mlir][tosa] Add TOSA f64 type support for const op
AmosLewis [Tue, 28 Mar 2023 01:49:19 +0000 (18:49 -0700)]
[mlir][tosa] Add TOSA f64 type support for const op

[mlir][tosa] Add TOSA f64 type support for const op

Reviewed By: eric-k256, jpienaar

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

19 months ago[RISCV] Support vector type strict_fma.
Yeting Kuo [Mon, 27 Mar 2023 07:16:02 +0000 (15:16 +0800)]
[RISCV] Support vector type strict_fma.

Like D145900, the patch also supports fixed vector strict_fma nodes in RISC-V by
customized lowering them to riscv_strict_vfmadd_vl nodes. riscv_strict_vfmadd_vl
is created to avoid some riscv_vfmadd_vl optimizations happening to original
strict_fma nodes. The patch also adds combine patterns for riscv_strict_fmadd_vl
nodes with negation operands.

Reviewed By: craig.topper

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

19 months ago[ORC] Add missing header.
Lang Hames [Tue, 28 Mar 2023 00:43:58 +0000 (17:43 -0700)]
[ORC] Add missing header.

Accidentally left out of 8b1771bd9f3.

19 months ago[ORC] Move most ORC APIs to ExecutorAddr, introduce ExecutorSymbolDef.
Lang Hames [Wed, 22 Mar 2023 18:45:10 +0000 (11:45 -0700)]
[ORC] Move most ORC APIs to ExecutorAddr, introduce ExecutorSymbolDef.

ExecutorAddr was introduced in b8e5f918166 as an eventual replacement for
JITTargetAddress. ExecutorSymbolDef is introduced in this patch as a
replacement for JITEvaluatedSymbol: ExecutorSymbolDef is an (ExecutorAddr,
JITSymbolFlags) pair, where JITEvaluatedSymbol was a (JITTargetAddress,
JITSymbolFlags) pair.

A number of APIs had already migrated from JITTargetAddress to ExecutorAddr,
but many of ORC's internals were still using the older type. This patch aims
to address that.

Some public APIs are affected as well. If you need to migrate your APIs you can
use the following operations:

* ExecutorAddr::toPtr replaces jitTargetAddressToPointer and
  jitTargetAddressToFunction.

* ExecutorAddr::fromPtr replace pointerToJITTargetAddress.

* ExecutorAddr(JITTargetAddress) creates an ExecutorAddr value from a
  JITTargetAddress.

* ExecutorAddr::getValue() creates a JITTargetAddress value from an
  ExecutorAddr.

JITTargetAddress and JITEvaluatedSymbol will remain in JITSymbol.h for now, but
the aim will be to eventually deprecate and remove these types (probably when
MCJIT and RuntimeDyld are deprecated).

19 months ago[flang] Settle ambiguity between C795 and C721
Peter Klausler [Sat, 18 Mar 2023 00:16:40 +0000 (17:16 -0700)]
[flang] Settle ambiguity between C795 and C721

C721 says that a type parameter value of '*' is permitted in the type-spec
for a named constant; C795 says that such type parameters are allowed
in type-specs only for a few kinds of things, not including named
constants.  The interpretation seems to depend on context, with C721
applying to intrinsic types (i.e., character) and C795 applying only
to derived types.

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

19 months ago[RISCV] Move compressible registers to the beginning of the FP allocation order.
Craig Topper [Tue, 28 Mar 2023 00:29:28 +0000 (17:29 -0700)]
[RISCV] Move compressible registers to the beginning of the FP allocation order.

We don't have very many compressible FP instructions, just load and store.
These instruction require the FP register to be f8-f15.

This patch changes the FP allocation order to prioritize f10-f15 first.
These are also the FP argument registers. So I allocated them in reverse
order starting at f15 to avoid taking the first argument registers.
This appears to match gcc allocation order.

Reviewed By: asb

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

19 months ago[flang] Catch impure defined assignments in DO CONCURRENT
Peter Klausler [Fri, 17 Mar 2023 23:01:47 +0000 (16:01 -0700)]
[flang] Catch impure defined assignments in DO CONCURRENT

The semantic checking of DO CONCURRENT bodies looks only at the
parse tree, not the typed expressions produced from it, so it
misses calls to defined assignment subroutines that arise from
assignment statements that resolve via generic interfaces into
subroutine calls.  Extend the checking to peek into the typed
assignment operations left on the parse tree by semantics.

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

19 months ago[OpenMP] Fix an OpenMP Windows build problem
Vadim Paretsky [Tue, 28 Mar 2023 00:20:54 +0000 (17:20 -0700)]
[OpenMP] Fix an OpenMP Windows build problem

When building OpenMP as part of LLVM, CMAKE was generating incorrect
location references for OpenMP build's first step's artifacts being used
in regenerating its Windows import library in the second step. The fix is
to feed a dummy non-buildable, rather than buildable, source to CMAKE to
satisfy its source requirements removing the need to reference the first
step's artifacts in the second step altogether.

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

19 months ago[flang] Detect image control statements in non-construct IF statements
Peter Klausler [Fri, 17 Mar 2023 22:26:25 +0000 (15:26 -0700)]
[flang] Detect image control statements in non-construct IF statements

The utility routine in semantics that determines whether an
executable construct constitutes an image control statement
was not examining the single action statement controlled by
a non-construct IF statement, e.g. 'IF(P) STOP'.

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

19 months agoAdded instruction to join the llvm discourse and discord group.
Usman Akinyemi [Tue, 28 Mar 2023 00:00:14 +0000 (17:00 -0700)]
Added instruction to join the llvm discourse and discord group.

Added instruction and link to join the llvm discord and discourse group
in the CONTRIBUTING.md files

Reviewed By: keith

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

19 months ago[flang] Tune handling of LEN type parameter discrepancies on ALLOCATE
Peter Klausler [Fri, 17 Mar 2023 21:13:39 +0000 (14:13 -0700)]
[flang] Tune handling of LEN type parameter discrepancies on ALLOCATE

Presently, semantics doesn't check for discrepancies between known
constant corresponding LEN type parameters between the declared type
of an allocatable/pointer and either the type-spec or the SOURCE=/MOLD=
on an ALLOCATE statement.

This allows discrepancies between character lengths to go unchecked.
Some compilers accept mismatched character lengths on SOURCE=/MOLD=
and the allocate object, and that's useful and unambiguous feature
that already works in f18 via truncation or padding.  A portability
warning should issue, however.

But for mismatched character lengths between an allocate object and
an explicit type-spec, and for any mismatch between derived type
LEN type parameters, an error is appropriate.

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

19 months ago[mlir][sparse] rephrase the documentation for sparse compiler create-sparse-deallocs...
Peiming Liu [Mon, 27 Mar 2023 23:45:54 +0000 (23:45 +0000)]
[mlir][sparse] rephrase the documentation for sparse compiler create-sparse-deallocs option.

To address post-submit comments in https://reviews.llvm.org/D147010.

Reviewed By: wrengr

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

19 months ago[dsymutil] Add the ability to generate universal binaries with a fat64 header
Jonas Devlieghere [Mon, 27 Mar 2023 16:25:21 +0000 (09:25 -0700)]
[dsymutil] Add the ability to generate universal binaries with a fat64 header

Add the ability to generate universal binaries with a fat64 header.

rdar://107223939

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

19 months ago[flang] Consolidate and enhance pointer assignment checks
Peter Klausler [Thu, 16 Mar 2023 19:41:25 +0000 (12:41 -0700)]
[flang] Consolidate and enhance pointer assignment checks

Consolidate aspects of pointer assignment & structure constructor pointer component
checking from Semantics/assignment.cpp and /expression.cpp into /pointer-assignment.cpp,
and add a warning about data targets that are not definable objects
but not hard errors.  Specifically, a structure component pointer component data
target is not allowed to be a USE-associated object in a pure context by a numbered
constraint, but the right-hand side data target of a pointer assignment statement
has no such constraint, and that's the new warning.

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

19 months ago[mlir][sparse] add create-sparse-deallocs options to match the create-deallocs in...
Peiming Liu [Mon, 27 Mar 2023 22:56:52 +0000 (22:56 +0000)]
[mlir][sparse] add create-sparse-deallocs options to match the create-deallocs in BufferizationOption.

Reviewed By: aartbik

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

19 months ago[flang] Catch more bad DATA statement objects
Peter Klausler [Thu, 16 Mar 2023 00:57:58 +0000 (17:57 -0700)]
[flang] Catch more bad DATA statement objects

The data statement variable checker is missing some cases, like expressions
that are not variables.  Run the checker first to enjoy its very specific
error messages, but when it finds no problems, still apply a general
check that an expression is a "variable" and also not a constant expression
at the top level as a backstop.

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

19 months ago[llvm-c][ORC] Fix LLVMOrcObjectLayerAddObjectFileWithRT.
Jakob Leifhelm [Mon, 27 Mar 2023 23:03:36 +0000 (16:03 -0700)]
[llvm-c][ORC] Fix LLVMOrcObjectLayerAddObjectFileWithRT.

The LLVMOrcObjectLayerAddObjectFileWithRT method does not have an
implementation. LLVMOrcLLJITAddObjectFileWithRT exists twice (maybe a copy
paste error).

Reviewed By: lhames

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

19 months ago[NVPTX] Add __CUDA_ARCH__ macro to standalone NVPTX compilations
Joseph Huber [Mon, 27 Mar 2023 15:19:16 +0000 (10:19 -0500)]
[NVPTX] Add __CUDA_ARCH__ macro to standalone NVPTX compilations

We can now target the NVPTX architecture directly via
`--target=nvptx64-nvidia-cuda`. This currently does not define the
`__CUDA_ARCH__` macro with is used to allow code to target different
codes based on support. This patch simply adds this support.

Reviewed By: tra, jdoerfert

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

19 months ago[lldb] Fix double free in python bindings error handling.
Jorge Gorbe Moya [Mon, 27 Mar 2023 21:46:08 +0000 (14:46 -0700)]
[lldb] Fix double free in python bindings error handling.

If we have a `%typemap(freearg)` that frees the argument, we shouldn't
free it manually on an error path before calling `SWIG_fail`.
`SWIG_fail` will already free the memory in this case, and doing it
manually results in a double free.

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

19 months ago[NFC][scciter] Update code comments.
Hongtao Yu [Mon, 27 Mar 2023 23:04:52 +0000 (16:04 -0700)]
[NFC][scciter] Update code comments.

19 months ago[flang] Move SAVE attribute checks to declaration checking
Peter Klausler [Wed, 15 Mar 2023 23:50:31 +0000 (16:50 -0700)]
[flang] Move SAVE attribute checks to declaration checking

Constraint checking for explicit SAVE attributes is more
accurate when done along with other declaration checking, rather
than on the fly during name resolution.  This allows us to
catch attempts to attach explicit SAVE attributes to anything
that can't have one (constraints C859, C860).

Also delete `IsSave()`, whose few remaining uses were changed to the
more general `IsSaved()` predicate that seems more correct for
those uses, returning true for both explicit and implied SAVE
attributes.

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

19 months ago[flang] Fix check for PRIVATE override of PUBLIC t.b.p.
Peter Klausler [Wed, 15 Mar 2023 20:06:20 +0000 (13:06 -0700)]
[flang] Fix check for PRIVATE override of PUBLIC t.b.p.

A PRIVATE procedure binding in a derived type extension may not
be an override of a PUBLIC procedure binding.  Declaration checking
for this case was working only in the presence of an explicit
PUBLIC accessibility attribute, when it should be checking for the
absence of a PRIVATE accessibility attribute.

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

19 months ago[flang] Reimplement C1406 check as a warning
Peter Klausler [Wed, 15 Mar 2023 19:21:04 +0000 (12:21 -0700)]
[flang] Reimplement C1406 check as a warning

Constraint C1406 in Fortran 2018 prohibits the USE of the same module
name as both an intrinsic module and a non-intrinsic module in a scope.
The current check misinterprets the constraint as applying only to
explicitly INTRINSIC or NON_INTRINSIC module natures.

Change the check to also apply to non-explicit module natures, and
also downgrade it to a portability warning, since there is no ambiguity
and I suspect that we need to accept this usage when building f18's
own intrinsic modules.

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

19 months ago[libc] Fix longjmp's fake return in x86_64
Mikhail R. Gadelha [Mon, 27 Mar 2023 22:41:39 +0000 (19:41 -0300)]
[libc] Fix longjmp's fake return in x86_64

This implements the fake return after a successful longjmp(), as
described in the linux man page:

Following  a  successful  longjmp(), execution continues as if setjmp()
had returned for a second time.  This  "fake"  return  can  be  distin-
guished from a true setjmp() call because the "fake" return returns the
value provided in val.  If the programmer mistakenly passes the value 0
in val, the "fake" return will instead return 1.

Reviewed By: sivachandra

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

19 months ago[DWARF][GDB INDEX] Fix to deal with constant pool de-dupliation Summary:
Alexander Yermolovich [Wed, 22 Mar 2023 20:25:48 +0000 (13:25 -0700)]
[DWARF][GDB INDEX] Fix to deal with constant pool de-dupliation Summary:

GDB 11.2 generates V8 version of gdb-index where it de-duplicates entries in
constant pool based on cu indices. Changed how constant pool entries are counted
to account for this.

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

19 months ago[flang] Emit error when a positional actual argument follows an argument with a keyword
Peter Klausler [Wed, 15 Mar 2023 00:11:48 +0000 (17:11 -0700)]
[flang] Emit error when a positional actual argument follows an argument with a keyword

A positional (non-keyword) actual argument or alternate return label is not
allowed to follow an actual argument with a keyword.

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

19 months ago[flang] Warn about inconsistent external procedure interfaces
Peter Klausler [Tue, 14 Mar 2023 23:02:30 +0000 (16:02 -0700)]
[flang] Warn about inconsistent external procedure interfaces

When multiple scopes in a compilation define interfaces (explicit
or implicit) for an external procedure, warn when those interfaces
are inconsistent.

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

19 months ago[flang] Catch attempt to apply ASYNCHRONOUS attribute to a non-variable
Peter Klausler [Tue, 14 Mar 2023 20:10:25 +0000 (13:10 -0700)]
[flang] Catch attempt to apply ASYNCHRONOUS attribute to a non-variable

Complain about the ASYNCHRONOUS attribute on symbols that aren't
variables.

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

19 months ago[mlir] tosa.concat - fix isCompatibleReturnTypes()
Maya Amrami [Mon, 27 Mar 2023 21:59:25 +0000 (21:59 +0000)]
[mlir] tosa.concat - fix isCompatibleReturnTypes()

Reviewed By: eric-k256

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

19 months ago[flang] Diagnose bad attributes of implicit interface externals
Peter Klausler [Tue, 14 Mar 2023 19:38:26 +0000 (12:38 -0700)]
[flang] Diagnose bad attributes of implicit interface externals

Procedures with the EXTERNAL attribute (explicit or implied) are
not permitted to be ALLOCATABLE or be arrays if their interfaces
are implicit.

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

19 months ago[mlir] Add support for non-f32 polynomial approximation
Robert Suderman [Mon, 27 Mar 2023 20:55:32 +0000 (20:55 +0000)]
[mlir] Add support for non-f32 polynomial approximation

Polynomial approximations assume F32 values. We can convert all non-f32
cases to operate on f32s with intermediate casts.

Reviewed By: jpienaar

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

19 months ago[docs] Fix code example: the JITLink APIs use ExecutorAddr now.
Lang Hames [Mon, 27 Mar 2023 21:56:04 +0000 (14:56 -0700)]
[docs] Fix code example: the JITLink APIs use ExecutorAddr now.

19 months ago[flang] Handle dynamic and remotely scoped non-type-bound UDDTIO subroutines
Peter Klausler [Fri, 10 Mar 2023 23:06:01 +0000 (15:06 -0800)]
[flang] Handle dynamic and remotely scoped non-type-bound UDDTIO subroutines

The present I/O infrastructure for user-defined derived type I/O
subroutines works fine for type-bound I/O generic bindings.  It also works
for explicit INTERFACE blocks and GENERIC statements that define
UDDIO subroutines in the same scope as the definition of the derived type,
so long as the specific procedures in those bindings are module procedures
or external procedures.

For non-type-bound UDDTIO specific procedures that are dummy procedures,
thunks of inner procedures, or procedure pointers, or that are defined with
interfaces or GENERIC outside the scope of the definition of the derived
type, a new runtime I/O API is needed so that lowering can generate
a call that supplies the appropriate procedure as well as the defined
type instance.

This patch specifies and implements this new runtime API and provides
utility routines for lowering to use to determine whether it should be
called for any particular OutputItem or InputItem in the parse tree.

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

19 months ago[NFC] Remove unused member variable `PolicyBitMask` in SemaRecord
Chittireddy, Sindhu [Fri, 24 Mar 2023 21:12:17 +0000 (17:12 -0400)]
[NFC] Remove unused member variable `PolicyBitMask` in SemaRecord

Coverity static analysis tool found PolicyBitMask being used
uninitialized in push_back call in RVVEmitter::createRVVIntrinsics()
but this variable has no uses.

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

19 months ago[gn build] Port 158a431227a8
LLVM GN Syncbot [Mon, 27 Mar 2023 21:13:05 +0000 (21:13 +0000)]
[gn build] Port 158a431227a8

19 months agoRevert ExtractAPI from https://reviews.llvm.org/D146656
Daniel Grumberg [Mon, 27 Mar 2023 21:12:11 +0000 (22:12 +0100)]
Revert ExtractAPI from https://reviews.llvm.org/D146656

19 months ago[clang-format] Don't annotate left brace of struct as FunctionLBrace
Owen Pan [Sun, 26 Mar 2023 02:31:57 +0000 (19:31 -0700)]
[clang-format] Don't annotate left brace of struct as FunctionLBrace

Related to a02c3af9f19d. Fixes #61700.

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

19 months agoFix incorrect .mailmap entry
Min-Yih Hsu [Mon, 27 Mar 2023 21:02:10 +0000 (14:02 -0700)]
Fix incorrect .mailmap entry

Of my contact email. Sorry for the churn.

19 months ago[CODE_OWNERS] Update my contact information
Min-Yih Hsu [Mon, 27 Mar 2023 20:51:53 +0000 (13:51 -0700)]
[CODE_OWNERS] Update my contact information

As well as updating .mailmap

19 months ago[RISCV] Replace an 'else if' with 'else'+assert. NFC
Craig Topper [Mon, 27 Mar 2023 20:48:06 +0000 (13:48 -0700)]
[RISCV] Replace an 'else if' with 'else'+assert. NFC

There are only two cases here. Using an assert ensures there is
no handled third case.

Also move comment to avoid odd formatting.

Reviewed By: reames

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

19 months ago[gn build] Port 41b6d5863fef
LLVM GN Syncbot [Mon, 27 Mar 2023 20:45:22 +0000 (20:45 +0000)]
[gn build] Port 41b6d5863fef

19 months agoRevert "[lldb] Move UnixSignals creation into Platform plugins"
Alex Langford [Mon, 27 Mar 2023 20:33:06 +0000 (13:33 -0700)]
Revert "[lldb] Move UnixSignals creation into Platform plugins"

This reverts commit ee232506b870ce5282cc4da5ca493d41d361feb3.
As discussed in https://reviews.llvm.org/D146668 we'll find another way
forward.

19 months agoRevert "[lldb-server] Use Platform plugin corresponding to the host"
Alex Langford [Mon, 27 Mar 2023 20:32:48 +0000 (13:32 -0700)]
Revert "[lldb-server] Use Platform plugin corresponding to the host"

This reverts commit 0c5cee779929f840f4f286c5894a01f583ee7b4a.
As discussed in https://reviews.llvm.org/D146668 we'll find another way
forward.

19 months ago[lld-macho] Support re-exports of individual symbols
Jez Ng [Mon, 27 Mar 2023 20:39:37 +0000 (16:39 -0400)]
[lld-macho] Support re-exports of individual symbols

Specifically, we support this:

  ld64.lld -dylib foo.o libbar.dylib -exported_symbol _bar -o libfoo.dylib

Where `_bar` is defined in libbar.dylib.

Reviewed By: #lld-macho, smeenai

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

19 months ago[lldb] Remove NO_PLUGIN_DEPENDENCIES from lldbTarget
Alex Langford [Mon, 27 Mar 2023 20:35:46 +0000 (13:35 -0700)]
[lldb] Remove NO_PLUGIN_DEPENDENCIES from lldbTarget

As discussed in https://reviews.llvm.org/D146668 I will be reverting
0c5cee779929f840f4f286c5894a01f583ee7b4a and ee232506b870ce5282cc4da5ca493d41d361feb3.
I'm removing NO_PLUGIN_DEPENDENCIES from lldbTarget first so that these
reverts will not leave LLDB in a bad state afterwards.

19 months ago[RISCV] Rename FeatureExtZc* to FeatureStdExtZc*. NFC
Craig Topper [Mon, 27 Mar 2023 20:19:01 +0000 (13:19 -0700)]
[RISCV] Rename FeatureExtZc* to FeatureStdExtZc*. NFC

Even for experimental extensions, I think we always include "Std"
in the feature name.

Reviewed By: asb

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

19 months agowrite semantics tests for CHANGE TEAM statement.
Hussain Kadhem [Mon, 20 Mar 2023 17:33:01 +0000 (10:33 -0700)]
write semantics tests for CHANGE TEAM statement.

Added semantics tests for aspects of CHANGE TEAM statements which are not duplicates from FORM TEAM statements.

Reviewed By: ktras

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

19 months agoRecommit "[RISCV] Add .insn support for compressed formats."
Craig Topper [Mon, 27 Mar 2023 19:30:37 +0000 (12:30 -0700)]
Recommit "[RISCV] Add .insn support for compressed formats."

I think the failure was caused by a mistake in an earlier patch.

Original commit message:

We've supported .insn for non-compressed for a while. This finishes the compressed supported.

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

19 months ago[M68k] Add support for lowering i1 SIGN_EXTEND_INREG
Min-Yih Hsu [Mon, 27 Mar 2023 19:12:39 +0000 (12:12 -0700)]
[M68k] Add support for lowering i1 SIGN_EXTEND_INREG

Lowering i1 (inreg) sext with `(NEG (AND %val, 1))`.

19 months ago[RISCV] Handle non-recursive muls of strides in gather/scatter lowering
Luke Lau [Mon, 27 Mar 2023 16:13:15 +0000 (17:13 +0100)]
[RISCV] Handle non-recursive muls of strides in gather/scatter lowering

The gather scatter lowering pass can fold multiplies of a step vector
into the stride for the recursive case, so this extends it for the
non-recursive case.
The logic can probably be shared between the two at some point to extend
it to shls and ors.

Reviewed By: reames

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

19 months ago[RISCV] Add tests for gather scatter pass for non-recursive mul strides
Luke Lau [Mon, 27 Mar 2023 16:02:16 +0000 (17:02 +0100)]
[RISCV] Add tests for gather scatter pass for non-recursive mul strides

Reviewed By: craig.topper

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

19 months agoEnsure I'm listed as MSP430 code owner
Anton Korobeynikov [Mon, 27 Mar 2023 19:10:12 +0000 (12:10 -0700)]
Ensure I'm listed as MSP430 code owner

19 months agoFix bazel build for mlir-opt
Chenguang Wang [Mon, 27 Mar 2023 18:44:15 +0000 (11:44 -0700)]
Fix bazel build for mlir-opt

Tested locally with `bazel build --repo_env=CC=clang --repo_env=BAZEL_CXXOPTS="-std=c++17" @llvm-project//mlir:mlir-opt`.

Reviewed By: jyknight

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

19 months agoAdded checking for completeness of lvalue in conditional operator
Aditya Singh [Mon, 27 Mar 2023 18:45:43 +0000 (14:45 -0400)]
Added checking for completeness of lvalue in conditional operator

Given:
```
struct x y;
int main(void)
{
    (void)(1 ? y : y);
}
struct x {int i;};
```
The conditional operator(?:) requires the second and third operands to
be of compatible types. To be compatible, they also need to be
complete (however, both can be void). Therefore, the expected response
from clang after running the above code as a C program should be error
dialogue pointing out that both the types are incomplete hence
incompatible, but the code compiled without any errors.

The patch ensures the completeness in the CheckCondtionalOperand
function present in llvm-project/clang/lib/Sema/SemaChecking.cpp.

Fixes https://github.com/llvm/llvm-project/issues/59718
Differential Revision: https://reviews.llvm.org/D144358

19 months ago[libc] Simplify enabling the GPU build for libc
Joseph Huber [Mon, 27 Mar 2023 16:05:11 +0000 (11:05 -0500)]
[libc] Simplify enabling the GPU build for libc

Currently the GPU build requires the `LLVM_LIBC_FULL_BUILD` option to be
set. This patch changes the logic so that it is always enabled when
targeting the GPU. Also, this patch allows `LIBC_GPU_BUILD` and
`LIBC_GPU_ARCHITECTURES` to both enable a GPU build. Now, enabling the
GPU support should only require the following CMake:

```
  -DLLVM_ENABLE_RUNTIMES=libc -DLIBC_GPU_ARCHITECTURES=gfx1030
```

Reviewed By: jdoerfert, sivachandra

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

19 months ago[test] Avoid legacy -target and move 2>&1 to conventional location
Fangrui Song [Mon, 27 Mar 2023 18:22:03 +0000 (11:22 -0700)]
[test] Avoid legacy -target and move 2>&1 to conventional location

The 2>&1 moving part is similar to commit 731264b0c2af7aa46bd39625202a99e06cfccff9.

19 months agoRecommit "[RISCV] Relax opcode restriction for .insn."
Craig Topper [Mon, 27 Mar 2023 17:59:08 +0000 (10:59 -0700)]
Recommit "[RISCV] Relax opcode restriction for .insn."

Original commit message:
I recently added a check to make sure the lower 2 bits of the opcode
were 0x3. A post commit comment pointed out this would be allowed
for a custom extension when C is not supported.

Note, binutils does have this restriction.

19 months ago[mlir] Add missing cast functions to mlir namespace
Rahul Kayaith [Fri, 24 Mar 2023 18:25:18 +0000 (14:25 -0400)]
[mlir] Add missing cast functions to mlir namespace

Reviewed By: rriddle

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

19 months ago[M68k] Add support for lowering ATOMIC_SWAP
Min-Yih Hsu [Mon, 27 Mar 2023 17:48:10 +0000 (10:48 -0700)]
[M68k] Add support for lowering ATOMIC_SWAP

Lower to calling __sync_lock_test_and_set_* for target < M68020.

19 months agoRevert "foo"
Craig Topper [Mon, 27 Mar 2023 17:53:14 +0000 (10:53 -0700)]
Revert "foo"

This reverts commit 4fde20b8a62ed3d850e4e770ae640039ca1a9ed8.

I failed to squash this

19 months agoRevert "[RISCV] Relax opcode restriction for .insn."
Craig Topper [Mon, 27 Mar 2023 17:52:56 +0000 (10:52 -0700)]
Revert "[RISCV] Relax opcode restriction for .insn."

This reverts commit 5c5fe3afff12b41d34477977c07c71337fa4ba9d.

This is failing on the build bots

19 months agoRevert "[RISCV] Add .insn support for compressed formats."
Craig Topper [Mon, 27 Mar 2023 17:52:41 +0000 (10:52 -0700)]
Revert "[RISCV] Add .insn support for compressed formats."

This reverts commit 5e2445ae65f0a8f1ac38049bdd2f0fd5572be488.

This is failing on the build bots.

19 months ago[AArch64][PeepholeOpt]Optimize ALU + compare to flag-setting ALU
Mingming Liu [Thu, 23 Mar 2023 20:31:26 +0000 (13:31 -0700)]
[AArch64][PeepholeOpt]Optimize ALU + compare to flag-setting ALU

The motivating example is in https://godbolt.org/z/45nbdYMK9
- For this example, `subs` is generated for the good case; `sub` followed by `cmp` is generated for the bad case. Since signed overflow is undefined behavior in C/C++ (indicated as `nsw` flag in LLVM IR), `subs` should be generated for the good case as well.

This patch relaxes one restriction from "quit optimization when V is used" to "continue if MI produces poison value when signed overflow occurs". This is not meant to be C/C++ specific since it looks at 'NoSWrap' since it looks at MachineInstr flags.

Reviewed By: dmgreen

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

19 months ago[NFC]Pre-commit test case
Mingming Liu [Thu, 23 Mar 2023 07:41:19 +0000 (00:41 -0700)]
[NFC]Pre-commit test case

Pre-commit test cases to show missed icmp-opt with flag-setting ALUs

Reviewed By: dmgreen

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

19 months ago[SCCIterator] Fix an issue in scc_member_iterator sorting
Hongtao Yu [Tue, 21 Mar 2023 17:57:11 +0000 (10:57 -0700)]
[SCCIterator] Fix an issue in scc_member_iterator sorting

Members in an scc are supposed to be sorted in a top-down or topological order based on edge weights. Previously this is achived by building a MST out of the SCC and enforcing an BFS walk on the MST. A BFS on a tree does give a top-down topological order, however, the MST built here isn't really a tree. This is becuase of a trick done to avoid expansive detection of a cycle on a directed graph when an edge is added. When the MST is built, its edges are considered undirected. But in reality they are directed, thus a BST walk doesn't necessarily give a topological order. I'm tweaking the BFS walk slightly to yield a topological order.

Basically I'm using Kahn's algorithm on MST to compute a topological traversal order. The algorithm starts from nodes that have no incoming edge. These nodes are "roots" of the MST forest. This ensures that nodes are visited before their descendants are, thus ensures a topological traversal order of the MST.

Reviewed By: wenlei

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

19 months ago[RISCV] Add .insn support for compressed formats.
Craig Topper [Mon, 27 Mar 2023 17:27:59 +0000 (10:27 -0700)]
[RISCV] Add .insn support for compressed formats.

We've supported .insn for non-compressed for a while. This finishes the compressed supported.

Reviewed By: asb

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

19 months ago[RISCV] Relax opcode restriction for .insn.
Craig Topper [Mon, 27 Mar 2023 17:24:52 +0000 (10:24 -0700)]
[RISCV] Relax opcode restriction for .insn.

I recently added a check to make sure the lower 2 bits of the opcode
were 0x3. A post commit comment pointed out this would be allowed
for a custom extension when C is not supported.

Note, binutils does have this restriction.

19 months agofoo
Craig Topper [Mon, 27 Mar 2023 17:06:34 +0000 (10:06 -0700)]
foo

19 months ago[LegalizeTypes][TargetLowering][RISCV] Fix regressions from D146786.
Craig Topper [Mon, 27 Mar 2023 16:55:09 +0000 (09:55 -0700)]
[LegalizeTypes][TargetLowering][RISCV] Fix regressions from D146786.

Add some special cases for UADDO to recover codegen after D146786.

Reviewed By: reames, liaolucy

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

19 months ago[CodeGenPrepare][RISCV] Correct the MathUsed flag for shouldFormOverflowOp
Craig Topper [Mon, 27 Mar 2023 16:51:46 +0000 (09:51 -0700)]
[CodeGenPrepare][RISCV] Correct the MathUsed flag for shouldFormOverflowOp

For add, if we match the constant edge case the add isn't used by
the compare so we shouldn't check for 2 users.

For sub, the compare is not a user of the sub so the math is
used if the sub has any users.

This regresses RISC-V which I will work on other patches for.

Reviewed By: RKSimon

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

19 months ago[X86] select-constant-lea.ll - cleanup test name. NFC.
Simon Pilgrim [Mon, 27 Mar 2023 16:56:05 +0000 (17:56 +0100)]
[X86] select-constant-lea.ll - cleanup test name. NFC.

Drop the trailing j function signature artifact.

19 months ago[SLP] Add test to check for GEP vectorization
Zain Jaffal [Mon, 27 Mar 2023 16:52:07 +0000 (17:52 +0100)]
[SLP] Add test to check for GEP vectorization

add a test to check for gep vectorization after the change from D144128 where the gep vectorization is dependant on the target hook `prefersVectorizedAddressing()`

Reviewed By: fhahn

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

19 months ago[RISCV] Replace RISCV->RISC-V in strings.
Craig Topper [Mon, 27 Mar 2023 16:20:07 +0000 (09:20 -0700)]
[RISCV] Replace RISCV->RISC-V in strings.

To be consistent with RISC-V branding guidelines
https://riscv.org/about/risc-v-branding-guidelines/
Think we should be using RISC-V where possible.

D146449 already updated comments. Strings may have more user impact.

Reviewed By: asb

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

19 months ago[RISCV] Replace RISCV -> RISC-V in comments. NFC
Craig Topper [Mon, 27 Mar 2023 16:15:53 +0000 (09:15 -0700)]
[RISCV] Replace RISCV -> RISC-V in comments. NFC

To be consistent with RISC-V branding guidelines
https://riscv.org/about/risc-v-branding-guidelines/
Think we should be using RISC-V where possible.

More patches will follow.

Reviewed By: asb

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

19 months ago[X86] Regenerate avx2-vector-shifts.ll check prefixes
Simon Pilgrim [Mon, 27 Mar 2023 16:46:21 +0000 (17:46 +0100)]
[X86] Regenerate avx2-vector-shifts.ll check prefixes

Add common CHECK prefix

19 months ago[libc++] Use named Lit features to flag back-deployment XFAILs
Louis Dionne [Sat, 18 Mar 2023 14:05:19 +0000 (10:05 -0400)]
[libc++] Use named Lit features to flag back-deployment XFAILs

Instead of writing something like `XFAIL: use_system_cxx_lib && target=...`
to XFAIL back-deployment tests, introduce named Lit features like
`availability-shared_mutex-missing` to represent those. This makes the
XFAIL annotations leaner, and solves the problem of XFAIL comments
potentially getting out of sync. This would also make it easier for
another vendor to add their own annotations to the test suite by simply
changing how the feature is defined for their OS releases, instead
of having to modify hundreds of tests to add repetitive annotations.

This doesn't touch *all* annotations -- only annotations that were widely
duplicated are given named features (e.g. when filesystem or shared_mutex
were introduced). I still think it probably doesn't make sense to have a
named feature for every single fix we make to the dylib.

This is in essence a revert of 2659663, but since then the test suite
has changed significantly. Back when I did 2659663, the configuration
files we have for the test suite right now were being bootstrapped and
it wasn't clear how to provide these features for back-deployment in
that context. Since then, we have a streamlined way of defining these
features in `features.py` and that doesn't impact the ability for a
configuration file to stay minimal.

The original motivation for this change was that I am about to propose
a change that would touch essentially all XFAIL annotations for back-deployment
in the test suite, and this greatly reduces the number of lines changed
by that upcoming change, in addition to making the test suite generally
better.

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

19 months ago[diagtool] explain that yellow is used to denote disabled-by-default warnings
Nick Desaulniers [Mon, 27 Mar 2023 16:38:05 +0000 (09:38 -0700)]
[diagtool] explain that yellow is used to denote disabled-by-default warnings

This is already implied, but let's just be explicit about it.

Reviewed By: MaskRay

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

19 months ago[LinkerWrapper] Do not extract globals with no offloading language
Joseph Huber [Fri, 17 Mar 2023 20:10:25 +0000 (15:10 -0500)]
[LinkerWrapper] Do not extract globals with no offloading language

The linker wrapper needs to reinvent its own special static library
handling for static libraries containing fatbinaries. This is primarily
because offloading languages expect certain global symbols to be visible
to the host so we must consider them used symbols. However we should be
able to remove this requirement if we are linking in "freestanding" code
that was not created by an offloading language.

The motivation for this is to support the work-in-progress `libc` for
GPUs. It is provided as a static library with no offloading language
set. This logic will let us only import used `libc` symbols always.

Reviewed By: yaxunl

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

19 months ago[X86] Regenerate avx2-shift.ll check prefixes
Simon Pilgrim [Mon, 27 Mar 2023 16:34:41 +0000 (17:34 +0100)]
[X86] Regenerate avx2-shift.ll check prefixes

Add common CHECK prefix, and rename X32 -> X86 (we try to use X32 for gnux32 triples)

19 months ago[gn build] Port ea35740e7e18
LLVM GN Syncbot [Mon, 27 Mar 2023 16:24:59 +0000 (16:24 +0000)]
[gn build] Port ea35740e7e18

19 months agoAddress code review feedback
Daniel Grumberg [Wed, 22 Mar 2023 23:22:48 +0000 (23:22 +0000)]
Address code review feedback