I’ve been looking through the various bits of debug info machinery in LLVM today, and I’m a bit unsure of the current status of @llvm.dbg.addr.
From what I could find, dbg.addr was added in 2017 after an RFC as a way of tracking locations of variables in memory which move rather than staying fixed (where dbg.declare can be used). Debug info docs currently describedbg.declare as deprecated, with dbg.addr as its intended replacement.
At the moment though, it does not seem like Clang or the optimisation passes add dbg.addr intrinsics by default. There are also a few open issues which suggest dbg.addr doesn’t quite work correctly at the moment.
Is there a plan to fix issues in this area and make dbg.addr the default? Perhaps @rnk may know, since they added it originally.
My apologies if I’ve missed something obvious here!
On the other hand there has been some recent work to improve support for the intrinsic, most notably @gottesmm has submitted a number of patches to improve support for it, particularly in relation to coroutines, so there is at least some investment. In my personal opinion though, I would favour removing dbg.addr and using dbg.value (or even better where appropriate, dbg.assign) instead.
Thanks for everyone’s replies on this topic a few months back.
There seems to be clear enough agreement that dbg.addr should go away. I’m happy to take on the work of removing it, as I think it will make things easier to follow for the next person who investigates LLVM’s debug info support.
Perhpas I should wait for @OCHyams’s Assignment Tracking patch stack to be merged first though…? I expect I would need to update many of the same files.
I’m so sorry @jryans I completely forgot to come back and reply to this. There’s still work to be done with assignment tracking, but all the main / disruptive patches have landed now. It’s been a while but I thought it would still be worth mentioning in case this is something you’re still considering picking up.
Thanks for the update! I hope to make an attempt at this in the next few weeks then.
I wonder what level of IR compatibility is required here, given that has dbg.addr always required various experimental flags… Could we just drop / ignore any uses of dbg.addr, or do we need to make some attempt to “upgrade” uses of it in old IR into the remaining supported intrinsics?
In the SourceLevelDebugging doc, there is some text that makes llvm.dbg.addr seem like a preferred approach, and mentions that there is a “plan to deprecate [llvm.dbg.declare] in future LLVM releases” where it is implied (by my reading) that llvm.dbg.addr would be a likely equivalent. So that doc probably should be updated ASAP, I would think, if there is agreement (?) that llvm.dbg.addr is to be removed.
That text (and the confusion about current status that ensues) is a major reason I want to do this clean up. Once I’ve updated those docs, I hope it will make things easier to follow for future readers.