llvm-project/mlir/test/Target/LLVMIR
Alex Zinenko 8b58ab8ccd [mlir] Factor type reconciliation out of Standard-to-LLVM conversion
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-09 16:51:24 +02:00
..
amx.mlir [mlir][amx] Add Intel AMX dialect (architectural-specific vector dialect) 2021-03-15 17:59:05 -07:00
arm-neon-2d.mlir 2d Arm Neon sdot op, and lowering to the intrinsic. 2021-06-10 14:36:39 -07:00
arm-neon.mlir Fix some typos. 2021-05-14 21:34:09 +05:30
arm-sve.mlir [mlir][ArmSVE] Add basic load/store operations 2021-06-09 15:53:40 +01:00
import.ll [mlir] Support alignment in LLVM dialect GlobalOp 2021-05-12 09:07:20 +02:00
llvmir-debug.mlir
llvmir-intrinsics.mlir Recommit "[Matrix] Overload stride arg in matrix.columnwise.load/store." 2021-08-12 18:31:57 +01:00
llvmir-invalid.mlir [mlir] support translating OpenMP loops with reductions 2021-09-02 15:38:20 +02:00
llvmir-types.mlir
llvmir.mlir Make LLVM Linkage a first class attribute instead of using an integer attribute 2021-09-03 21:21:46 +00:00
nvvmir.mlir [MLIR][GPU][NVVM] Add warp synchronous matrix-multiply accumulate ops 2021-05-06 12:06:25 +05:30
openacc-llvm.mlir Fix a couple regression tests I missed updating in 2a284782 2021-07-31 13:41:15 -07:00
openmp-llvm.mlir [MLIR][OpenMP] Add support for declaring critical construct names 2021-09-02 14:31:19 +00:00
openmp-reduction.mlir [mlir] support translating OpenMP loops with reductions 2021-09-02 15:38:20 +02:00
rocdl.mlir
vector-to-llvm-ir.mlir [mlir] Factor type reconciliation out of Standard-to-LLVM conversion 2021-09-09 16:51:24 +02:00
x86vector.mlir [mlir] X86Vector: Add AVX Rsqrt 2021-04-13 08:43:48 -07:00