This is an archive of the discontinued LLVM Phabricator instance.

[mlir][llvm] Verify LLVM module before import
ClosedPublic

Authored by Dinistro on Feb 16 2023, 6:42 AM.

Details

Summary

This commit ensures that the importing of LLVM modules first verifies
that the module is even valid. As many tests did not work with valid
LLVM IR, they were fixed as part of this commit.

Some error messages were only reachable with invalid input IR, thus they
were replaced with a failures.

Diff Detail

Event Timeline

Dinistro created this revision.Feb 16 2023, 6:42 AM
Herald added a project: Restricted Project. · View Herald Transcript
Dinistro requested review of this revision.Feb 16 2023, 6:42 AM
gysit added a comment.Feb 16 2023, 7:12 AM

LGTM. I think running the LLVM verifier rather than implementing our own imperfect one is the way to go here.

mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.cpp
110

nit: Return failure for ...

gysit accepted this revision.Feb 16 2023, 9:09 AM
This revision is now accepted and ready to land.Feb 16 2023, 9:09 AM
This revision was automatically updated to reflect the committed changes.
Dinistro marked an inline comment as done.