This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Call the instruction builders from a static method (NFC).
ClosedPublic

Authored by gysit on Jan 9 2023, 1:54 AM.

Details

Summary

Extract a static method to call the MLIR builders that translate LLVM IR
instructions to MLIR LLVM dialect operations. This change ensures the
MLIR builders have to use the moduleImport argument rather than calling
the import methods directly. As a result, both the intrinsic and the
instruction MLIR builders have to use a moduleImport argument and none
of them has direct access to private moduleImport methods. The revision
thus enforces consistent MLIR builder implementations for instructions
and intrinsics.

The revision also moves parseDataLayoutAlignment closer to its use.

Diff Detail

Event Timeline

gysit created this revision.Jan 9 2023, 1:54 AM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Jan 9 2023, 1:54 AM
Dinistro accepted this revision.Jan 10 2023, 1:58 AM

Ensuring that the mlirBuilders cannot access private members and thus forcing them to use the more stable public interface of ModuleImport is a good idea. LGTM!

mlir/lib/Target/LLVMIR/ModuleImport.cpp
235

Ultra NIT: There seem to be two spaces after the comma

This revision is now accepted and ready to land.Jan 10 2023, 1:58 AM