Page MenuHomePhabricator

[mlir][llvm] Import debug intrinsics from LLVMIR.
ClosedPublic

Authored by gysit on Nov 21 2022, 1:03 AM.

Details

Summary

Currently, the import of LLVMIR fails if the program contains debug
intrinsics. The revision adds support to import debug intrinsics that
have no debug expression attached and drops all debug intrinsics with a
non-empty debug expression. It also moves the existing debug intrinsics
into the "intr" namespace by deriving from LLVM_IntrOp.

Diff Detail

Event Timeline

gysit created this revision.Nov 21 2022, 1:03 AM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Nov 21 2022, 1:03 AM
rriddle accepted this revision.Nov 29 2022, 12:02 AM
rriddle added inline comments.
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
280

Can we error out here at all?

Otherwise, this should have a TODO.

282
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
896–897

Why assert here instead of using cast above, or using report_fatal_error/unreachable/etc.?

This revision is now accepted and ready to land.Nov 29 2022, 12:02 AM
gysit added inline comments.Nov 29 2022, 12:19 AM
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
280

I prefer putting a TODO since the LLVMIR with debug information I have seen so far contains plenty of intrinsics with debug expressions. A hard error would thus prevent use from importing it at all. I plan to rework the error handling in the import in a follow up commit and will try to think of a better mechanism here. A warning that information has been dropped would be nice. However, we currently drop so much information (all kinds of meta information) that this may produce too many warnings / errors.

gysit updated this revision to Diff 478486.Nov 29 2022, 2:06 AM
gysit marked 2 inline comments as done.

Address reviewer comments.

This revision was landed with ongoing or failed builds.Nov 29 2022, 2:32 AM
This revision was automatically updated to reflect the committed changes.