[PATCH] D102158: [DebugInfo][Docs] Add corrected docs for how InstrRefBasedLDV works

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 10 03:05:27 PDT 2021


jmorse created this revision.
jmorse added a reviewer: debug-info.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Hello debug-info folks!

Some may have been wondering, "What happened to that variable-location rewrite that Jeremy was trying to sell?". It was a bit delayed, and my thought process went like this:

- Hey cool, this new LiveDebugValues is SSA construction at the end of compilation!
- I didn't know you could do SSA construction just with lattices!
- Ah... you actually can't, so I've missed something in my understanding,
- Curses.

As it happens, I was keeping an extra piece of information for each block that meant the analysis didn't qualify as a normal dataflow algorithm. I've refreshed my understanding and written more docs on what's happening, plus three worked examples. The short summary is:

- It's SSA construction, where the hard part is identifying PHIs,
- We have to eliminate all dead PHIs to get accurate variable locations,
- We use value propagation the eliminate most dead PHIs,
- And an RPO-traversal algorithm to eliminate dead PHIs at loop heads.

Reassuringly, mem2reg does the same thing, but in a different way, to eliminate dead PHIs.

Now that this is sorted out, I'll be much happier landing patches on this topic.

The diagrams are written in tikz, I've been using the "tikzit" environment. I'm not sure what LLVM needs in terms of the "original source" for diagrams like this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102158

Files:
  llvm/docs/BadlyBehaved.tikz
  llvm/docs/BadlyBehaved.tikz.png
  llvm/docs/InstrRefLiveDebugValues.md
  llvm/docs/NestedLoop.tikz
  llvm/docs/NestedLoop.tikz.png
  llvm/docs/NonDomLoop.tikz
  llvm/docs/NonDomLoop.tikz.png
  llvm/docs/SourceLevelDebugging.rst

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102158.344012.patch
Type: text/x-patch
Size: 42206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210510/1550f295/attachment.bin>


More information about the llvm-commits mailing list