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
The revision adds the alias analysis and access group
interfaces to the call operation.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D151693
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
In particular, do not drop all access groups of a loop annotation
if one of them is unused. This change makes the access group import
robust against stale access group references in loop metadata.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D148791
This revision updates the memcpy, memove, and memset intrinsics to
implement the AliasAnalysis and AccessGroup interfaces. The changes
will enable the import and export of alias scope, tbaa, and
access group metadata attached to these intrinsics. It also
renames the requiresAliasScope flag to requiresAliasAnalysis since
the intrinsics also support tbaa and not only access scope metadata.
The revision still maintains the string based attribute lookup
in the translation from MLIR to LLVMIR. Using the interfaces
instead of the string based lookup is left to a followup revision.
Depends on D144851
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D144965
The revision introduces two interfaces that provide access to
the alias analysis and access group metadata attributes. The
AliasAnalysis interface combines all alias analysis related
attributes (alias, noalias, and tbaa) similar to LLVM's getAAMetadata
method, while the AccessGroup interface is dedicated to the
access group metadata.
Previously, only the load and store operations supported alias analysis
and access group metadata. This revision extends this support to the
atomic operations. A follow up revision will also add support for the
memcopy, memset, and memove intrinsics. The interfaces then provide
convenient access to the metadata attributes and eliminate the need
of TypeSwitch or string based attribute access.
The revision still relies on string based attribute access for
the translation to LLVM IR (except for tbaa metadata). Only once
the the memory access intrinsics also implement the new interfaces,
the translation to LLVM IR can be fully switched to use interface
based attribute accesses.
Depends on D144875
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D144851
This commit adds the loop annotation attribute to LLVM::Br and
LLVM::CondBr to ensure it is non-discardable. Furthermore, the name is
changed from "llvm.loop" to "loop-annotation".
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D143986
This commit adds support for the last two loop metadata nodes produced
anywhere in the llvm-project.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D143746
The revision supports importing the volatile keyword and nontemporal
metadata for the LoadOp and StoreOp. Additionally, it updates the
builders and uses an assembly format for printing and parsing.
The operation type still requires custom parse and print methods
due to the current handling of typed and opaque pointers.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D143714
This commit adds support for the "llvm.loop.isvectorized" metadata and
ensures that the unroll followups match llvm's naming.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D143730
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
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