[PATCH] D72839: [mlir] Harden error propagation in LLVM import

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 05:36:28 PST 2020


ftynse created this revision.
ftynse added a reviewer: nicolasvasilache.
Herald added subscribers: llvm-commits, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
ftynse added a reviewer: jmolloy.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72839

Files:
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72839.238467.patch
Type: text/x-patch
Size: 16866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200116/1b20f598/attachment.bin>


More information about the llvm-commits mailing list