This is an archive of the discontinued LLVM Phabricator instance.

[mlir] introduce type constraints for operands of LLVM dialect operations
ClosedPublic

Authored by ftynse on Aug 13 2020, 5:48 AM.

Details

Summary

Historically, the operations in the MLIR's LLVM dialect only checked that the
operand are of LLVM dialect type without more detailed constraints. This was
due to LLVM dialect types wrapping LLVM IR types and having clunky verification
methods. With the new first-class modeling, it is possible to define type
constraints similarly to other dialects and use them to enforce some
correctness rules in verifiers instead of having LLVM assert during translation
to LLVM IR. This hardening discovered several issues where MLIR was producing
LLVM dialect operations that cannot exist in LLVM IR.

Depends On D85900

Diff Detail

Event Timeline

ftynse created this revision.Aug 13 2020, 5:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2020, 5:48 AM
ftynse requested review of this revision.Aug 13 2020, 5:48 AM
ftynse updated this revision to Diff 286013.Aug 17 2020, 7:04 AM

Minor fix in bitwidth

rriddle accepted this revision.Aug 19 2020, 12:01 PM
rriddle added inline comments.
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
259

nit: Align with the LLVM not the ins.

(This file seems inconsistent w.r.t this, so switch to whichever one is most common.)

439

Same here and throughout.

(Also unrelated, but we should switch away from using Arguments/Results and use the fields instead).

This revision is now accepted and ready to land.Aug 19 2020, 12:01 PM
ftynse updated this revision to Diff 289879.Sep 4 2020, 1:00 AM

Formatting.

This revision was landed with ongoing or failed builds.Sep 4 2020, 1:02 AM
This revision was automatically updated to reflect the committed changes.