This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Harden error propagation in LLVM import
ClosedPublic

Authored by ftynse on Jan 16 2020, 5:34 AM.

Details

Summary

LLVM importer to MLIR was implemented mostly as a prototype. As such, it did
not deal handle errors in a consistent way, reporting them out stderr in some
cases and continuing the execution in the error state until eventually
crashing. This is not desirable for a user-facing tool. Make sure errors are
returned from functions, consistently checked at call sites and propagated
further. Functions returning nullable IR values return nullptr to denote the
error state. Other functions return LogicalResult. LLVM importer in
mlir-translate should no longer crash on unsupported inputs.

The errors are reported without association with the source file (and therefore
cannot be checked using -verify-diagnostics). Attaching them to the actual
input file is left for future work.

Diff Detail

Event Timeline

ftynse created this revision.Jan 16 2020, 5:34 AM

Unit tests: unknown.

clang-tidy: unknown.

clang-format: unknown.

Build artifacts: diff.json, console-log.txt

nicolasvasilache accepted this revision.Jan 16 2020, 5:50 AM

Didn't look at code deeply but I expect this to be mostly mechanical.
In any case this is a welcome cleanup, thanks!

This revision is now accepted and ready to land.Jan 16 2020, 5:50 AM
This revision was automatically updated to reflect the committed changes.