This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Modernize LLVM instruction and global import (NFC).
ClosedPublic

Authored by gysit on Dec 6 2022, 1:30 AM.

Details

Summary

Modernize the import of LLVMIR instructions and global variables.
Use longer variable names, factor out code used to import call or
invoke instructions, use the CPP builders for importing branch
instructions, etc. The revision is a preparation for a follow up
revision that moves the import code to implement improved error
handling.

Diff Detail

Event Timeline

gysit created this revision.Dec 6 2022, 1:30 AM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Dec 6 2022, 1:30 AM
ftynse accepted this revision.Dec 9 2022, 12:35 AM
ftynse added inline comments.
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
696–702

Nit: add braces if the body has more than one line.

927–928

Nit: not sure if you need the temporary vector args here or if you can call convertValues(callInst->args()) directly

This revision is now accepted and ready to land.Dec 9 2022, 12:35 AM
gysit updated this revision to Diff 481573.Dec 9 2022, 1:54 AM
gysit marked an inline comment as done.

Address review comments and rebase.

mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
927–928

Unfortunately, the iterator range callInst->args() does not convert to an array reference due to the conversion from a use to a value. I can inline convertValues into append_range though. It does not avoid the extra copy but at least there are not two argument vectors side-by-side.

This revision was landed with ongoing or failed builds.Dec 9 2022, 2:50 AM
This revision was automatically updated to reflect the committed changes.