This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo][RemoveDIs] Plumb remove-DIs command line switch into pass managers for ease of testing
ClosedPublic

Authored by jmorse on Jul 3 2023, 10:25 AM.

Details

Summary

This patch plumbs the command line --experimental-debuginfo-iterators flag in to the pass managers, so that modules can be converted to the new format, passes run, then converted back to the old format. That allows developers to test-out the new debuginfo representation across some part of LLVM with no further work, and from the command line. We've also installed flag-catchers at the various points that bitcode and textual IR can egress from a process, and temporarily convert the module to dbg.value format when doing so. This allows, for example, the test suite to be run with the command line option, and the reasonable possibility that it could work! (More work required to get there though). These blocks of code should be considered transitory as we (hopefully) move from one debug-info format to another.

This patch also provides the BasicBlock::dumpDbgValues method to give a rough illustration of what the DPMarker / DPValue layout looks like in a block. This isn't intended to be a formal, textual representation of that information, only a debugging aid -- I'm still diligently keeping away from producing a textual IR.

There are no tests: it's not clear to me how to test this behaviour. The objective is to let you silently turn on a different, but transparent, representation in memory to see whether it works or not. Thus, there /shouldn't/ be an observable change in behaviour to test for. Possibly this means that unit tests are the answer, although I'm open to suggestions.

Diff Detail

Event Timeline

jmorse created this revision.Jul 3 2023, 10:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 10:25 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
jmorse requested review of this revision.Jul 3 2023, 10:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2023, 10:25 AM
jmorse updated this revision to Diff 544027.Jul 25 2023, 10:15 AM

Add Module::print to the set of functions that convert to print debug-info in dbg.value format, while we're trying to move to a new format.

These blocks of code should be considered transitory as we (hopefully) move from one debug-info format to another.

SGTM

Thus, there /shouldn't/ be an observable change in behaviour to test for. Possibly this means that unit tests are the answer, although I'm open to suggestions.

I guess it could be possible to unittest the print functions. IMO if a bot is running with this mode enabled the IR tests should be providing decent coverage for the print functions, and convertToNewDbgValues is tested in other patches (right?), so this is probably ok as-is.

llvm/include/llvm/IR/PassManager.h
62

Have you tested building LLVM with -DBUILD_SHARED_LIBS=TRUE?

73

clang-format

llvm/lib/IR/AsmWriter.cpp
290

needs clang-formatting?

4030–4038

nit: add braces to if

llvm/lib/IR/BasicBlock.cpp
161

missing declaration in BasicBlock.h?

jmorse marked 4 inline comments as done.Nov 9 2023, 2:30 PM
This revision was not accepted when it landed; it landed in state Needs Review.Nov 9 2023, 2:33 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.