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
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
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
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
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
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
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
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
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
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
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
Lang Hames [Mon, 27 Mar 2023 21:56:04 +0000 (14:56 -0700)]
[docs] Fix code example: the JITLink APIs use ExecutorAddr now.
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
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
LLVM GN Syncbot [Mon, 27 Mar 2023 21:13:05 +0000 (21:13 +0000)]
[gn build] Port
158a431227a8
Daniel Grumberg [Mon, 27 Mar 2023 21:12:11 +0000 (22:12 +0100)]
Revert ExtractAPI from https://reviews.llvm.org/D146656
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
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.
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
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
LLVM GN Syncbot [Mon, 27 Mar 2023 20:45:22 +0000 (20:45 +0000)]
[gn build] Port
41b6d5863fef
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.
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.
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
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.
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
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
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
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))`.
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
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
Anton Korobeynikov [Mon, 27 Mar 2023 19:10:12 +0000 (12:10 -0700)]
Ensure I'm listed as MSP430 code owner
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
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
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
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.
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.
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
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.
Craig Topper [Mon, 27 Mar 2023 17:53:14 +0000 (10:53 -0700)]
Revert "foo"
This reverts commit
4fde20b8a62ed3d850e4e770ae640039ca1a9ed8.
I failed to squash this
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
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.
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
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
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
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
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.
Craig Topper [Mon, 27 Mar 2023 17:06:34 +0000 (10:06 -0700)]
foo
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
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
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.
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
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
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
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
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
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
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
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)
LLVM GN Syncbot [Mon, 27 Mar 2023 16:24:59 +0000 (16:24 +0000)]
[gn build] Port
ea35740e7e18
Daniel Grumberg [Wed, 22 Mar 2023 23:22:48 +0000 (23:22 +0000)]
Address code review feedback
Daniel Grumberg [Wed, 22 Mar 2023 18:50:59 +0000 (18:50 +0000)]
[clang][ExtractAPI] Refactor ExtractAPIVisitor to make it more extensible
Use CRTP to enable creating statically dispatched subclasses of
ExtractAPIVisitor.
This enables adding extension points and customising the behavior more
easily.
This is used in CXExtractAPI.cpp to create a specialized visitor for
Libclang as well as streamlining the batch implementation in ExtractAPIConsumer.cpp
[clang][ExtractAPI] Improve tests for clang_getSymbolGraphForCursor
Adds a new mode to c-index-test that can fetch a single symbol symbol
graph for a given source location. This way we can be more precise when
writing tests for clang_getSymbolGraphForCursor.
Additionaly this makes it easier to debug the function.
Differential Revision: https://reviews.llvm.org/D146656
Daniel Grumberg [Wed, 22 Mar 2023 18:43:24 +0000 (18:43 +0000)]
[clang][ExtractAPI] Refactor ExtractAPIVisitor to make it more extensible
Use CRTP to enable creating statically dispatched subclasses of
ExtractAPIVisitor.
This enables adding extension points and customising the behavior more
easily.
This is used in CXExtractAPI.cpp to create a specialized visitor for
Libclang as well as streamlining the batch implementation in ExtractAPIConsumer.cpp
Ingo Müller [Tue, 21 Feb 2023 11:21:25 +0000 (11:21 +0000)]
[mlir] Implement pass utils for 1:N type conversions.
The current dialect conversion does not support 1:N type conversions.
This commit implements a (poor-man's) dialect conversion pass that does
just that. To keep the pass independent of the "real" dialect conversion
infrastructure, it provides a specialization of the TypeConverter class
that allows for N:1 target materializations, a specialization of the
RewritePattern and PatternRewriter classes that automatically add
appropriate unrealized casts supporting 1:N type conversions and provide
converted operands for implementing subclasses, and a conversion driver
that applies the provided patterns and replaces the unrealized casts
that haven't folded away with user-provided materializations.
The current pass is powerful enough to express many existing manual
solutions for 1:N type conversions or extend transforms that previously
didn't support them, out of which this patch implements call graph type
decomposition (which is currently implemented with a ValueDecomposer
that is only used there).
The goal of this pass is to illustrate the effect that 1:N type
conversions could have, gain experience in how patterns should be
written that achieve that effect, and get feedback on how the APIs of
the dialect conversion should be extended or changed to support such
patterns. The hope is that the "real" dialect conversion eventually
supports such patterns, at which point, this pass could be removed
again.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D144469
Kazu Hirata [Mon, 27 Mar 2023 16:02:19 +0000 (09:02 -0700)]
[X86] Teach computeKnownBitsForTargetNode about MUL_IMM
This patch teaches computeKnownBitsForTargetNode about MUL_IMM.
MUL_IMM comes up in certain select of constants. Specifically, it is
used to multiply the result of SETCC. Computing the known zero bits
of MUL_IMM allows matchAddressRecursively us to convert some OR into
ADD, which eventually becomes a part of LEA.
This patch fixes:
https://github.com/llvm/llvm-project/issues/61365
Differential Revision: https://reviews.llvm.org/D146787
Balázs Kéri [Mon, 27 Mar 2023 14:53:02 +0000 (16:53 +0200)]
[clang][ASTImporter] Import typedefs to distinct records as distinct nodes.
When a typedef node is imported, ASTImporter should not find an existing similar
typedef node for it that comes from different context (translation unit or scope).
This should avoid a situation where an existing typedef declaration is returned
at import of a typedef, but the underlying type was already imported as a new
type object.
Reviewed By: vabridgers
Differential Revision: https://reviews.llvm.org/D145479
Simon Pilgrim [Mon, 27 Mar 2023 15:03:04 +0000 (16:03 +0100)]
[X86] Move combineVectorSizedSetCCEquality above MatchVectorAllZeroTest. NFC.
The plan is to merge most of the functionality of both of these into a single 'match vector sized data' function.
Wael Yehia [Tue, 28 Feb 2023 04:26:52 +0000 (23:26 -0500)]
[AIX][Driver] Implement -mxcoff-build-id option
The -mxcoff-build-id=0xHEXSTRING option is an alternative to the
--build-id=0xHEXSTRING linker option that is not currently available in
the AIX linker.
If HEXSTRING is an odd number of hex digits then a '0' character is prepended.
The characters ':' and '-' are not allowed (unlike the GNU linker option).
The given build-id will be saved in the string table of the loader section.
A subsequent commit will teach the profile runtime to read and use the embedded id.
Reviewed By: daltenty, qiongsiwu1, stephenpeckham
Differential Revision: https://reviews.llvm.org/D146431
Ties Stuij [Mon, 27 Mar 2023 15:31:50 +0000 (16:31 +0100)]
[llvm-exegesis] if lit can't find llvm-exegesis, fail gracefully
currently in can_use_perfcounters() in
llvm/test/tools/llvm-exegesis/lit.local.cfg, we check if we can execute
llvm-exegesis. But we don't check if we did actually find llvm-exegesis. If we
didn't, lit.util.which() will return None, and we try to execute that.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D146964
Alex Zinenko [Mon, 27 Mar 2023 14:53:11 +0000 (14:53 +0000)]
[mlir] FuncToLLVM: fail gracefully in bare pointer multi-result covnersion
When type conversion fails, return pattern failure instead of crashing.
Closes #61717.
Jakub Kuderski [Mon, 27 Mar 2023 14:28:36 +0000 (10:28 -0400)]
[ADT] Work around MSVC bug affecting `get(enumerator_result)`
This happened on a small number of MSVC releases (19.31.31xxx, Visual Studio 2022 17.1.x), and worked fine on everything else.
The issue seemed to be related to return type deduction on a function with and `if constexpr`; the compiler got confused and deduced different function return type from the type of the return statement.
The workaround is to split `get` into two functions using `enable_if`.
Reviewed By: dstuttard
Differential Revision: https://reviews.llvm.org/D146893
Viktoriia Bakalova [Thu, 23 Mar 2023 15:15:32 +0000 (15:15 +0000)]
[clangd] Use expansion location for missing include diagnostics.
Differential Revision: https://reviews.llvm.org/D146727
Alexander Hederstaf [Mon, 27 Mar 2023 14:16:11 +0000 (15:16 +0100)]
[clang-format] Improve QualifierAlignment
Qualifiers were not moved for non-pointer non-simple types.
Add additional support for many special cases such as templates,
requires clauses, long qualified names.
Fixes https://github.com/llvm/llvm-project/issues/57154 and
https://github.com/llvm/llvm-project/issues/60898
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D144709
Job Noorman [Mon, 27 Mar 2023 14:10:48 +0000 (16:10 +0200)]
[RISCV] Remove isCall instruction flag from JAL/JALR
As far as I can tell, the instruction flags set in the various
RISCVInstrInfo*.td files are always under-approximations. That is,
something like isTerminator will only be set for opcodes that are
*always* terminators.
The exception seems to be isCall; this is set for JAL/JALR while these
instruction are not always calls. This patch proposes to remove isCall
from JAL/JALR for consistency.
A follow-up patch will add more detailed analysis of some instruction
properties based on MCInstrAnalysis.
Reviewed By: asb, craig.topper
Differential Revision: https://reviews.llvm.org/D146437
David Sherwood [Tue, 14 Mar 2023 18:15:03 +0000 (18:15 +0000)]
[SVE][LoopVectorize] Add option to disable tail-folding for reverse loops
If we use tail-folding for reverse loops that contain loads
and stores then we will need to reverse the loop predicate.
This patch adds a new 'reverse' sve-tail-folding option and
ensures they are not considered 'simple'.
I did this by adding a function called
containsDecreasingPointers to AArch64TargetTransformInfo.cpp
that searches all instructions in the loop for loads or
stores with negative strides.
Differential Revision: https://reviews.llvm.org/D146128
LLVM GN Syncbot [Mon, 27 Mar 2023 13:58:17 +0000 (13:58 +0000)]
[gn build] Port
42058eea7912
Aaron Ballman [Mon, 27 Mar 2023 13:54:29 +0000 (09:54 -0400)]
Document the Clang policies on claiming support for a feature
We do not currently have this written down anywhere, and as a result,
we're sometimes inconsistent with how we handle feature test macros and
the feature status pages. This is an attempt to document what I
understand our existing policies to be instead of defining a new policy.
Note, this is being added to the Clang internals manual because we
don't have a separate document for Clang developer policies. At some
point, I think we may want a standalone document for that, and this
content can be moved there at that time.
Differential Revision: https://reviews.llvm.org/D146420
Alexey Lapshin [Wed, 22 Mar 2023 16:37:15 +0000 (17:37 +0100)]
[reland][ADT] add ConcurrentHashtable class.
ConcurrentHashTable - is a resizeable concurrent hashtable.
The range of resizings is limited up to x2^31.
The hashtable allows only concurrent insertions.
Concurrent hashtable is necessary for the D96035 patch.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D132455
Markus Böck [Mon, 27 Mar 2023 12:13:44 +0000 (14:13 +0200)]
[mlir][AsmPrinter] Fallback to using qualified printer if unqualified output is empty
The current behaviour of always writing the unqualified form of an attribute or type is problematic for any type or attribute that might output an empty string, making it impossible to parse and therefore roundtrip. This is commonly the case for any types or attributes with optional parameters. One would have to currently woarkaround the issue by either changing ones syntax to not be completetly empty or by explicitly using `qualified` in ALL ops using that type or attribute.
This patch fixes that issue by simply checking whether anything was written to the output. In the case there wasn't, it simply falls back to using the normal printer with the dialect prefix. This also makes the default of unqualified printing always correct and safe. The implementation could theoretically still be tricked if the user were to print just a space or similar. I'd argue this'd be user error and not worth handling.
Fixes https://github.com/llvm/llvm-project/issues/61701
Differential Revision: https://reviews.llvm.org/D146944
Joseph Huber [Sat, 25 Mar 2023 02:00:25 +0000 (21:00 -0500)]
[libc] Enable integration tests targeting NVIDIA GPUs
This patch adds the necessary build infrastructure to build and run the
integration tests on NVIDIA GPUs. The NVIDIA `nvlink` linker utility is
what is ultimately used to combine these files into a single executable
image. Unfortunately, their tool does not support static libraries. So
we need to link with every object directly instead. This could be solved
by impelementing a "wrapper" utility around `nvlink` like we used to use
for OpenMP. But for now this should be sufficient.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D146861
Michael Maitland [Sat, 25 Mar 2023 00:16:41 +0000 (17:16 -0700)]
[RISCV] Remove UpperBound from SchedMxList and create WorstCaseBehavior records
Prior to this patch, UpperBound refered to the largest LMUL
supported. Instructions used UpperBound to assign the worst
case behaviour to records, since Instructions are not LMUL
specific. This forced the largest LMUL to have the worst case
behavior, even if that wasn't true for a subtarget.
Now that SchedWrites, SchedReads, WriteRes, and ReadAdvances
are created for (name, LMUL) pairs and (name, LMUL, SEW)
tuples, it becomes even less clear which pair should correspond
to the worst case behavior. Additionally, it no longer makes sense
for the UpperBound to belong to LMUL list and not to the SEW list.
Instead of creating a special UpperBound LMUL and an UpperBound
SEW, this patch renames UpperBound to WorstCaseBehavior, removes
it from the SchedMxList, and defines a WorstCaseBehavior SchedWrite,
SchedRead, WriteRes, and ReadAdvance for each name.
This gives subtargets the ability to describe the worst case behavior
of a record without forcing it to be the largest LMUL or the smallest
SEW.
Differential Revision: https://reviews.llvm.org/D146855
Jay Foad [Mon, 27 Mar 2023 12:29:00 +0000 (13:29 +0100)]
[MC] Quick fix for Windows build failures after D142218
Michael Maitland [Mon, 27 Mar 2023 13:26:25 +0000 (06:26 -0700)]
Revert "[RISCV] Remove UpperBound from SchedMxList and create WorstCaseBehavior records"
This reverts commit
74c0bd240499683078d4f15d31de690950da8231.
Amy Kwan [Sun, 26 Mar 2023 04:04:53 +0000 (23:04 -0500)]
[PowerPC][GISel] Add initial GlobalISel support for vector functions.
This patch adds the initial support for vector functions and register banks
within GlobalISel. With this patch, we are able to support simple functions that
return vectors, and also functions that perform simple operations.
This patch also:
- Legalizes vector types for G_AND, G_OR, G_XOR, G_ADD, G_SUB, G_BITCAST, G_FADD, G_FSUB
- Introduce initial support for bitcasting (that will need to be extended upon)
- Add various different test cases to for test vector support within GlobalISel
Differential Revision: https://reviews.llvm.org/D137785
Amy Kwan [Sun, 26 Mar 2023 04:03:10 +0000 (23:03 -0500)]
[PowerPC] Implement 64-bit ELFv2 Calling Convention in TableGen (for integers/floats/vectors in registers)
This patch partially implements the parameter passing rules outlined in the
ELFv2 ABI within TableGen. Specifically, it implements the parameter assignment
of integers, floats, and vectors within registers - where the GPR numbering will
be "skipped" depending on the ordering of floats and vectors that appear within
a parameter list.
As we begin to adopt GlobalISel to the PowerPC backend, there is a need for a
TableGen definition that encapsulates the ELFv2 parameter passing rules. Thus,
this patch also changes the default calling convention that is returned within
the ccAssignFnForCall() function used in our GlobalISel implementation, and also
adds some additional testing of the calling convention that is implemented.
Future patches that build on top of this initial TableGen definition will aim to
add more of the ABI complexities, including support for additional types and
also in-memory arguments.
Differential Revision: https://reviews.llvm.org/D137504
Benjamin Kramer [Mon, 27 Mar 2023 12:19:18 +0000 (14:19 +0200)]
[JITLink] Drop using namespace
I don't think these are holding their weight and cause nasty to debug
compiler issues with some versions of MSVC as seen in
https://reviews.llvm.org/D144083#4220866
Just qualify the types with the full name.
Michael Maitland [Sat, 25 Mar 2023 00:16:41 +0000 (17:16 -0700)]
[RISCV] Remove UpperBound from SchedMxList and create WorstCaseBehavior records
Prior to this patch, UpperBound refered to the largest LMUL
supported. Instructions used UpperBound to assign the worst
case behaviour to records, since Instructions are not LMUL
specific. This forced the largest LMUL to have the worst case
behavior, even if that wasn't true for a subtarget.
Now that SchedWrites, SchedReads, WriteRes, and ReadAdvances
are created for (name, LMUL) pairs and (name, LMUL, SEW)
tuples, it becomes even less clear which pair should correspond
to the worst case behavior. Additionally, it no longer makes sense
for the UpperBound to belong to LMUL list and not to the SEW list.
Instead of creating a special UpperBound LMUL and an UpperBound
SEW, this patch renames UpperBound to WorstCaseBehavior, removes
it from the SchedMxList, and defines a WorstCaseBehavior SchedWrite,
SchedRead, WriteRes, and ReadAdvance for each name.
This gives subtargets the ability to describe the worst case behavior
of a record without forcing it to be the largest LMUL or the smallest
SEW.
Differential Revision: https://reviews.llvm.org/D146855
Mitch Phillips [Mon, 27 Mar 2023 11:33:53 +0000 (04:33 -0700)]
Revert "[C++20][Modules] Introduce an implementation module."
This reverts commit
c6e9823724ef6bdfee262289ee34d162db436af0.
Reason: Broke the ASan buildbots, see https://reviews.llvm.org/D126959
(the original phabricator review) for more info.
Mitch Phillips [Mon, 27 Mar 2023 11:33:09 +0000 (04:33 -0700)]
Revert "Silence unused variable warning in NDEBUG builds"
This reverts commit
8c7c1f11ffaacf762e612c65440fd2cbb58ee426.
Reason: Dependent change https://reviews.llvm.org/D126959 broke the ASan
buildbots. See that phabricator review for more comments.
Pavel Kosov [Mon, 27 Mar 2023 11:43:08 +0000 (14:43 +0300)]
[llvm-exegesis] Improve test flexibility by using available_features
Currently, all llvm-exegesis regression tests are target-specific and
they are organized so that the entire subdirectories of
llvm/test/tools/llvm-exegesis are enabled or disabled as a whole.
After the commit
e0ad2af691 ("Skip codegen" dry-run mode), at least two
kinds of tests are possible:
1) ensure that a snippet can be *generated* for the particular opcode
2) tests involving actual snippet execution inside the llvm-exegesis
process
Thus, for the particular target subdirectory, some tests should run only
on the particular host architecture and other tests only need the target
being among LLVM_TARGETS_TO_BUILD.
This commit defines a bunch of exegesis-specific features that can be
referenced in REQUIRES, UNSUPPORTED, etc. on a test-by-test basis.
~~
Huawei RRI
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D146302
pvanhout [Mon, 27 Mar 2023 11:27:31 +0000 (13:27 +0200)]
Add Release Note for -mcode-object-v3 removal
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D146945
Akash Banerjee [Tue, 21 Mar 2023 12:12:11 +0000 (12:12 +0000)]
[Flang][OpenMP] Added TODO checks for unsupported map types
This patch adds TODO checks for unspported types in the map clause for OpenMP Target directives.
Example of unsupported code:
implicit none
character(len=10) :: str1, str2(5,5)
type t
character(len=10) :: str1, str2(5,5)
end type t
type(t) :: v
!$omp target enter data map(to: str2(2,5))
!$omp target enter data map(to: v%str1)
!$omp target enter data map(to: v%str2)
!$omp target enter data map(to: v%str2(1,2))
end
Differential Revision: https://reviews.llvm.org/D146292
Ivan Kosarev [Mon, 27 Mar 2023 10:37:16 +0000 (11:37 +0100)]
[TableGen][GlobalISel] Support EXTRACT_SUBREGs for ComplexPattern suboperands.
This makes it possible to write GlobalISel patterns generating
EXTRACT_SUBREG instructions applied to suboperands of ComplexPattern
operands. Currently, TableGen complains that such operands are not
declared in matcher.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D146800
Adrian Kuegel [Mon, 27 Mar 2023 11:03:53 +0000 (13:03 +0200)]
[mlir][ClangTidy] Remove redundant return (NFC).
Johannes de Fine Licht [Mon, 27 Mar 2023 10:38:29 +0000 (12:38 +0200)]
[MLIR][LLVM] Extend argument/result/function attribute support.
Use a disallowlist approach to deselect attributes on arguments and
return values that are not yet supported, but allow the rest to be
present when inlining.
To achieve fast lookup in `isLegalToInline`, the set of unsupported
function attributes is cached on the inliner interface object during
construction. By using a set of StringAttrs this should just amount to a
pointer lookup.
Depends on D146633
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D146729
Nicolas Vasilache [Mon, 27 Mar 2023 10:48:21 +0000 (03:48 -0700)]
[mlir][Linalg] NFC - Move transform utilities related to subcomputation inference to Linalg/Utils
Jay Foad [Thu, 12 Jan 2023 21:02:23 +0000 (21:02 +0000)]
[MC] Store operand info immediately after the TargetInsts table. NFC.
This shrinks MCInstrDesc (and hence the whole TargetInsts table) because
we can store a 16-bit offset value to access the operands info, instead
of a pointer. This also reduces the number of relocs that need to be
applied when LLVM is compiled as position-independent code.
Differential Revision: https://reviews.llvm.org/D142219
Jay Foad [Thu, 12 Jan 2023 07:38:13 +0000 (07:38 +0000)]
[MC] Store implicit ops immediately after the TargetInsts table. NFC.
This shrinks MCInstrDesc (and hence the whole TargetInsts table) because
we can store a 16-bit offset value to access the implicit operands,
instead of a pointer. This also reduces the number of relocs that need
to be applied when LLVM is compiled as position-independent code.
Differential Revision: https://reviews.llvm.org/D142218
Tomasz Kamiński [Mon, 27 Mar 2023 08:13:20 +0000 (10:13 +0200)]
[clang] source range of variable template specialization should include initializer
This patch adjust the getSourceRange() for the
VarTemplateSpecializationDecl and VarTemplatePartialSpecializationDecl,
such that the initializer is included if present:
```
template<typename T>
T temp = 1;
template<> double temp<double> = 1;
```
This patch makes it consistent with the behavior of
non-template variables with initializers and restores
behavior that was present before https://reviews.llvm.org/D139705.
n case, when the initializer is not present we still
include the template arguments in the source range,
which was required for fixing zero-initialization fix-it.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D146733
pvanhout [Mon, 27 Mar 2023 08:15:15 +0000 (10:15 +0200)]
[AMDGPU] Remove `use-legacy-divergence-analysis`
This option has been a no-op since we switched to UA.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D146937