63 Commits

Author SHA1 Message Date
Tobias Gysi
85175edd4e
[mlir][llvm] Replace NullOp by ZeroOp (#67183)
This revision replaces the LLVM dialect NullOp by the recently
introduced ZeroOp. The ZeroOp is more generic in the sense that it
represents zero values of any LLVM type rather than null pointers only.

This is a follow to https://github.com/llvm/llvm-project/pull/65508
2023-09-25 11:11:52 +02:00
Lukas Sommer
93e0658a83
[mlir][llvm] Use zeroinitializer for TargetExtType (#66510)
Use the recently introduced llvm.mlir.zero operation for values with
LLVM target extension type. Replaces the previous workaround that uses a
single zero-valued integer attribute constant operation.

Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com>
2023-09-18 17:49:36 +02:00
Anton Korobeynikov
51d5d7bbae
Extend retcon.once coroutines lowering to optionally produce a normal result (#66333)
One of the main user of these kind of coroutines is swift. There yield-once (`retcon.once`) coroutines are used to temporary "expose" pointers to internal fields of various objects creating borrow scopes.

However, in some cases it might be useful also to allow these coroutines to produce a normal result, but there is no convenient way to represent this (as compared to switched-resume kind of coroutines where C++ `co_return`
is transformed to a member / callback call on promise object).

The extension is simple: we allow continuation function to have a non-void result and accept optional extra arguments via a special `llvm.coro.end.result` intrinsic that would essentially forward them as normal results.
2023-09-15 09:54:38 -07:00
Christian Ulmann
667a195fcd [mlir][LLVM] Fix dbg intrinsic import of killed locations
This commit ensures that debug intrinsics of killed variables do not
cause a crash of the importer. Killed locations are usually undef
constants, but in infrequent cases can also be metadata nodes, which
caused problems.

Reviewed By: zero9178

Differential Revision: https://reviews.llvm.org/D157724
2023-08-14 06:30:45 +00:00
Christian Ulmann
b808648ac1 [mlir][LLVM] Delay debug intrinsic import to ensure dominance
This commit ensures that debug intrinsics are imported after all other
instructions of a function were imported.

Debug intrinsics in LLVM are excluded from the define-before-use
invariant, i.e., they can reference SSA values that do not dominate
them. So far, we had implemented checks to stop the import of such
intrinsics, but there were always additional cases that were not
covered (the latest being terminators that define such used values).

Reviewed By: gysit, zero9178

Differential Revision: https://reviews.llvm.org/D157496
2023-08-09 13:03:45 +00:00
Tobias Gysi
0fc8d9e41a [mlir][llvm] Remove the metadata op
This revision removes the metadata op, that to the best of our
knowledge, has no more uses after switching to a purely attribute based
metadata representation:
https://reviews.llvm.org/D155444
https://reviews.llvm.org/D155285
https://reviews.llvm.org/D155159
These changes got unlocked after landing distinct attribute support:
https://reviews.llvm.org/D153360,
which enables modeling distinct metadata using attributes. As a result,
all metadata kinds are now represented using attributes. Previously,
there has been a mix of attribute and op based representations.

Having attribute only metadata makes it possible to update the metadata
in-parallel, while updating the global metadata operation has been
a sequential process. The LLVM Dialect inliner already benefits from
this change and now creates new alias scopes and domains during
inlining rather than dropping the no alias information:
https://reviews.llvm.org/D155712

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D156217
2023-07-26 11:42:52 +00:00
Markus Böck
1dda134f85 [mlir][flang] Convert TBAA metadata to an attribute representation
The current representation of TBAA is the very last in-tree user of the `llvm.metadata` operation.
Using ops to model metadata has a few disadvantages:
* Building a graph has to be done through some weakly typed indirection mechanism such as `SymbolRefAttr`
* Creating the metadata has to be done through a builder within a metadata op.
* It is not multithreading safe as operation insertion into the same block is not thread-safe

This patch therefore converts TBAA metadata into an attribute representation, in a similar manner as it has been done for alias groups and access groups in previous patches.

This additionally has the large benefit of giving us more "correctness by construction" as it makes things like cycles in a TBAA graph, or references to an incorrectly typed metadata node impossible.

Differential Revision: https://reviews.llvm.org/D155444
2023-07-19 16:42:50 +02:00
Markus Böck
9170fa5808 [mlir][LLVM] Convert access group metadata to using attributes instead of ops
Using MLIR attributes instead of metadata has many advantages:
* No indirection: Attributes can simply refer to each other seemlessly without having to use the indirection of `SymbolRefAttr`. This also gives us correctness by construction in a lot of places as well
* Multithreading safe: The Attribute infrastructure gives us thread-safety for free. Creating operations and inserting them into a block is not thread-safe. This is a major use case for e.g. the inliner in MLIR which runs in parallel
* Easier to create: There is no need for a builder or a metadata region

This patch therefore does exactly that. It leverages the new distinct attributes to create distinct access groups in a deterministic and threadsafe manner.

Differential Revision: https://reviews.llvm.org/D155285
2023-07-14 14:57:46 +02:00
Markus Böck
78d00a160f [mlir][LLVM] Convert alias metadata to using attributes instead of ops
Using MLIR attributes instead of metadata has many advantages:
* No indirection: Attributes can simply refer to each other seemlessly without having to use the indirection of `SymbolRefAttr`. This also gives us correctness by construction in a lot of places as well
* Multithreading save: The Attribute infrastructure gives us thread-safety for free. Creating operations and inserting them into a block is not thread-safe. This is a major use case for e.g. the inliner in MLIR which runs in parallel
* Easier to create: There is no need for a builder or a metadata region

This patch therefore does exactly that. It leverages the new distinct attributes to create distinct alias domains and scopes in a deterministic and threadsafe manner.

Differential Revision: https://reviews.llvm.org/D155159
2023-07-14 11:14:42 +02:00
Christian Ulmann
7d5b4ebb22 [mlir][LLVM] Stop importing module location for all unknown locs
This commit changes the LLVM IR import to use UnkownLoc for missing
debug locations. This change ensures that we do not accidentially
introduce faulty locations that can influence debugging post export.

This behavior change is not applied to locations of global metadata
operations, as their location will not be exported.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D154416
2023-07-04 14:03:07 +00:00
Christian Ulmann
c55a8861f4 [mlir][LLVM] Add alignment to LLVMFuncOp
Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D154410
2023-07-04 06:33:36 +00:00
Christian Ulmann
10417b1359 [mlir][LLVM] Add unnamed_addr to LLVMFuncOp
This commit adds LLVM's unnamed_addr enum to LLVMFuncOp.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D154360
2023-07-04 05:41:27 +00:00
Christian Ulmann
bc6096406c [mlir][LLVM] Add section attribute to LLVMFuncOp
This commit adds an optional section attribute to the `LLVMFuncOp` and
adds import and export functionality for it.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D154219
2023-06-30 14:32:45 +00:00
Tobias Gysi
ac1b69b9db [mlir][llvm] Add debug label intrinsic
This revision adds support for the llvm.dbg.label.intrinsic
and the corresponding DILabel metadata.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D153975
2023-06-29 06:31:13 +00:00
Tobias Gysi
b126ee65fc [mlir][llvm] Add comdat attribute to functions
This revision adds comdat support to functions. Additionally,
it ensures only comdats that have uses are imported/exported and
only non-empty global comdat operations are created.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D153739
2023-06-27 07:26:59 +00:00
Tobias Gysi
a014fadb2e [mlir] Avoid expensive LLVM IR import warnings
The revision adds a flag to the LLVM IR import
that avoids emitting expensive warnings about
unsupported debug intrinsics and unhandled
metadata.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D153625
2023-06-26 06:40:11 +00:00
Christian Ulmann
8d3c4ff866 [mlir][LLVM] Fix empty res attr import
This commit ensures that an empty list of result attributes is not
imported as an empty `ArrayAttr`. Instead, the attribute is just not
added to the `LLVMFuncOp`.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D153553
2023-06-22 16:07:23 +00:00
Tobias Gysi
88f07a3119 [mlir][llvm] Fix import of SwitchOp
This revision ensures SwitchOps with case and condition
bitwidths other than 32-bit are imported properly. It adds an
APInt based builder to the SwitchOp and implements
a verifier that checks that the condition and the case
value types match.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D153438
2023-06-22 06:27:32 +00:00
David Truby
9d4c1be8b0 [mlir] Add support for LLVMIR comdat operation
The LLVM comdat operation specifies how to deduplicate globals with the
same key in two different object files. This is necessary on Windows
where e.g. two object files with linkonce globals will not link unless
a comdat for those globals is specified. It is also supported in the ELF
format.

Differential Revision: https://reviews.llvm.org/D150796
2023-06-19 14:19:39 +01:00
Lukas Sommer
2582b2e3ac [mlir][llvm] Add LLVM TargetExtType
Add support for the `llvm::TargetExtType` to the MLIR LLVM dialect.

Target extension types were introduced to represent target-specific types, which are opaque to the compiler and optimizations.

The patch also enforces some of the constraints defined for the target extension type in the LLVM language reference manual.

Signed-off-by: Lukas Sommer <lukas.sommer@codeplay.com>

Reviewed By: ftynse, gysit, Dinistro

Differential Revision: https://reviews.llvm.org/D151446
2023-05-30 15:55:45 +00:00
Tres Popp
68f58812e3 [mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This patch updates all remaining uses of the deprecated functionality in
mlir/. This was done with clang-tidy as described below and further
modifications to GPUBase.td and OpenMPOpsInterfaces.td.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```

Differential Revision: https://reviews.llvm.org/D151542
2023-05-26 10:29:55 +02:00
Cullen Rhodes
7d4659095a [mlir][llvm] Add arm_streaming LLVM function attributes
This patch adds two optional attributes to 'llvm.func' op for the Armv9
Streaming SVE (SSVE) mode [1] that map 1-1 with LLVM function attributes [2]:

  * arm_streaming -> aarch64_pstate_sm_enabled
  * arm_locally_streaming -> aarch64_pstate_sm_body

Streaming-mode is part of the interface (ABI) for functions with the
first attribute and it's the responsibility of the caller to manage
PSTATE.SM on entry/exit to functions with this attribute [3]. The LLVM
backend will emit 'smstart sm' / 'smstop sm' [4] around calls to
streaming functions.

In locally streaming functions PSTATE.SM is kept internal and managed by
the callee on entry/exit. The LLVM backend will emit 'smstart sm' /
'smstop sm' in the prologue / epilogue for functions with this
attribute.

The integration test for SSVE has been updated to no longer use the
passthrough mechanism that's intended for prototyping.

PATCH [1 / 2] in series for RFC: https://discourse.llvm.org/t/rfc-supporting-armv9-scalable-matrix-extension-sme-streaming-sve-ssve-mode-in-mlir/70678

[1] https://developer.arm.com/documentation/ddi0616/aa
[2] https://llvm.org/docs/AArch64SME.html#introduction
[3] https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#671pstatesm-interfaces
[4] https://developer.arm.com/documentation/ddi0602/2023-03/Base-Instructions/SMSTART--Enables-access-to-Streaming-SVE-mode-and-SME-architectural-state--an-alias-of-MSR--immediate--

Reviewed By: awarzynski, dcaballe, WanderAway

Differential Revision: https://reviews.llvm.org/D150932
2023-05-25 09:20:35 +00:00
Tobias Gysi
4af2458505 [mlir][llvm] Add expect intrinsics.
The revision adds the LLVM expect and expect.with.probability
intrinsics.

Reviewed By: Dinistro, ftynse

Differential Revision: https://reviews.llvm.org/D150643
2023-05-16 11:06:45 +00:00
Tres Popp
5550c82189 [mlir] Move casting calls from methods to function calls
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Caveats include:
- This clang-tidy script probably has more problems.
- This only touches C++ code, so nothing that is being generated.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This first patch was created with the following steps. The intention is
to only do automated changes at first, so I waste less time if it's
reverted, and so the first mass change is more clear as an example to
other teams that will need to follow similar steps.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.
4. Some changes have been deleted for the following reasons:
   - Some files had a variable also named cast
   - Some files had not included a header file that defines the cast
     functions
   - Some files are definitions of the classes that have the casting
     methods, so the code still refers to the method instead of the
     function without adding a prefix or removing the method declaration
     at the same time.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc

git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\
            mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\
            mlir/lib/**/IR/\
            mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\
            mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\
            mlir/test/lib/Dialect/Test/TestTypes.cpp\
            mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\
            mlir/test/lib/Dialect/Test/TestAttributes.cpp\
            mlir/unittests/TableGen/EnumsGenTest.cpp\
            mlir/test/python/lib/PythonTestCAPI.cpp\
            mlir/include/mlir/IR/
```

Differential Revision: https://reviews.llvm.org/D150123
2023-05-12 11:21:25 +02:00
Tobias Gysi
f7cd55f56e [mlir][llvm] Improve LLVM IR constant import.
Improve the constant import to handle zeroinitializer as well as
additional float types such as quad floats. The logic got restructured
to avoid creating intermediate dense element attributes when
constructing multi-dimensional arrays. Additionally, we also leverage
the fact that we do not need to iterate all elements of splat constants.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D150274
2023-05-11 12:45:45 +00:00
Tobias Gysi
dc47813eb0 [mlir][llvm] Improve lookups in LLVM IR import (NFC).
This revision uses contains in favor of count when
searching sets and maps. Additionally it uses find
instead of count and lookup, which avoids searching
some maps twice.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D150344
2023-05-11 12:41:10 +00:00
Christian Ulmann
62d7d94c2e [mlir][LLVM] Support locations in loop annotation
This commit introduces support for locations as part of the loop
annotation attribute. These locations indicate the start and the end of
the loop.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D149858
2023-05-05 07:54:22 +00:00
Tobias Gysi
c00b7c84c7 [mlir][llvm] Add assertion in LLVM IR import (NFC).
This revision adds an assertion to convertConstantExpr to ensure the
function is not called if the constant has been converted before.

This is a follow up for https://reviews.llvm.org/D149247.

Reviewed By: victor-eds

Differential Revision: https://reviews.llvm.org/D149253
2023-04-27 05:52:36 +00:00
Victor Perez
d67901dd2d [mlir][llvm] Use cached constants when importing landingpad instructions
Not using cached constants when importing instructions may lead to
undesired results, as breaking dominance rules in the translated MLIR
module.

Signed-off-by: Victor Perez <victor.perez@codeplay.com>

Differential Revision: https://reviews.llvm.org/D149247
2023-04-26 14:32:04 +01:00
Victor Perez
be717f0a49 [mlir][llvm] Handle invoke op branching to block with its result as an argument
In LLVM, having an invoke instruction branching to a block with a phi
node receiving the invoke instruction result as an argument is
perfectly legal. However, the translation of this construct to MLIR
would result in an invoke with its result being used as a block
argument to a successor, i.e., the operation result would be used in
its definition.

In order to fix this issue due to different IR structures (phi nodes
vs block arguments), this construct is interpreted with an llvm.invoke
operation branching to a dummy block having a single llvm.br operation
passing the required block arguments (including the result of the
llvm.invoke operation) to the actual successor block.

Differential Revision: https://reviews.llvm.org/D148313
2023-04-18 10:54:02 +01:00
Tobias Gysi
9d2b84ef62 [mlir][llvm] Import pointer data layout specification.
The revision moves the data layout parsing into a separate file
and extends it to support pointer data layout specifications.
Additionally, it also produces more precise warnings and error
messages.

Reviewed By: Dinistro, definelicht

Differential Revision: https://reviews.llvm.org/D147170
2023-03-31 11:53:04 +00:00
Tobias Gysi
8ac014ae05 [mlir][llvm] Keep unhandled constant test.
Add the more precise error message introduced in
https://reviews.llvm.org/D142337 to the standard
error produced for unhandled constants. This way
we keep testing both error cases.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D147205
2023-03-31 06:08:34 +00:00
Théo Degioanni
a35f9c6e08 [mlir][llvm] Add poison constant.
This patch introduces the poison constant from LLVM in the LLVM IR dialect. It also adds import and export support for it, along with roundtrip tests.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D146631
2023-03-23 07:58:56 +01:00
Tobias Gysi
56d94a90db [mlir][llvm] Add experimental alias scope decl intrinsic.
The revision adds the llvm.experimental.noalias.scope.decl intrinsic
to the LLVM dialect and updates the import and export accordingly.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D146504
2023-03-22 10:21:09 +01:00
Jan Sjodin
382eb7c2c7 [mlir] Add alloca address space handling to the data layout subsystem
This patch adds alloca address space information to the data layout interface
and implementation in the DLTI dialect. This is needed for targets that use
separate address spaces for local/stack data.

Reviewed By: ftynse, krzysz00

Differential Revision: https://reviews.llvm.org/D144657
2023-03-21 09:37:08 -04:00
Kazu Hirata
4e585e51c1 Use *{Map,Set}::contains (NFC) 2023-03-15 22:55:35 -07:00
Christian Ulmann
6628767e47 [mlir][llvm] Add visibility attribute
This commit introduces the LLVM's visibility attribute and adds it to
both globals and functions.

Furthermore, this commit ensures that "thread_local" is printed in the
correct place and adds a test for that.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D145790
2023-03-12 10:31:29 +01:00
Christian Ulmann
28542e99bb [mlir][llvm] Use before def debug intrinsic import
This commit adds special handling for the debug intrinsic value
handling. LLVM allows to relax the def before use property for debug
intrinsics, so this property cannot be assumed for metadata values.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D144177
2023-02-16 15:49:23 +01:00
Tobias Gysi
4469ec1d19 [mlir][llvm] Import alias scope metadata from LLVM IR.
The revision adds support for importing alias.scope and noalias metadata
from LLVM IR into LLVM dialect. It also adds a verifier to the
AliasScopeMetadataOp to check that the associated domain exists
and is of type AliasScopeDomainMetadataOp.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D143923
2023-02-16 09:52:59 +01:00
Christian Ulmann
e630a50223 [mlir][llvm] Fuse MD_access_group & MD_loop import
This commit moves the importing logic of access group metadata into the
loop annotation importer. These two metadata imports can be grouped
because access groups are only used in combination with
`llvm.loop.parallel_accesses`.

As a nice side effect, this commit decouples the LoopAnnotationImporter
from the ModuleImport class.

Differential Revision: https://reviews.llvm.org/D143577
2023-02-09 14:43:02 +01:00
Tobias Gysi
7f97895f5b [mlir][llvm] Add extra attributes to the atomic ops.
The revision adds a number of extra arguments to the
atomic read modify write and compare and exchange
operations. The extra arguments include the volatile,
weak, syncscope, and alignment attributes.

The implementation also adapts the fence operation to use
a assembly format and generalizes the helper used
to obtain the syncscope name.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D143554
2023-02-09 10:23:06 +01:00
Christian Ulmann
b83caa32dc [mlir][llvm] Add support for loop metadata import
This commit introduces functionality to import loop metadata. Loop
metadata nodes are transformed into LoopAnnotationAttrs and attached to
the corresponding branch operations.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D143376
2023-02-08 11:45:15 +01:00
Tobias Gysi
b6a2e33500 [mlir][llvm] Fix bug in constant import from LLVM IR.
The revision addresses a bug during constant expression traversal
when importing LLVM IR. A constant expression may have cyclic
dependencies, for example, when a constant is initialized with its
address. This revision extends the constant expression traversal
to detect cyclic dependencies and adds a test to verify this
case is handled properly.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D143152
2023-02-06 10:10:48 +01:00
Tobias Gysi
f03b895689 [mlir][llvm] Use tablegen for enum conversion.
The revision uses tablegen to convert multiple atomic and comparison
related enums automatically rather than using hand coded functions
in the import and export from and to LLVM IR.

The revision also adds additional binary operation cases to the
AtomicBinOp enum that have not been supported till now. It also
introduces the possibility to define unsupported enum cases that exist
only in LLVM IR and that are not imported into MLIR. These unsupported
cases are helpful to handle sentinel values such as BAD_BINOP that
LLVM commonly uses to terminate its enums.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D143189
2023-02-03 16:25:15 +01:00
Christian Ulmann
5212058405 Reland "[mlir][LLVM] Add all LLVM parameter attributes"
This change was reverted because it introduced a linking issue due to
duplicated symbols. Making sure that the detail helper only has a static
header implementation fixes this issue.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D142635
2023-01-31 09:11:02 +01:00
Tobias Gysi
af3a5ef171 [mlir][llvm] Import access group metadata.
The revision adds support to import access group metadata from LLVM IR.
It closely follows the design of the TBAA metadata import with an
up-front conversion of the metadata nodes to operations stored in the
body of a module-level metadata operation. The revision chooses to use
only one module-level metadata operation for all kinds of metadata.
This  design ensures there is only one metadata operation that pollutes
the user namespace.

The import of loop metadata, which will use the access groups,
is left to a follow up revision.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D142605
2023-01-30 15:38:39 +01:00
Christian Ulmann
bd0c809209 Revert "[mlir][LLVM] Add all LLVM parameter attributes"
This reverts commit 54941942c82f3a1640d50c0e354d29a3cf5535f6.

The commit introduced a linking error in flang.
2023-01-30 09:38:00 +01:00
Christian Ulmann
54941942c8 [mlir][LLVM] Add all LLVM parameter attributes
This commit adds name accessors and verifiers for all LLVM parameter
attributes excluding the swift specific ones to the LLVM dialect.
Additionally, these attributes are now also imported and exported.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D142635
2023-01-30 08:51:03 +01:00
Arthur Lafrance
ca5e2e3aaa [mlir-translate] More specific error message for BlockAddress
BlockAddress is currently unimplemented in the LLVM dialect of MLIR;
when converting to LLVM dialect MLIR from LLVM IR, mlir-translate
currently terminates with an "unhandled constant" error message.
Instead, this message could be made more specific, to let the user know
that the specific issue is that BlockAddress is unimplemented in the
LLVM dialect.

Differential Revision: https://reviews.llvm.org/D142337
2023-01-25 14:56:28 -08:00
Christian Ulmann
56880fd257 [mlir][LLVM] Add result attribute import support
This commit introduces support for importing result attributes.

Depends on D142372

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D142476
2023-01-25 15:53:19 +01:00