This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Improve LLVM IR import error handling.
ClosedPublic

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

Details

Summary

Instead of exiting in the middle of the import handle errors more
gracefully by printing an error message and returning failure. The
revision handles and tests the import of unsupported instructions,
values, constants, and intrinsics.

Depends on D139404

Diff Detail

Event Timeline

gysit created this revision.Dec 6 2022, 1:46 AM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Dec 6 2022, 1:46 AM
ftynse accepted this revision.Dec 9 2022, 2:21 AM

Nice!

mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
725–731

Nit: braces when more than one line in the body.

858–861

I suppose it should be possible to construct a FileLineColLoc from LLVM location info

mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp
247

Nit: consider a more unique name, like _llvmir_gen_operand.

This revision is now accepted and ready to land.Dec 9 2022, 2:21 AM
gysit updated this revision to Diff 481595.Dec 9 2022, 3:39 AM
gysit marked 3 inline comments as done.

Address review comments and rebase.

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