This is an archive of the discontinued LLVM Phabricator instance.

[mlir] use the new stateful LLVM type translator by default
ClosedPublic

Authored by ftynse on Aug 5 2020, 5:46 AM.

Details

Summary

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.

Diff Detail

Event Timeline

ftynse created this revision.Aug 5 2020, 5:46 AM
Herald added a project: Restricted Project. · View Herald Transcript
ftynse requested review of this revision.Aug 5 2020, 5:46 AM
rriddle accepted this revision.Aug 5 2020, 11:30 AM
rriddle added inline comments.
mlir/lib/Target/LLVMIR/TypeTranslation.cpp
168

nit: Only classes should be in namespace here, the functions should be top-level.

This revision is now accepted and ready to land.Aug 5 2020, 11:30 AM
ftynse marked an inline comment as done.Aug 5 2020, 12:04 PM
This revision was automatically updated to reflect the committed changes.
mlir/test/lib/CMakeLists.txt