This is an archive of the discontinued LLVM Phabricator instance.

Add a pass that builds a debug info scope for LLVMFuncOp (adding a DISubprogramAttr)
ClosedPublic

Authored by mehdi_amini on Feb 14 2023, 9:18 PM.

Details

Summary

This may be seen as a hack, but it allows for any piece of MLIR to be able
to end up with DWARF debug info through LLVM.
Assuming the operations in the function have location such as FileLineCol,
this provides backtraces with line tables and allows to step in a debugger.
That makes this pass a perfect companion to -snapshot-op-locations

It was also the default behavior of MLIR to LLVM IR translation until MLIR
got support for proper debug info attributes.

Diff Detail

Event Timeline

mehdi_amini created this revision.Feb 14 2023, 9:18 PM
Herald added a project: Restricted Project. · View Herald Transcript
mehdi_amini published this revision for review.Feb 14 2023, 10:08 PM
mehdi_amini added reviewers: rriddle, jpienaar.

add end line to test file

rriddle accepted this revision.Feb 14 2023, 10:15 PM

Nice

mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
44

Can you spell out some of these autos?

This revision is now accepted and ready to land.Feb 14 2023, 10:15 PM

replace auto with qualified type

This revision was landed with ongoing or failed builds.Feb 14 2023, 10:43 PM
This revision was automatically updated to reflect the committed changes.