summaryrefslogtreecommitdiff
path: root/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
AgeCommit message (Collapse)Author
2022-03-07[mlir][NFC] Rename StandardToLLVM to FuncToLLVMRiver Riddle
The current StandardToLLVM conversion patterns only really handle the Func dialect. The pass itself adds patterns for Arithmetic/CFToLLVM, but those should be/will be split out in a followup. This commit focuses solely on being an NFC rename. Aside from the directory change, the pattern and pass creation API have been renamed: * populateStdToLLVMFuncOpConversionPattern -> populateFuncToLLVMFuncOpConversionPattern * populateStdToLLVMConversionPatterns -> populateFuncToLLVMConversionPatterns * createLowerToLLVMPass -> createConvertFuncToLLVMPass Differential Revision: https://reviews.llvm.org/D120778
2022-03-01[mlir] Rename the Standard dialect to the Func dialectRiver Riddle
The last remaining operations in the standard dialect all revolve around FuncOp/function related constructs. This patch simply handles the initial renaming (which by itself is already huge), but there are a large number of cleanups unlocked/necessary afterwards: * Removing a bunch of unnecessary dependencies on Func * Cleaning up the From/ToStandard conversion passes * Preparing for the move of FuncOp to the Func dialect See the discussion at https://discourse.llvm.org/t/standard-dialect-the-final-chapter/6061 Differential Revision: https://reviews.llvm.org/D120624
2022-02-06[mlir] Split out a new ControlFlow dialect from StandardRiver Riddle
This dialect is intended to model lower level/branch based control-flow constructs. The initial set of operations are: AssertOp, BranchOp, CondBranchOp, SwitchOp; all split out from the current standard dialect. See https://discourse.llvm.org/t/standard-dialect-the-final-chapter/6061 Differential Revision: https://reviews.llvm.org/D118966
2022-02-02[mlir:Standard] Remove support for creating a `unit` ConstantOpRiver Riddle
This is completely unused upstream, and does not really have well defined semantics on what this is supposed to do/how this fits into the ecosystem. Given that, as part of splitting up the standard dialect it's best to just remove this behavior, instead of try to awkwardly fit it somewhere upstream. Downstream users are encouraged to define their own operations that clearly can define the semantics of this. This also uncovered several lingering uses of ConstantOp that weren't updated to use arith::ConstantOp, and worked during conversions because the constant was removed/converted into something else before verification. See https://llvm.discourse.group/t/standard-dialect-the-final-chapter/ for more discussion. Differential Revision: https://reviews.llvm.org/D118654
2022-02-02[mlir] Move SelectOp from Standard to ArithmeticRiver Riddle
This is part of splitting up the standard dialect. See https://llvm.discourse.group/t/standard-dialect-the-final-chapter/ for discussion. Differential Revision: https://reviews.llvm.org/D118648
2022-02-02[mlir] Split std.splat into tensor.splat and vector.splatRiver Riddle
This is part of the larger effort to split the standard dialect. This will also allow for pruning some additional dependencies on Standard (done in a followup). Differential Revision: https://reviews.llvm.org/D118202
2022-01-26[mlir] Move std.generic_atomic_rmw to the memref dialectRiver Riddle
This is part of splitting up the standard dialect. The move makes sense anyways, given that the memref dialect already holds memref.atomic_rmw which is the non-region sibling operation of std.generic_atomic_rmw (the relationship is even more clear given they have nearly the same description % how they represent the inner computation). Differential Revision: https://reviews.llvm.org/D118209
2022-01-24[mlir:Transforms] Move out the remaining non-dialect independent transforms ↵River Riddle
and utilities This has been a major TODO for a very long time, and is necessary for establishing a proper dialect-free dependency layering for the Transforms library. Code was moved to effectively two main locations: * Affine/ There was quite a bit of affine dialect related code in Transforms/ do to historical reasons (of a time way into MLIR's past). The following headers were moved to: Transforms/LoopFusionUtils.h -> Dialect/Affine/LoopFusionUtils.h Transforms/LoopUtils.h -> Dialect/Affine/LoopUtils.h Transforms/Utils.h -> Dialect/Affine/Utils.h The following transforms were also moved: AffineLoopFusion, AffinePipelineDataTransfer, LoopCoalescing * SCF/ Only one SCF pass was in Transforms/ (likely accidentally placed here): ParallelLoopCollapsing The SCF specific utilities in LoopUtils have been moved to SCF/Utils.h * Misc: mlir::moveLoopInvariantCode was also moved to LoopLikeInterface.h given that it is a simple utility defined in terms of LoopLikeOpInterface. Differential Revision: https://reviews.llvm.org/D117848
2022-01-19[mlir] Make locations required when adding/creating block argumentsRiver Riddle
BlockArguments gained the ability to have locations attached a while ago, but they have always been optional. This goes against the core tenant of MLIR where location information is a requirement, so this commit updates the API to require locations. Fixes #53279 Differential Revision: https://reviews.llvm.org/D117633
2022-01-18[mlir] Convert OpTrait::FunctionLike to FunctionOpInterfaceRiver Riddle
This commit refactors the FunctionLike trait into an interface (FunctionOpInterface). FunctionLike as it is today is already a pseudo-interface, with many users checking the presence of the trait and then manually into functionality implemented in the function_like_impl namespace. By transitioning to an interface, these accesses are much cleaner (ideally with no direct calls to the impl namespace outside of the implementation of the derived function operations, e.g. for parsing/printing utilities). I've tried to maintain as much compatability with the current state as possible, while also trying to clean up as much of the cruft as possible. The general migration plan for current users of FunctionLike is as follows: * function_like_impl -> function_interface_impl Realistically most user calls should remove references to functions within this namespace outside of a vary narrow set (e.g. parsing/printing utilities). Calls to the attribute name accessors should be migrated to the `FunctionOpInterface::` equivalent, most everything else should be updated to be driven through an instance of the interface. * OpTrait::FunctionLike -> FunctionOpInterface `hasTrait` checks will need to be moved to isa, along with the other various Trait vs Interface API differences. * populateFunctionLikeTypeConversionPattern -> populateFunctionOpInterfaceTypeConversionPattern Fixes #52917 Differential Revision: https://reviews.llvm.org/D117272
2022-01-02Apply clang-tidy fixes for performance-for-range-copy to MLIR (NFC)Mehdi Amini
2021-12-30[MLIR] Move AtomicRMW into MemRef dialect and enum into ArithWilliam S. Moses
Per the discussion in https://reviews.llvm.org/D116345 it makes sense to move AtomicRMWOp out of the standard dialect. This was accentuated by the need to add a fold op with a memref::cast. The only dialect that would permit this is the memref dialect (keeping it in the standard dialect or moving it to the arithmetic dialect would require those dialects to have a dependency on the memref dialect, which breaks linking). As the AtomicRMWKind enum is used throughout, this has been moved to Arith. Reviewed By: Mogball Differential Revision: https://reviews.llvm.org/D116392
2021-12-29[MLIR] Expose atomicrmw and/orWilliam S. Moses
LLVM (dialect and IR) have atomics for and/or. This patch enables atomic_rmw ops in the standard dialect for and/or that lower to these (in addition to the existing atomics such as addi, etc). Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D116345
2021-12-14[mlir] Split std.rank into tensor.rank and memref.rank.Alexander Belyaev
Move `std.rank` similarly to how `std.dim` was moved to TensorOps and MemRefOps. Differential Revision: https://reviews.llvm.org/D115665
2021-12-08Adjust "end namespace" comment in MLIR to match new agree'd coding styleMehdi Amini
See D115115 and this mailing list discussion: https://lists.llvm.org/pipermail/llvm-dev/2021-December/154199.html Differential Revision: https://reviews.llvm.org/D115309
2021-11-26[mlir][Standard] Support 0-D vectors in `SplatOp`Michal Terepeta
This changes the op to produce `AnyVectorOfAnyRank` and implements this by just inserting the element (skipping the shuffle that we do for the 1-D case). Depends On D114549 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D114598
2021-11-18[mlir] Convert NamedAttribute to be a classRiver Riddle
NamedAttribute is currently represented as an std::pair, but this creates an extremely clunky .first/.second API. This commit converts it to a class, with better accessors (getName/getValue) and also opens the door for more convenient API in the future. Differential Revision: https://reviews.llvm.org/D113956
2021-10-24[mlir] Switch arith, llvm, std & shape dialects to accessors prefixed both form.Jacques Pienaar
Following https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476, this follows flipping these dialects to _Both prefixed form. This changes the accessors to have a prefix. This was possibly mostly without breaking breaking changes if the existing convenience methods were used. (https://github.com/jpienaar/llvm-project/blob/main/clang-tools-extra/clang-tidy/misc/AddGetterCheck.cpp was used to migrate the callers post flipping, using the output from Operator.cpp) Differential Revision: https://reviews.llvm.org/D112383
2021-10-13[MLIR] Replace std ops with arith dialect opsMogball
Precursor: https://reviews.llvm.org/D110200 Removed redundant ops from the standard dialect that were moved to the `arith` or `math` dialects. Renamed all instances of operations in the codebase and in tests. Reviewed By: rriddle, jpienaar Differential Revision: https://reviews.llvm.org/D110797
2021-09-27[MLIR][LLVM] Add error if using incorrect attribute type for specifying LLVM ↵William S. Moses
linkage Address post-commit review in https://reviews.llvm.org/D108524 to add appropriate diagnostics. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D110566
2021-09-24[mlir:OpConversionPattern] Add overloads for taking an Adaptor instead of ↵River Riddle
ArrayRef This has been a TODO for a long time, and it brings about many advantages (namely nice accessors, and less fragile code). The existing overloads that accept ArrayRef are now treated as deprecated and will be removed in a followup (after a small grace period). Most of the upstream MLIR usages have been fixed by this commit, the rest will be handled in a followup. Differential Revision: https://reviews.llvm.org/D110293
2021-09-09[mlir] Factor type reconciliation out of Standard-to-LLVM conversionAlex Zinenko
Conversion to the LLVM dialect is being refactored to be more progressive and is now performed as a series of independent passes converting different dialects. These passes may produce `unrealized_conversion_cast` operations that represent pending conversions between built-in and LLVM dialect types. Historically, a more monolithic Standard-to-LLVM conversion pass did not need these casts as all operations were converted in one shot. Previous refactorings have led to the requirement of running the Standard-to-LLVM conversion pass to clean up `unrealized_conversion_cast`s even though the IR had no standard operations in it. The pass must have been also run the last among all to-LLVM passes, in contradiction with the partial conversion logic. Additionally, the way it was set up could produce invalid operations by removing casts between LLVM and built-in types even when the consumer did not accept the uncasted type, or could lead to cryptic conversion errors (recursive application of the rewrite pattern on `unrealized_conversion_cast` as a means to indicate failure to eliminate casts). In fact, the need to eliminate A->B->A `unrealized_conversion_cast`s is not specific to to-LLVM conversions and can be factored out into a separate type reconciliation pass, which is achieved in this commit. While the cast operation itself has a folder pattern, it is insufficient in most conversion passes as the folder only applies to the second cast. Without complex legality setup in the conversion target, the conversion infra will either consider the cast operations valid and not fold them (a separate canonicalization would be necessary to trigger the folding), or consider the first cast invalid upon generation and stop with error. The pattern provided by the reconciliation pass applies to the first cast operation instead. Furthermore, having a separate pass makes it clear when `unrealized_conversion_cast`s could not have been eliminated since it is the only reason why this pass can fail. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D109507
2021-09-07[mlir] Fix SplatOp lowering to the LLVM dialectAlex Zinenko
The lowering has been incorrectly using the operands of the original op instead of rewritten operands provided to matchAndRewrite call. This may lead to spurious materializations and generally invalid IR. Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D109355
2021-09-03[MLIR] Primitive linkage lowering of FuncOpWilliam S. Moses
FuncOp always lowers to an LLVM external linkage presently. This makes it impossible to define functions in mlir which are local to the current module. Until MLIR FuncOps have a more formal linkage specification, this commit allows funcop's to have an optionally specified llvm.linkage attribute, whose value will be used as the linkage of the llvm funcop when lowered. Differential Revision: https://reviews.llvm.org/D108524 Support LLVM linkage
2021-08-11[mlir] Add std.bitcast -> llvm.bitcast conversionAlex Zinenko
The conversion is a straightforward one-to-one mapping with optional unrolling for nD vectors, similarly to other cast operations. Depends On D107889 Reviewed By: cota, akuegel Differential Revision: https://reviews.llvm.org/D107891
2021-08-09[mlir] support nD vector forms of shifts in std-to-llvm conversionAlex Zinenko
These ops were not ported to the nD vector conversion when it was introduced and nobody needed them so far. Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D107750
2021-07-21[mlir][LLVM] Revert bareptr calling convention handling as an argument ↵Nicolas Vasilache
materialization. Type conversion and argument materialization are context-free: there is no available information on which op / branch is currently being converted. As a consequence, bare ptr convention cannot be handled as an argument materialization: it would apply irrespectively of the parent op. This doesn't typecheck in the case of non-funcOp and we would see cases where a memref descriptor would be inserted in place of the pointer in another memref descriptor. For now the proper behavior is to revert to a specific BarePtrFunc implementation and drop the blanket argument materialization logic. This reverts the relevant piece of the conversion to LLVM to what it was before https://reviews.llvm.org/D105880 and adds a relevant test and documentation to avoid the mistake by whomever attempts this again in the future. Reviewed By: arpith-jacob Differential Revision: https://reviews.llvm.org/D106495
2021-07-16[mlir] replace llvm.mlir.cast with unrealized_conversion_castAlex Zinenko
The dialect-specific cast between builtin (ex-standard) types and LLVM dialect types was introduced long time before built-in support for unrealized_conversion_cast. It has a similar purpose, but is restricted to compatible builtin and LLVM dialect types, which may hamper progressive lowering and composition with types from other dialects. Replace llvm.mlir.cast with unrealized_conversion_cast, and drop the operation that became unnecessary. Also make unrealized_conversion_cast legal by default in LLVMConversionTarget as the majority of convesions using it are partial conversions that actually want the casts to persist in the IR. The standard-to-llvm conversion, which is still expected to run last, cleans up the remaining casts standard-to-llvm conversion, which is still expected to run last, cleans up the remaining casts Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D105880
2021-07-12[MLIR][StandardToLLVM] Move `copyUnrankedDescriptors` to patternFrederik Gossen
Make the function `copyUnrankedDescriptors` accessible in `ConvertToLLVMPattern`. Differential Revision: https://reviews.llvm.org/D105810
2021-07-12[mlir] factor math-to-llvm out of standard-to-llvmAlex Zinenko
After the Math has been split out of the Standard dialect, the conversion to the LLVM dialect remained as a huge monolithic pass. This is undesirable for the same complexity management reasons as having a huge Standard dialect itself, and is even more confusing given the existence of a separate dialect. Extract the conversion of the Math dialect operations to LLVM into a separate library and a separate conversion pass. Reviewed By: silvas Differential Revision: https://reviews.llvm.org/D105702
2021-07-09[mlir] factor memref-to-llvm lowering out of std-to-llvmAlex Zinenko
After the MemRef has been split out of the Standard dialect, the conversion to the LLVM dialect remained as a huge monolithic pass. This is undesirable for the same complexity management reasons as having a huge Standard dialect itself, and is even more confusing given the existence of a separate dialect. Extract the conversion of the MemRef dialect operations to LLVM into a separate library and a separate conversion pass. Reviewed By: herhut, silvas Differential Revision: https://reviews.llvm.org/D105625
2021-07-08[mlir] factor out ConvertToLLVMPatternAlex Zinenko
This class and classes that extend it are general utilities for any dialect that is being converted into the LLVM dialect. They are in no way specific to Standard-to-LLVM conversion and should not make their users depend on it. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D105542
2021-07-07[MLIR] Provide lowering of std switch to llvm switchWilliam S. Moses
This patch allows lowering of std switch to llvm switch Differential Revision: https://reviews.llvm.org/D105580
2021-07-07[mlir] factor out common parts of the converstion to the LLVM dialectAlex Zinenko
"Standard-to-LLVM" conversion is one of the oldest passes in existence. It has become quite large due to the size of the Standard dialect itself, which is being split into multiple smaller dialects. Furthermore, several conversion features are useful for any dialect that is being converted to the LLVM dialect, which, without this refactoring, creates a dependency from those conversions to the "standard-to-llvm" one. Put several of the reusable utilities from this conversion to a separate library, namely: - type converter from builtin to LLVM dialect types; - utility for building and accessing values of LLVM structure type; - utility for building and accessing values that represent memref in the LLVM dialect; - lowering options applicable everywhere. Additionally, remove the type wrapping/unwrapping notion from the type converter that is no longer relevant since LLVM types has been reimplemented as first-class MLIR types. Reviewed By: pifon2a Differential Revision: https://reviews.llvm.org/D105534
2021-07-01[mlir][tensor] Add tensor.dim operationMatthias Springer
* Split memref.dim into two operations: memref.dim and tensor.dim. Both ops have the same builder interface and op argument names, so that they can be used with templates in patterns that apply to both tensors and memrefs (e.g., some patterns in Linalg). * Add constant materializer to TensorDialect (needed for folding in affine.apply etc.). * Remove some MemRefDialect dependencies, make some explicit. Differential Revision: https://reviews.llvm.org/D105165
2021-06-29[mlir] Add support for LLVM's dso_local attrFelipe de Azevedo Piovezan
This patch brings support for setting runtime preemption specifiers of LLVM's GlobalValues. In LLVM semantics, if the `dso_local` attribute is not explicitly requested, then it is inferred based on linkage and visibility. We model this same behavior with a UnitAttribute: if it is present, then we explicitly request the GlobalValue to marked as `dso_local`, otherwise we rely on the GlobalValue itself to make this decision. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D104983
2021-06-28Revert "Revert "[mlir][memref] Implement lowering of memref.copy to llvm""Stephan Herhut
This reverts commit 7d6e589fc86d7865fc4bf92c583209700dd32aac. Windows build was unbroken.
2021-06-28Revert "[mlir][memref] Implement lowering of memref.copy to llvm"Jacques Pienaar
This reverts commit e9396449777f02d573deb25d603ee1b1d6e568c1. Breaks Windows build.
2021-06-28[mlir][memref] Implement lowering of memref.copy to llvmStephan Herhut
This lowering uses a library call to implement copying in the general case, i.e., supporting arbitrary rank and strided layouts.
2021-06-27[mlir][NFC] Cleanup: Move helper functions to StaticValueUtilsMatthias Springer
Reduce code duplication: Move various helper functions, that are duplicated in TensorDialect, MemRefDialect, LinalgDialect, StandardDialect, into a new StaticValueUtils.cpp. Differential Revision: https://reviews.llvm.org/D104687
2021-06-15Support lowering of index-cast on vector types.Arpith C. Jacob
The index cast operation accepts vector types. Implement its lowering in this patch. Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D104280
2021-06-11Introduce alloca_scope opDenys Shabalin
## Introduction This proposal describes the new op to be added to the `std` (and later moved `memref`) dialect called `alloca_scope`. ## Motivation Alloca operations are easy to misuse, especially if one relies on it while doing rewriting/conversion passes. For example let's consider a simple example of two independent dialects, one defines an op that wants to allocate on-stack and another defines a construct that corresponds to some form of looping: ``` dialect1.looping_op { %x = dialect2.stack_allocating_op } ``` Since the dialects might not know about each other they are going to define a lowering to std/scf/etc independently: ``` scf.for … { %x_temp = std.alloca … … // do some domain-specific work using %x_temp buffer … // and store the result into %result %x = %result } ``` Later on the scf and `std.alloca` is going to be lowered to llvm using a combination of `llvm.alloca` and unstructured control flow. At this point the use of `%x_temp` is bound to either be either optimized by llvm (for example using mem2reg) or in the worst case: perform an independent stack allocation on each iteration of the loop. While the llvm optimizations are likely to succeed they are not guaranteed to do so, and they provide opportunities for surprising issues with unexpected use of stack size. ## Proposal We propose a new operation that defines a finer-grain allocation scope for the alloca-allocated memory called `alloca_scope`: ``` alloca_scope { %x_temp = alloca … ... } ``` Here the lifetime of `%x_temp` is going to be bound to the narrow annotated region within `alloca_scope`. Moreover, one can also return values out of the alloca_scope with an accompanying `alloca_scope.return` op (that behaves similarly to `scf.yield`): ``` %result = alloca_scope { %x_temp = alloca … … alloca_scope.return %myvalue } ``` Under the hood the `alloca_scope` is going to lowered to a combination of `llvm.intr.stacksave` and `llvm.intr.strackrestore` that are going to be invoked automatically as control-flow enters and leaves the body of the `alloca_scope`. The key value of the new op is to allow deterministic guaranteed stack use through an explicit annotation in the code which is finer-grain than the function-level scope of `AutomaticAllocationScope` interface. `alloca_scope` can be inserted at arbitrary locations and doesn’t require non-trivial transformations such as outlining. ## Which dialect Before memref dialect is split, `alloca_scope` can temporarily reside in `std` dialect, and later on be moved to `memref` together with the rest of memory-related operations. ## Implementation An implementation of the op is available [here](https://reviews.llvm.org/D97768). Original commits: * Add initial scaffolding for alloca_scope op * Add alloca_scope.return op * Add no region arguments and variadic results * Add op descriptions * Add failing test case * Add another failing test * Initial implementation of lowering for std.alloca_scope * Fix backticks * Fix getSuccessorRegions implementation Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D97768
2021-06-08[mlir] support memref of memref in standard-to-llvm conversionAlex Zinenko
Now that memref supports arbitrary element types, add support for memref of memref and make sure it is properly converted to the LLVM dialect. The type support itself avoids adding the interface to the memref type itself similarly to other built-in types. This allows the shape, and therefore byte size, of the memref descriptor to remain a lowering aspect that is easier to customize and evolve as opposed to sanctifying it in the data layout specification for the memref type itself. Factor out the code previously in a testing pass to live in a dedicated data layout analysis and use that analysis in the conversion to compute the allocation size for memref of memref. Other conversions will be ported separately. Depends On D103827 Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D103828
2021-06-08[mlir] Make MemRef element type extensibleAlex Zinenko
Historically, MemRef only supported a restricted list of element types that were known to be storable in memory. This is unnecessarily restrictive given the open nature of MLIR's type system. Allow types to opt into being used as MemRef elements by implementing a type interface. For now, the interface is merely a declaration with no methods. Later, methods to query, e.g., the type size or whether a type can alias elements of another type may be added. Harden the "standard"-to-LLVM conversion against memrefs with non-builtin types. See https://llvm.discourse.group/t/rfc-memref-of-custom-types/3558. Depends On D103826 Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D103827
2021-06-08[mlir] fix integer type mismatch in alloc conversion to LLVMAlex Zinenko
Some places in the alloc-like op conversion use the converted index type whereas other places use the pointer-sized integer type, which may not be the same. Consistently use the converted index type, similarly to other address calculations. Reviewed By: pifon2a Differential Revision: https://reviews.llvm.org/D103826
2021-05-31[mlir][NFC] Remove illegal TanhOp in LLVMConversionTargetTres Popp
No tests fail and this seems to be technical debt from when the math dialect was created. This should not be there as it prevents users from configuring their converion target freely and results in unexpected behavior on seemingly unrelated ops. Differential Revision: https://reviews.llvm.org/D103388
2021-05-30[mlir] StandardToLLVM: option to disable AllocOp loweringButygin
Differential Revision: https://reviews.llvm.org/D103237
2021-05-26[mlir] Add n-D vector lowering to LLVM for cast opsharsh-nod
The casting ops (sitofp, uitofp, fptosi, fptoui) lowering currently does not handle n-D vectors. This patch fixes that. Differential Revision: https://reviews.llvm.org/D103207
2021-05-22[mlir] ConvertStandardToLLVM: make AllocLikeOpLowering publicButygin
It is useful for someone who wants to implement custom AllocOp LLVM lowering Differential Revision: https://reviews.llvm.org/D102932
2021-05-12[mlir] Support alignment in LLVM dialect GlobalOpDumitru Potop
First step in adding alignment as an attribute to MLIR global definitions. Alignment can be specified for global objects in LLVM IR. It can also be specified as a named attribute in the LLVMIR dialect of MLIR. However, this attribute has no standing and is discarded during translation from MLIR to LLVM IR. This patch does two things: First, it adds the attribute to the syntax of the llvm.mlir.global operation, and by doing this it also adds accessors and verifications. The syntax is "align=XX" (with XX being an integer), placed right after the value of the operation. Second, it allows transforming this operation to and from LLVM IR. It is checked whether the value is an integer power of 2. Reviewed By: ftynse, mehdi_amini Differential Revision: https://reviews.llvm.org/D101492