[RFC] Instruction API changes needed to eliminate debug intrinsics from IR

Hi folks,

An update on this – the major plumbing to make this all work is now landing / has landed, with anything that might cause a performance regression guarded by a cmake flag, LLVM_EXPERIMENTAL_DEBUGINFO_ITERATORS. With D154372 landed, LLVM will automagically transform debug-info into a non-instruction representation for the duration of optimisation passes if you pass -mllvm --experimental-debuginfo-iterators=true. This doesn’t achieve very much with what’s in-tree right now though.

The next step is installing a little more plumbing, followed by updating various optimisation passes to support transformation/maintenance of DPValues, the replacement for dbg.value intrinsics. This is going to take the form of parallel implementations of various functions using the new types and objects. On the one hand it feels redundant to just copy+paste a lot of code, but I’d like to view it as a feature: the basic principles behind how LLVM handles debug-info aren’t changing, just some of the types, hence we need duplicate implementations during a transitional period [0].

Making sure this duplicate code gets tested is important to avoid it immediately rotting. We’ve got a buildbot [1] running with the CMake flag enabled on it, and I’m planning on landing this patch [2] that enables the new-debug-info mode only if it’s built in. That’ll allow us to duplicate some RUN-lines in tests with that flag, meaning we get some test coverage via that buildbot.

Once those patches are all up I’ll post a call-for-testing with instructions on how to test out the debug-info stuff, and what kind of testing is needed. Most of what we’ve been doing is building programs, observing differences in the debug-info output, then letting llvm-reduce narrow down where the difference is for us, so it’s not labour intensive.

@StephenTozer is cooking up some patches for changing the textual IR format [3], more news on that shortly.

[0] Hopefully a few months not years.
[1] Buildbot
[2] [DebugInfo][RemoveDIs] Add flag to use "new" debug-info in opt by jmorse · Pull Request #71937 · llvm/llvm-project · GitHub
[3] [RFC][DebugInfo] Proposed changes to the textual IR representation for debug values


Thanks,
Jeremy

1 Like