platform/upstream/llvm.git
18 months ago[LinkerWrapper] Use `clang` to perform the device linking
Joseph Huber [Thu, 19 Jan 2023 17:20:07 +0000 (11:20 -0600)]
[LinkerWrapper] Use `clang` to perform the device linking

Right now in the linker wrapper we manually invoke a lot of the
toolchain programs. This reproduces a lot of logic that is already
handled in clang. Since D140158 we can now target all supported
toolchains directly via cross-compilation.

This patch changes the linker wrapper to consolidate all the alternate
linking and assembler steps into a generic call to `clang` and let clang
handle the argument handling. This heavily simplifies the interface.

Reviewed By: tra, JonChesterfield

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

18 months agoRevert "[mlir][Index] Implement InferIntRangeInterface"
Krzysztof Drewniak [Thu, 19 Jan 2023 18:41:00 +0000 (18:41 +0000)]
Revert "[mlir][Index] Implement InferIntRangeInterface"

This reverts commit 455305624884cf9237143e2ba0635fcc5ba5206a.

Linker error, unbreak build while I work out how to fix it.

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

18 months ago[IRLinker] Replace CallInstr with CallBase
Gulfem Savrun Yeniceri [Sat, 14 Jan 2023 00:48:32 +0000 (00:48 +0000)]
[IRLinker] Replace CallInstr with CallBase

This patch replaces CallInstr with CallBase to cover InvokeInstr
besides CallInstr while removing nocallback attribute on a call site.
It also extends drop-attribute.ll test to include a case for an invoke
instruction.

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

18 months agoRevert "Reland [pgo] Avoid introducing relocations by using private alias"
Arthur Eubanks [Thu, 19 Jan 2023 18:19:27 +0000 (10:19 -0800)]
Revert "Reland [pgo] Avoid introducing relocations by using private alias"

This reverts commit da5a8d14b8cc6cea16ee0929413c0672b47c93d9.

Causes more duplicate symbol errors, see https://bugs.chromium.org/p/chromium/issues/detail?id=1408161.

18 months ago[MLIR] Add InferTypeOpInterface to scf.if op
Frederik Gossen [Thu, 19 Jan 2023 18:18:22 +0000 (13:18 -0500)]
[MLIR] Add InferTypeOpInterface to scf.if op

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

18 months agoForbid implicit conversion of constraint expression to bool
Erich Keane [Tue, 17 Jan 2023 19:29:04 +0000 (11:29 -0800)]
Forbid implicit conversion of constraint expression to bool

As reported in https://github.com/llvm/llvm-project/issues/54524, and
later in https://github.com/llvm/llvm-project/issues/60038, we were not
properly implmenting temp.constr.atomic P3. This patch stops implicitly
converting constraints to bool, and ensures the Rvalue conversion takes
place as needed.

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

18 months ago[LoopUnroll] Directly update DT instead of DTU.
Florian Hahn [Thu, 19 Jan 2023 18:10:51 +0000 (18:10 +0000)]
[LoopUnroll] Directly update DT instead of DTU.

The scope of DT updates are very limited when unrolling loops: the DT
should only need updating for
* new blocks added
* exiting blocks we simplified branches

This can be done manually without too much extra work.
MergeBlockIntoPredecessor also needs to be updated to support direct
DT updates.

This fixes excessive time spent in DTU for same cases. In an internal
example, time spent in LoopUnroll with this patch goes from ~200s to 2s.

It also is slightly positive for CTMark:
* NewPM-O3: -0.13%
* NewPM-ReleaseThinLTO: -0.11%
* NewPM-ReleaseLTO-g: -0.13%

Notable improvements are mafft (~ -0.50%) and lencod (~ -0.30%), with no
workload regressed.

https://llvm-compile-time-tracker.com/compare.php?from=78a9ee7834331fb4360457cc565fa36f5452f7e0&to=687e08d011b0dc6d3edd223612761e44225c7537&stat=instructions:u

Reviewed By: kuhar

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

18 months ago[mlir][SCF] Fix crash in loop peeling
Matthias Springer [Thu, 19 Jan 2023 18:01:22 +0000 (19:01 +0100)]
[mlir][SCF] Fix crash in loop peeling

Upper bound and step size should be symbols instead of dims.

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

18 months ago[Sanitizers] GetMemoryProfile implementation for FreeBSD.
David Carlier [Thu, 19 Jan 2023 18:01:03 +0000 (18:01 +0000)]
[Sanitizers] GetMemoryProfile implementation for FreeBSD.

Reviewers: dvyukov

Reviewed-By: dvyukov
Differental Revision: https://reviews.llvm.org/D140688

18 months ago[mlir][Index] Implement InferIntRangeInterface
Krzysztof Drewniak [Mon, 9 Jan 2023 17:09:17 +0000 (17:09 +0000)]
[mlir][Index] Implement InferIntRangeInterface

Implement InferIntRangeInterface for all operations in the Index dialect. The
inference implementation, unlike the one for Arith, accounts for the
fact that Index can be either 64 or 32 bits long by evaluating both
cases. Bounds are stored as if index were i64, but when inferring new
bounds, we compute both f(...) and f(trunc(...)). We then compare
trunc(f(...)) to f(trunc(...)). If they are equal in the relevant
range components, we use the 64-bit range computation, otherwise we
give the range ext(f(trunc(...))) union f(...).

Note that this can cause surprising behavior as seen in the tests,
where, for example, the order of min and max operations impacts the
behavior of the inference. The inference could perhaps be made more
precise in the future (ex. by tracking 32 and 64-bit results
separately and having them influence each other somehow) butt, since
my project targets an index=i32 platform and doesn't see index-valued
values > uint32_max, I'm not too concerned about it.

Depends on https://reviews.llvm.org/D141299

Depends on https://reviews.llvm.org/D141296

Reviewed By: Mogball

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

18 months ago[clang][driver][AIX] Add OpenMP runtime if -fopenmp specified
Xing Xue [Thu, 19 Jan 2023 17:46:22 +0000 (12:46 -0500)]
[clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

Summary:
This patch adds OpenMP runtime to the linker command line if -fopenmp is specifed for AIX.

Reviewed by: daltenty

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

18 months agoFix zero-initialization fix-it for variable template
v1nh1shungry [Thu, 19 Jan 2023 17:35:09 +0000 (12:35 -0500)]
Fix zero-initialization fix-it for variable template

Current version there is a fix-it for

template <class> constexpr int x = 0;
template <> constexpr int x<int>; // fix-it here
but it will cause

template <> constexpr int x = 0<int>;

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

18 months agoRevert "[lit] Stop supporting triple substrings in UNSUPPORTED and XFAIL"
Paul Robinson [Thu, 19 Jan 2023 17:26:33 +0000 (09:26 -0800)]
Revert "[lit] Stop supporting triple substrings in UNSUPPORTED and XFAIL"

This reverts commit a0f8bdbb18a82ec150515d24f6eefb3519d4459a.

Several bots are failing in shtest-format.py, likely because of this.

18 months ago[NFC][flang] Added debug option to bisect TBAA tag attachments.
Slava Zakharin [Thu, 19 Jan 2023 16:46:52 +0000 (08:46 -0800)]
[NFC][flang] Added debug option to bisect TBAA tag attachments.

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months agoSilence some sign comparison warnings; NFC
Aaron Ballman [Thu, 19 Jan 2023 17:25:14 +0000 (12:25 -0500)]
Silence some sign comparison warnings; NFC

The std::optional implementation in MSVC causes this code to produce a
sign comparison warning. This ensures the types are the same sign.

18 months ago[libc] add scanf float converter
Michael Jones [Wed, 21 Dec 2022 22:29:43 +0000 (14:29 -0800)]
[libc] add scanf float converter

This patch adds the %f/F/e/E/g/G/a/A conversions for scanf, as well as
accompanying tests. This implementation matches the definition set forth
in the standard, which may conflict with some other implementations.

Reviewed By: sivachandra

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

18 months ago[libc] add internal string class
Michael Jones [Fri, 6 Jan 2023 23:00:51 +0000 (15:00 -0800)]
[libc] add internal string class

The scanf implementation needs a dynamically resizing string class. This
patch adds a minimal version of that class along with tests to check the
current functionality.

Reviewed By: sivachandra

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

18 months ago[Flang][Debug] Modifications for getting pathname
Kiran Chandramohan [Thu, 19 Jan 2023 16:49:26 +0000 (16:49 +0000)]
[Flang][Debug] Modifications for getting pathname

-> Use file pathname from the Flang frontend. It is the frontend
that is in-charge of finding the files and is hence the canonical
source for paths.
-> Convert pathname to absolute pathname while creating the moduleOp.

Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Reviewed By: PeteSteinfeld, vzakhari, jeanPerier, awarzynski

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

18 months ago[libc++][format] Adds formatter std::vector<bool>.
Mark de Wever [Tue, 29 Nov 2022 06:57:30 +0000 (07:57 +0100)]
[libc++][format] Adds formatter std::vector<bool>.

Implements parts of
- P2286R8 Formatting Ranges

Depends on D140653

Reviewed By: ldionne, #libc

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

18 months ago[gn build] Port 04d4f4b3d4e4
LLVM GN Syncbot [Thu, 19 Jan 2023 16:51:17 +0000 (16:51 +0000)]
[gn build] Port 04d4f4b3d4e4

18 months ago[AARCH64][SVE] Do not optimize vector conversions
Zino Benaissa [Thu, 19 Jan 2023 16:44:23 +0000 (16:44 +0000)]
[AARCH64][SVE] Do not optimize vector conversions

shuffle_vector instructions are serialized targeting SVE fixed vectors, see
https://reviews.llvm.org/D139111. This patch disables
optimizeExtendOrTruncateConversion peepholes that generates shuffle_vector.

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

18 months ago[CostModel][AArch64] Precommit tests for LD1 single-element to lane. NFC.
Sjoerd Meijer [Wed, 11 Jan 2023 14:41:10 +0000 (14:41 +0000)]
[CostModel][AArch64] Precommit tests for LD1 single-element to lane. NFC.

18 months ago[libc++][format] Adds container adaptor formatters.
Mark de Wever [Thu, 5 May 2022 16:57:32 +0000 (18:57 +0200)]
[libc++][format] Adds container adaptor formatters.

Implements parts of
- P2286R8 Formatting Ranges

Depends on D140653

Reviewed By: ldionne, #libc

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

18 months ago[SystemZ] Improvement in tryRxSBG().
Jonas Paulsson [Wed, 18 Jan 2023 19:29:37 +0000 (13:29 -0600)]
[SystemZ] Improvement in tryRxSBG().

Only allow replacements of nodes that have a single user. This is better as
simple instructions (e.g. XGRK) are one cycle faster, and it helps in cases
where both inputs share a common node.

Review: Ulrich Weigand

18 months ago[NFC][bazel] Move _tensor_ops_ext.py to the correct filegroup
Jordan Rupprecht [Thu, 19 Jan 2023 16:43:24 +0000 (08:43 -0800)]
[NFC][bazel] Move _tensor_ops_ext.py to the correct filegroup

18 months ago[NFC][bazel] Add _tensor_ops_ext.py to SparseTensorOpsPyFiles
Jordan Rupprecht [Thu, 19 Jan 2023 16:39:18 +0000 (08:39 -0800)]
[NFC][bazel] Add _tensor_ops_ext.py to SparseTensorOpsPyFiles

This corresponds to the cmake change in 81ca5aa452400843235e058bc9c83fe71eccd593

18 months ago[lit] Stop supporting triple substrings in UNSUPPORTED and XFAIL
Paul Robinson [Wed, 4 Jan 2023 19:35:59 +0000 (11:35 -0800)]
[lit] Stop supporting triple substrings in UNSUPPORTED and XFAIL

AFAICT all in-tree lit tests have been converted to use `target=...`
and so there is no longer any need for triples being special.
Some project config files still define their own features based on
the triple, but those are normal feature words (although now are
redundant with target= checks).

Downstream tests that use triple substrings will need to convert.
For example:
    UNSUPPORTED: -aix
    XFAIL: arm
becomes
    UNSUPPORTED: target={{.*}}-aix{{.*}}
    XFAIL: target=arm{{.*}}

You can do
    git log --grep "special handling for triples"
to find many examples of updates to the upstream tests.

https://discourse.llvm.org/t/rfc-lits-requires-and-triples/66041

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

18 months ago[flang] Allow pointer association between derived-type pointer and unlimited polymorp...
Valentin Clement [Thu, 19 Jan 2023 16:34:01 +0000 (17:34 +0100)]
[flang] Allow pointer association between derived-type pointer and unlimited polymorphic target

Pointer association to unlimited polymorphic target is allowed for
unlimited polymorphic pointer and non-extensible derived-type.
This is checked by the semantic and this patch allows it in the
fir.rebox operation.

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months ago[flang] Support polymorphic source in RESHAPE intrinsic
Valentin Clement [Thu, 19 Jan 2023 16:33:08 +0000 (17:33 +0100)]
[flang] Support polymorphic source in RESHAPE intrinsic

Result must carry the polymorphic type information
from the source.

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months ago[flang] Fix SELECT TYPE lowering when CLASS DEFAULT is not the last type guard
Valentin Clement [Thu, 19 Jan 2023 16:32:02 +0000 (17:32 +0100)]
[flang] Fix SELECT TYPE lowering when CLASS DEFAULT is not the last type guard

CLASS DEFAULT needs to be the last attribute when fir.select_type op is created.
It needs to be at its actual position in the Fortran code when the TypeGuardStmt
are processed. The current lowering was crashing when CLASS DEFAULT was not at
the last position.
This patch fixes the issue by tracking the actual position of the CLASS DEFAULT
type guard and set it at the correct position after the fir.select_type op
is created.

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months ago[gn build] Port 22e8525dfdd7
LLVM GN Syncbot [Thu, 19 Jan 2023 16:20:20 +0000 (16:20 +0000)]
[gn build] Port 22e8525dfdd7

18 months ago[libc++][format] Implements range_formatter
Mark de Wever [Thu, 5 May 2022 16:57:32 +0000 (18:57 +0200)]
[libc++][format] Implements range_formatter

Implements parts of
- P2286R8 Formatting Ranges
- P2585R0 Improving default container formatting

Depends on D140651

Reviewed By: ldionne, #libc

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

18 months ago[SROA] Check TBAA metadata in tests (NFC)
Nikita Popov [Thu, 19 Jan 2023 16:10:09 +0000 (17:10 +0100)]
[SROA] Check TBAA metadata in tests (NFC)

By switching to --check-globals. Also make sure that the
!tbaa.struct metadata mapping is preserved.

18 months ago[clangd] Fix clangd-fuzzer build.
Haojian Wu [Thu, 19 Jan 2023 16:03:08 +0000 (17:03 +0100)]
[clangd] Fix clangd-fuzzer build.

18 months ago[AArch64] Allow poison elements of fixed-vectors to be duplicated as a widened element
Matt Devereau [Mon, 16 Jan 2023 14:21:18 +0000 (14:21 +0000)]
[AArch64] Allow poison elements of fixed-vectors to be duplicated as a widened element

Expanding upon https://reviews.llvm.org/D138203, allow null indices in
InsertElts to be matched with any value and be duplicated if the fixed
vector the scalar values are inserted into is poison, and the scalable vector
the subvector being inserted into is poison.

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

18 months ago[clang][dataflow] Fix bug in joining bool values.
Yitzhak Mandelbaum [Fri, 13 Jan 2023 18:33:52 +0000 (18:33 +0000)]
[clang][dataflow] Fix bug in joining bool values.

Currently, the code assumes that all boolean-typed values are an instance of
`BoolValue` (or its subclasses). Yet, lvalues violate this assumption. This
patch drops the assumption and strengthens the check to confirm the shape of
both values being joined.

The patch also notes as FIXMES a number of problems discovered fixing this bug.

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

18 months ago[flang][hlfir] Lower whole allocatable or pointer component ref
Jean Perier [Thu, 19 Jan 2023 15:56:56 +0000 (16:56 +0100)]
[flang][hlfir] Lower whole allocatable or pointer component ref

Compare to other component ref lowering, the hlfir.designate result type
computation is different, and the allocatable/pointer/contiguous must
be set on the hlfir.designate so that the component attributes are
kept in the IR.

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

18 months ago[Local] Preserve noundef metadata in copyMetadataForLoad()
Nikita Popov [Thu, 19 Jan 2023 15:55:23 +0000 (16:55 +0100)]
[Local] Preserve noundef metadata in copyMetadataForLoad()

If we're only changing the type of the load, preserve the noundef
metadata.

18 months ago[flang] Add semantic check for multiple part-ref with non-zero rank
Kelvin Li [Thu, 19 Jan 2023 15:52:10 +0000 (10:52 -0500)]
[flang] Add semantic check for multiple part-ref with non-zero rank

This patch is to diagnose the case when a type bound procedure is passed as an actual procedure argument.

   call sub0(t%t3%t2%t%info1)

Fix: https://github.com/llvm/llvm-project/issues/55826

Committed on behalf of DanielCChen

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

18 months ago[InstCombine] Add test for load type conversion with !noundef (NFC)
Nikita Popov [Thu, 19 Jan 2023 15:50:02 +0000 (16:50 +0100)]
[InstCombine] Add test for load type conversion with !noundef (NFC)

The !noundef metadata is currently dropped.

18 months ago[AArch64] Armv9-A implies FP16
David Green [Thu, 19 Jan 2023 15:37:50 +0000 (15:37 +0000)]
[AArch64] Armv9-A implies FP16

As Armv9-a implies SVE2 it implies SVE (added in D141411) and so it
should also imply FP16, which this patch adds. This helps get the target
features correct when using `target("arch=armv9-a")` attributes.

There is also an adjustment to AssertSameExtensionFlags in this patch to
make it print cpu names, useful when the TargetParser unit tests are run
through lit to distinguish which cpu is failing.

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

18 months ago[OpenMP][Fix] Track all threads that may delete an entry
Guilherme Valarini [Thu, 19 Jan 2023 15:11:20 +0000 (12:11 -0300)]
[OpenMP][Fix] Track all threads that may delete an entry

The entries inside a "target data end" is processed in three steps:

  1. Query internal data maps for the entries and dispatch any necessary
     device-side operations (i.e., data retrieval);
  2. Synchronize the such operations;
  3. Update the host-side pointers and remove any entry which reference
     counter reached zero.

Such steps may be executed by multiple threads which may even operate on
the same entries. The current implementation (D121058) tries to
synchronize these threads by tracking the "owner" for the deletion of
each entry using their thread ID. Unfortunately it may failed to do so
because of the following reasons:

  1. The owner is always assigned at the first step only if the
     reference count is 0 when the map is queried. This does not work
     when such owner thread is faster than a previous one that is also
     processing the same entry on another "target data end", leading to
     user-after-free problems.
  2. The entry is only added for post-processing (step 3) if its
     reference count was 0 at query time (step 1). This does not allow
     for threads to exchange responsibility for the deletion, leading
     again to user-after-free problems.
  3. An entry may appear multiple times in the arguments array of a
     "target data end", which may lead to deleting the entry
     prematurely, leading, again, to user-after-free problems.

This patch addresses these problems by tracking all the threads that are
using an entry at "target data end" region through a counter, ensuring
only the last one deletes it when needed. It also ensures that all
entries that are successfully found inside the data maps in step 1 are
also processed in step 3, regardless if their reference count was zeroed
or not at query time. This ensures the deletion ownership may be passed
to any thread that is using such entry.

Reviewed By: ye-luo

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

18 months ago[Dexter] Add on_line parameter to DexExpectStepOrder command
Ben Mudd [Thu, 19 Jan 2023 15:05:04 +0000 (15:05 +0000)]
[Dexter] Add on_line parameter to DexExpectStepOrder command

DexExpectStepOrder uses the line to expect a debugger step from the actual line
of the command in the Dexter source file. Now Dexter scripts have mainly moved
to thier own script files instead of the actual source, there should be a
option to override this behaviour to choose your own debugger step location.

Reviewed By: Orlando

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

18 months ago[InstCombine] Add non-logical variants for some ctpop and/or tests (NFC)
Nikita Popov [Thu, 19 Jan 2023 15:05:45 +0000 (16:05 +0100)]
[InstCombine] Add non-logical variants for some ctpop and/or tests (NFC)

And regenerate test checks to pick up new names.

18 months ago[InstCombine] Drop incorrect test (NFC)
Nikita Popov [Thu, 19 Jan 2023 14:55:26 +0000 (15:55 +0100)]
[InstCombine] Drop incorrect test (NFC)

I made a typo here, this was supposed to be !align rather than
!aligned. But then !align can only be applied to loads, not calls
(where one would use the return attribute instead). And freeze
can't be pushed through loads anyway, so there's no way to test
this case (same as !nonnull).

18 months ago[clang][dataflow] Add (initial) debug printing for `Value` and `Environment`.
Yitzhak Mandelbaum [Fri, 13 Jan 2023 19:26:57 +0000 (19:26 +0000)]
[clang][dataflow] Add (initial) debug printing for `Value` and `Environment`.

Also adds uses of the new printing in analysis inner loop.

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

18 months ago[SPIR-V] Emit OpExecutionMode ContractionOff for no FP_CONTRACT metadata
Michal Paszkowski [Wed, 18 Jan 2023 21:23:11 +0000 (22:23 +0100)]
[SPIR-V] Emit OpExecutionMode ContractionOff for no FP_CONTRACT metadata

This change makes the AsmPrinter emit OpExecutionMode ContractionOff
when both opencl.enable.FP_CONTRACT and spirv.ExecutionMode
metadata are not present.

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

18 months ago[InstCombine] Add tests for freeze with !range and !align metadata (NFC)
Nikita Popov [Thu, 19 Jan 2023 14:23:48 +0000 (15:23 +0100)]
[InstCombine] Add tests for freeze with !range and !align metadata (NFC)

These are currently being miscompiled, see PR59888.

18 months ago[X86] Add register definitions for cfi directives
Alex Brachet [Thu, 19 Jan 2023 14:10:31 +0000 (14:10 +0000)]
[X86] Add register definitions for cfi directives

Add {e,r}flags, {g,f}s.base registers so they can be referenced in cfi
directives,. They are not otherwise useable in any instructions,
but can be implicitly pushed to the stack like with pushf for
{e,r}flags.

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

18 months ago[gn] port 939dce12f9f3 (clangd uses include-cleaner) more
Nico Weber [Thu, 19 Jan 2023 14:01:29 +0000 (09:01 -0500)]
[gn] port 939dce12f9f3 (clangd uses include-cleaner) more

18 months ago[gn] port 939dce12f9f3 (clangd uses include-cleaner)
Nico Weber [Thu, 19 Jan 2023 13:45:56 +0000 (08:45 -0500)]
[gn] port 939dce12f9f3 (clangd uses include-cleaner)

18 months ago[clangd] Implement unused include warnings with include-cleaner library.
Haojian Wu [Mon, 2 Jan 2023 21:10:11 +0000 (22:10 +0100)]
[clangd] Implement unused include warnings with include-cleaner library.

A prototype of using include-cleaner library in clangd:

- (re)implement clangd's "unused include" warnings with the library
- the new implementation is hidden under a flag `Config::UnusedIncludesPolicy::Experiment`

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

18 months ago[llvm][ir] Purge MD_prof custom accessors
Christian Ulmann [Thu, 19 Jan 2023 11:04:53 +0000 (12:04 +0100)]
[llvm][ir] Purge MD_prof custom accessors

This commit purges direct accesses to MD_prof metadata and replaces them
with the accessors provided from the utility file wherever possible.
This commit can be seen as the first step towards switching the branch weights to 64 bits.
See post here: https://discourse.llvm.org/t/extend-md-prof-branch-weights-metadata-from-32-to-64-bits/67492

Reviewed By: davidxl, paulkirth

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

18 months ago[DAG] Peek through ZEXT/TRUNC in foldAddSubMasked1
Amaury Séchet [Tue, 17 Jan 2023 02:17:18 +0000 (02:17 +0000)]
[DAG] Peek through ZEXT/TRUNC in foldAddSubMasked1

Fix a regression in D141883

Depends on D141883

Reviewed By: lebedev.ri

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

18 months ago[clang] Build UsingType for elaborated type specifiers.
Haojian Wu [Tue, 3 Jan 2023 14:08:42 +0000 (15:08 +0100)]
[clang] Build UsingType for elaborated type specifiers.

Support building UsingType for elaborated type specifiers:

```
namespace ns { class Foo {}; }

using ns::Foo;

// The TypeLoc of `Foo` below should be a ElaboratedTypeLoc with an
// inner UsingTypeLoc rather than the underlying `CXXRecordTypeLoc`
class Foo foo;
```

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

18 months ago[flang][hlfir] Enable lowering and passing of allocatables and pointers.
Jean Perier [Thu, 19 Jan 2023 13:18:08 +0000 (14:18 +0100)]
[flang][hlfir] Enable lowering and passing of allocatables and pointers.

Adds support for:
- referencing a whole allocatable/pointer symbol
- passing allocatable/pointer in a call

This required update in HLFIRTools.cpp helpers so that the
raw address, extents, lower bounds, and type parameters of a
fir.box/fir.class can be extracted.
This is required because in hlfir lowering, dereferencing a
pointer/alloc is only doing the fir.load fir.box part, and the
helpers have to be able to reason about that fir.box without the
help of a "fir::FortranVariableOpInterface".

Missing:
- referencing part of allocatable/pointer (will need to update
  Designator lowering to dereference the pointer/alloc). Same
  for whole allocatable and pointer components.
- allocate/deallocate/pointer assignment statements.
- Whole allocatable assignment.
- Lower inquires.

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

18 months agoOptimize OptTable::findNearest implementation and usage
serge-sans-paille [Wed, 18 Jan 2023 15:43:56 +0000 (16:43 +0100)]
Optimize OptTable::findNearest implementation and usage

When used to find an exact match, some extra context can be used to
totally cut some computations.

This saves 1% of the instruction count when pre processing sqlite3.c
through

valgrind --tool=callgrind ./bin/clang -E sqlite3.c -o/dev/null

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

18 months ago[MLIR][Presburger] Support divisions in union of two PWMAFunction
Groverkss [Thu, 19 Jan 2023 13:01:56 +0000 (18:31 +0530)]
[MLIR][Presburger] Support divisions in union of two PWMAFunction

This patch adds support for divisions in the union of two PWMAFunction. This is
now possible because of previous patches, which made divisions explicitly
stored in MultiAffineFunction (MAF). This patch also refactors the previous
implementation, moving the implementation for obtaining a set of points where a
MAF is lexicographically "better" than the other to MAF.

Reviewed By: arjunp

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

18 months ago[SPIR-V] Add -opaque-pointers=0 to some LIT tests
Michal Paszkowski [Wed, 18 Jan 2023 23:05:37 +0000 (00:05 +0100)]
[SPIR-V] Add -opaque-pointers=0 to some LIT tests

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

18 months agoRevert "[clang][Interp] Unify visiting variable declarations"
Timm Bäder [Thu, 19 Jan 2023 12:52:05 +0000 (13:52 +0100)]
Revert "[clang][Interp] Unify visiting variable declarations"

This reverts commit 5b54cf1a2892767fe949826a32d7820732028a38.

This breaks a builder: https://lab.llvm.org/buildbot/#/builders/5/builds/30854

18 months agoRevert "[clang][Interp] Implement missing compound assign operators"
Timm Bäder [Thu, 19 Jan 2023 12:51:26 +0000 (13:51 +0100)]
Revert "[clang][Interp] Implement missing compound assign operators"

This reverts commit 490e8214fca48824beda8b508d6d6bbbf3d8d9a7.

This breaks a builder: https://lab.llvm.org/buildbot/#/builders/214/builds/5415

18 months ago[clang][Interp][NFC] Remove shift error checking code duplication
Timm Bäder [Thu, 19 Jan 2023 12:24:40 +0000 (13:24 +0100)]
[clang][Interp][NFC] Remove shift error checking code duplication

18 months ago[DAG] Do not combine any_ext when we combine and into zext.
Amaury Séchet [Sun, 1 May 2022 15:58:32 +0000 (15:58 +0000)]
[DAG] Do not combine any_ext when we combine and into zext.

This transofrm loses information that can be useful for other transforms.

Reviewed By: lebedev.ri

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

18 months ago[clang] Improve diagnostic for "initializer-string for char array is too long"
Evan Smal [Thu, 19 Jan 2023 12:11:07 +0000 (13:11 +0100)]
[clang] Improve diagnostic for "initializer-string for char array is too long"

This patch improves the diagnostic message "initializer-string for
char array is too long" by specifying an expected array length and by
indicating that the initializer string implicitly includes the
null terminator.

Fixes #58829

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

18 months ago[VPlan] Add vp_depth_first_shallow + graph traits for wrapper(NFC)
Florian Hahn [Thu, 19 Jan 2023 12:07:27 +0000 (12:07 +0000)]
[VPlan] Add vp_depth_first_shallow + graph traits for wrapper(NFC)

This patch adds a new VPBlockShallowTraversalWrapper struct to
provide graph traits specialization that do not traverse through
VPRegionBlocks. This matches the behavior of the existing traits for
plain VPBlockBase and is a step before moving the graph traits for
VPBlockBase to traverse through VPRegionBlocks to enable cross region
support in VPDominatorTree.

Depends on D140511.

Reviewed By: Ayal

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

18 months ago[AMDGPU] Add feature predicate for v_fmac_f64 instruction
Mariusz Sikora [Wed, 18 Jan 2023 14:30:38 +0000 (15:30 +0100)]
[AMDGPU] Add feature predicate for v_fmac_f64 instruction

Introducing feature predicate VFmacF64Inst for targets which
supports v_fmac_f64 instructions.

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

18 months agoRevert "[clang][Interp][NFC] Remove shift error checking code duplication"
Timm Bäder [Thu, 19 Jan 2023 12:03:20 +0000 (13:03 +0100)]
Revert "[clang][Interp][NFC] Remove shift error checking code duplication"

This reverts commit fddf6418e8492a544c9bfdb42a4dbc949d9dc2ee.

Apparently this also breaks some builders:

/usr/bin/ld: EvalEmitter.cpp:(.text._ZN5clang6interp11EvalEmitter7emitShlENS0_8PrimTypeES2_RKNS0_10SourceInfoE+0x1f54): undefined reference to `bool clang::interp::CheckShift<clang::interp::Integral<16u, true> >(clang::interp::InterpState&, clang::interp::CodePtr, clang::interp::Integral<16u, true> const&, unsigned int)'
/usr/bin/ld: EvalEmitter.cpp:(.text._ZN5clang6interp11EvalEmitter7emitShlENS0_8PrimTypeES2_RKNS0_10SourceInfoE+0x1fd4): undefined reference to `bool clang::interp::CheckShift<clang::interp::Integral<32u, true> >(clang::interp::InterpState&, clang::interp::CodePtr, clang::interp::Integral<32u, true> const&, unsigned int)'
/usr/bin/ld: EvalEmitter.cpp:(.text._ZN5clang6interp11EvalEmitter7emitShlENS0_8PrimTypeES2_RKNS0_10SourceInfoE+0x2058): undefined reference to `bool clang::interp::CheckShift<clang::interp::Integral<32u, true> >(clang::interp::InterpState&, clang::interp::CodePtr, clang::interp::Integral<32u, true> const&, unsigned int)'

(etc)

18 months ago[mlir][OpenMP] Add nontemporal clause definition to simd construct
Dominik Adamski [Thu, 22 Dec 2022 12:26:47 +0000 (06:26 -0600)]
[mlir][OpenMP] Add nontemporal clause definition to simd construct

simd nontemporal construct is represented as a list of variables
which have low locality accross simd iterations

Added verifier of nontemporal clause. MLIR tests were updated to test
correctness of MLIR definition of nontemporal clause.

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

Reviewed By: kiranchandramohan

18 months ago[NFC][bazel] Enable layering_check for mlir/unittests
Jordan Rupprecht [Thu, 19 Jan 2023 11:40:59 +0000 (03:40 -0800)]
[NFC][bazel] Enable layering_check for mlir/unittests

18 months agoRevert "[clang][Interp][NFC] Move CheckDivRem() implementation into Interp.cpp"
Timm Bäder [Thu, 19 Jan 2023 11:37:20 +0000 (12:37 +0100)]
Revert "[clang][Interp][NFC] Move CheckDivRem() implementation into Interp.cpp"

This reverts commit 9ee0d7494eb35f5addefcb730cdf5c002ddeacd2.

18 months ago[clang][Interp] Implement missing compound assign operators
Timm Bäder [Mon, 31 Oct 2022 11:44:38 +0000 (12:44 +0100)]
[clang][Interp] Implement missing compound assign operators

Implement mul, div, rem, etc. compound assign operators.

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

18 months ago[clang][Interp][NFC] Move CheckDivRem() implementation into Interp.cpp
Timm Bäder [Sun, 30 Oct 2022 09:21:58 +0000 (10:21 +0100)]
[clang][Interp][NFC] Move CheckDivRem() implementation into Interp.cpp

Just like we do with all the other Check* functions.

18 months ago[clang][Interp][NFC] Remove shift error checking code duplication
Timm Bäder [Sun, 30 Oct 2022 09:20:04 +0000 (10:20 +0100)]
[clang][Interp][NFC] Remove shift error checking code duplication

18 months ago[clang][Interp][NFCI] Pull IsConstantContext into State
Timm Bäder [Sun, 30 Oct 2022 06:28:17 +0000 (07:28 +0100)]
[clang][Interp][NFCI] Pull IsConstantContext into State

This way we can check for this flag in the new interpreter as well.

18 months ago[mlir][vector] Add a custom builder for LowerVectorsOp
Quentin Colombet [Tue, 17 Jan 2023 11:54:40 +0000 (11:54 +0000)]
[mlir][vector] Add a custom builder for LowerVectorsOp

The `lower_vectors` operation of the transform dialect takes a lot of
arguments to build.
In order to make C++ code easier to work with when using this
instruction, introduce a new structure, named `LowerVectorsOptions`, that
aggregates all the options that are used to build this instruction.

This allows to use patterns like:
```
LowerVectorsOptions opts;
opts.setOptZ(...)
  .setOptY(...)...;
builder.create<LowerVectorsOp>(target, opts);
```

Instead of having to pass all N options directly to the builder and set
them in the right order.

NFC

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

18 months ago[mlir][LLVM] Replace readnone with memory effects
Christian Ulmann [Thu, 12 Jan 2023 15:48:19 +0000 (16:48 +0100)]
[mlir][LLVM] Replace readnone with memory effects

This commit introduces LLVM's `MemoryEffects` attribute and replaces the
deprecated usage of `llvm.readnone` in the LLVM dialect.
The absence of the attribute on a `LLVMFuncOp` implies that it might
access all kinds of memory. This semantic corresponds to `llvm::Function`'s
behaviour.

Depends on D142002

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

18 months ago[mlir] fix mlir integration tests
Alex Zinenko [Thu, 19 Jan 2023 10:32:42 +0000 (10:32 +0000)]
[mlir] fix mlir integration tests

18 months ago[mlir] simpler transform dialect silenceable failures
Alex Zinenko [Mon, 9 Jan 2023 18:06:09 +0000 (18:06 +0000)]
[mlir] simpler transform dialect silenceable failures

Simplify the handling of silenceable failures in the transform dialect.
Previously, the logic of `TransformEachOpTrait` required that
`applyToEach` returned a list of null pointers when a silenceable
failure was emitted. This was not done consistently and also crept into
ops without this trait although they did not require it. Handle this
case earlier in the interpreter and homogeneously associated preivously
unset transform dialect values (both handles and parameters) with empty
lists of the matching kind. Ignore the results of `applyToEach` for the
targets for which it produced a silenceable failure. As a result, one
never needs to set results to lists containing nulls. Furthermore, the
objects associated with transform dialect values must never be null.

Depends On D140980

Reviewed By: nicolasvasilache

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

18 months ago[mlir] make multi-size tiling use transform parameters
Alex Zinenko [Wed, 4 Jan 2023 14:04:53 +0000 (14:04 +0000)]
[mlir] make multi-size tiling use transform parameters

Use the recently introduced transform dialect parameter mechanism to
perform controllable multi-size tiling with sizes computed at the
transformation time rather than at runtime.

This requires to generalize tile and split structured transform
operations to work with any transform dialect handle types, which is
desirable in itself to avoid unchecked overuse of PDL OperationType.

Reviewed By: shabalin

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

18 months ago[Regex] Avoid NFA machinery for fixed prefix chars (NFC)
Nikita Popov [Thu, 19 Jan 2023 09:04:03 +0000 (10:04 +0100)]
[Regex] Avoid NFA machinery for fixed prefix chars (NFC)

Similarly to what backref() does, add an "easy path" to slow()
that can handle some non-branching cases, in particular simple
character matches.

This has the dual effect of reducing the number of characters we
need to match, and the number of states in the NFA.

This reduces FileCheck runtime on vloxseg.c from 17s to 12s on
my machine.

18 months ago[clang][Interp] Diagnose uninitialized array record fields
Timm Bäder [Thu, 27 Oct 2022 09:37:11 +0000 (11:37 +0200)]
[clang][Interp] Diagnose uninitialized array record fields

Just like we do for record members, diagnose uninitialized array record
fields.

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

18 months ago[clangd] Simplify some tests in IncludeCleanerTests, NFC
Haojian Wu [Thu, 19 Jan 2023 09:46:53 +0000 (10:46 +0100)]
[clangd] Simplify some tests in IncludeCleanerTests, NFC

They were pointed out in the review of https://reviews.llvm.org/D140875

18 months ago[clang][Interp] Unify visiting variable declarations
Timm Bäder [Thu, 27 Oct 2022 04:16:01 +0000 (06:16 +0200)]
[clang][Interp] Unify visiting variable declarations

We often visit the same variable multiple times, e.g. once when checking
its initializer and later when compiling the function. Unify both of
those in visitVarDecl() and do the returning of the value in
visitDecl().

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

18 months ago[AArch64][SVE2p1] Add SVE2.1 while (predicate-pair) intrinsics
David Sherwood [Tue, 17 Jan 2023 15:16:25 +0000 (15:16 +0000)]
[AArch64][SVE2p1] Add SVE2.1 while (predicate-pair) intrinsics

Adds intrinsics for the following instructions:

* WHILEGE (predicate pair)
* WHILEGT (predicate pair)
* WHILEHI (predicate pair)
* WHILEHS (predicate pair)
* WHILELE (predicate pair)
* WHILELO (predicate pair)
* WHILELS (predicate pair)
* WHILELT (predicate pair)

I've added an opcode selector called SelectOpcodeFromVT to
AArch64ISelDAGToDAG.cpp that we will extend in future to
select opcodes from different MVTs. For now, the only use is
for selecting predicate types.

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

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

18 months ago[mlir][FuncToLLVM] Drop llvm.linkage attribute
Christian Ulmann [Thu, 19 Jan 2023 09:02:39 +0000 (10:02 +0100)]
[mlir][FuncToLLVM] Drop llvm.linkage attribute

This commit ensures that all functions produced by `FuncToLLVM` drop the
llvm.linkage attribute. Furthermore, it adds a small test that checks if
the readnone attribute is preserved.

Reviewed By: gysit

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

18 months ago[test][InstCombine] Remove out-of-date comment
Quentin Colombet [Thu, 19 Jan 2023 09:22:37 +0000 (10:22 +0100)]
[test][InstCombine] Remove out-of-date comment

NFC

18 months ago[InstCombine] Don't optimize idempotent `atomicrmw <op>, 0` into `load atomic`
Quentin Colombet [Wed, 18 Jan 2023 15:01:43 +0000 (16:01 +0100)]
[InstCombine] Don't optimize idempotent `atomicrmw <op>, 0` into `load atomic`

Turning idempotent `atomicrmw`s into `load atomic` is perfectly legal
with respect to how the loading happens, but it may not be legal for the
whole program semantic.

Indeed, this optimization removes a store that may have some effects on
the legality of other optimizations.
Essentially, we lose some information and depending on the backend
it may or may not produce incorrect code, so don't do it!

This fixes llvm.org/PR56450.

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

18 months ago[MLIR][LLVM] Don't use void return type in `getCallableResults`.
Johannes de Fine Licht [Thu, 19 Jan 2023 08:52:08 +0000 (09:52 +0100)]
[MLIR][LLVM] Don't use void return type in `getCallableResults`.

In the LLVM IR dialect, `LLVMVoidType` is used to model the return type
of LLVM IR functions with no return value. This is inconsistent with
MLIR APIs, which expect a function with no return value to have an
empty return type. Handle this special case in `LLVMFuncOp` to avoid
mismatches between the number of return values and return types between
caller and callee.

Reviewed By: ftynse

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

18 months ago[mlir] fix python test
Alex Zinenko [Thu, 19 Jan 2023 08:58:34 +0000 (08:58 +0000)]
[mlir] fix python test

It was using an incorrect attribute type, but the test was still passing
because of the value being present in the output.

18 months ago[clang][Interp] Check Field initialization after constructor call
Timm Bäder [Tue, 25 Oct 2022 15:34:31 +0000 (17:34 +0200)]
[clang][Interp] Check Field initialization after constructor call

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

18 months ago[LoongArch] Add an option for MCInstPrinter to print numeric reg names
wanglei [Thu, 19 Jan 2023 08:29:14 +0000 (16:29 +0800)]
[LoongArch] Add an option for MCInstPrinter to print numeric reg names

`-loongarch-numeric-reg` for llvm-mc and llc.
`-M numeric` (which matches GNU objdump) for llvm-objdump and llvm-mc.

Reviewed By: SixWeining

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

18 months ago[InstCombine] regenerete icmp-logical tests (NFC)
Yingchi Long [Thu, 19 Jan 2023 08:22:49 +0000 (16:22 +0800)]
[InstCombine] regenerete icmp-logical tests (NFC)

These pattern names are inconsistent with current update_checks.py.

18 months ago[clang][Interp][NFC] Initialize constants as ~0u
Timm Bäder [Wed, 18 Jan 2023 14:10:40 +0000 (15:10 +0100)]
[clang][Interp][NFC] Initialize constants as ~0u

18 months ago[clang][Interp] Use placement new to construct opcode args into vector
Timm Bäder [Fri, 2 Dec 2022 07:19:14 +0000 (08:19 +0100)]
[clang][Interp] Use placement new to construct opcode args into vector

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

18 months ago[clang][Interp][NFC] Remove unused functions
Timm Bäder [Tue, 17 Jan 2023 08:07:48 +0000 (09:07 +0100)]
[clang][Interp][NFC] Remove unused functions

18 months ago[X86] Avoid converting u64 to f32 using x87 on Windows
icedrocket [Thu, 19 Jan 2023 06:35:13 +0000 (22:35 -0800)]
[X86] Avoid converting u64 to f32 using x87 on Windows

The code below currently prints less accurate values only on Windows 32-bit. On Windows, the default precision control on x87 is only 53-bit, and FADD triggers rounding with that precision, so the final result may be less accurate. This revision avoids less accurate conversions by using library calls instead.

```

int main() {
    int64_t n = 0b0000000000111111111111111111111111011111111111111111111111111111;
    printf("%lld, %.0f, %.0f", n, (float)n, (float)(uint64_t)n);

    return 0;
}
```

Reviewed By: craig.topper, lebedev.ri

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

18 months agoDrop the ZeroBehavior parameter from countLeadingZeros and the like (NFC)
Kazu Hirata [Thu, 19 Jan 2023 03:58:44 +0000 (19:58 -0800)]
Drop the ZeroBehavior parameter from countLeadingZeros and the like (NFC)

This patch drops the ZeroBehavior parameter from bit counting
functions like countLeadingZeros.  ZeroBehavior specifies the behavior
when the input to count{Leading,Trailing}Zeros is zero and when the
input to count{Leading,Trailing}Ones is all ones.

ZeroBehavior was first introduced on May 24, 2013 in commit
eb91eac9fb866ab1243366d2e238b9961895612d.  While that patch did not
state the intention, I would guess ZeroBehavior was for performance
reasons.  The x86 machines around that time required a conditional
branch to implement countLeadingZero<uint32_t> that returns the 32 on
zero:

        test    edi, edi
        je      .LBB0_2
        bsr     eax, edi
        xor     eax, 31
.LBB1_2:
        mov     eax, 32

That is, we can remove the conditional branch if we don't care about
the behavior on zero.

IIUC, Intel's Haswell architecture, launched on June 4, 2013,
introduced several bit manipulation instructions, including lzcnt and
tzcnt, which eliminated the need for the conditional branch.

I think it's time to retire ZeroBehavior as its utility is very
limited.  If you care about compilation speed, you should build LLVM
with an appropriate -march= to take advantage of lzcnt and tzcnt.
Even if not, modern host compilers should be able to optimize away
quite a few conditional branches because the input is often known to
be nonzero from dominating conditional branches.

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

18 months ago[flang] Fixed unittest build issue with older gcc.
Slava Zakharin [Thu, 19 Jan 2023 02:10:09 +0000 (18:10 -0800)]
[flang] Fixed unittest build issue with older gcc.

I am getting this error with `check-flang`:
```
ld.lld: error: undefined symbol: mlir::SuccessorRange::SuccessorRange(mlir::Operation*)
>>> referenced by Operation.h:549 (/llvm-project/llvm/../mlir/include/mlir/IR/Operation.h:549)
>>>               CMakeFiles/FlangRuntimeTests.dir/Allocatable.cpp.o:(mlir::Operation::getSuccessors())
```

The buildbots are okay, so I guess it has something to do with
gcc-9 that I am using.

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

18 months ago[mlir] Make FunctionOpInterface inherit SymbolOpInterface
River Riddle [Fri, 16 Dec 2022 10:33:53 +0000 (02:33 -0800)]
[mlir] Make FunctionOpInterface inherit SymbolOpInterface

This lets users of FunctionOpInterface finally have the
name/visibility accessors from SymbolOpInterface. This also
lets us remove the clunky "getName" method from FunctionOpInterface.

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

18 months ago[mlir] Add support for interface inheritance
River Riddle [Thu, 12 Jan 2023 21:35:15 +0000 (13:35 -0800)]
[mlir] Add support for interface inheritance

This allows for interfaces to define a set of "base classes",
which are interfaces whose methods/extra class decls/etc.
should be inherited by the derived interface. This more
easily enables combining interfaces and their dependencies,
without lots of awkard casting. Additional implicit conversion
operators also greatly simplify the conversion process.

One other aspect of this "inheritance" is that we also implicitly
add the base interfaces to the attr/op/type. The user can still
add them manually if desired, but this should help remove some
of the boiler plate when an interface has dependencies.

See https://discourse.llvm.org/t/interface-inheritance-and-dependencies-interface-method-visibility-interface-composition

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