[mlir] use the new stateful LLVM type translator by default
authorAlex Zinenko <zinenko@google.com>
Wed, 5 Aug 2020 12:44:03 +0000 (14:44 +0200)
committerAlex Zinenko <zinenko@google.com>
Wed, 5 Aug 2020 22:36:33 +0000 (00:36 +0200)
commitb2ab375d1f08ab0faecc20f0340cb972f31010a7
tree6421c96ea8681c2b1fbf6198fdf4d10f9c28fac0
parente1de85f9f4dae68b2c83d8821515c1f5db765baa
[mlir] use the new stateful LLVM type translator by default

Previous type model in the LLVM dialect did not support identified structure
types properly and therefore could use stateless translations implemented as
free functions. The new model supports identified structs and must keep track
of the identified structure types present in the target context (LLVMContext or
MLIRContext) to avoid creating duplicate structs due to LLVM's type
auto-renaming. Expose the stateful type translation classes and use them during
translation, storing the state as part of ModuleTranslation.

Drop the test type translation mechanism that is no longer necessary and update
the tests to exercise type translation as part of the main translation flow.

Update the code in vector-to-LLVM dialect conversion that relied on stateless
translation to use the new class in a stateless manner.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D85297
13 files changed:
mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
mlir/include/mlir/Target/LLVMIR/TypeTranslation.h
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/lib/Target/LLVMIR/TypeTranslation.cpp
mlir/test/Target/import.ll
mlir/test/Target/llvmir-types.mlir
mlir/test/lib/CMakeLists.txt
mlir/test/lib/Target/CMakeLists.txt [deleted file]
mlir/test/lib/Target/TestLLVMTypeTranslation.cpp [deleted file]
mlir/tools/mlir-translate/mlir-translate.cpp