[all-commits] [llvm/llvm-project] 37f2f4: [DebugInfo][RemoveDIs] Handle a debug-info splicin...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Fri Dec 1 11:32:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 37f2f48c8f43b2b98869a6e5f009d3d2471ecdaf
      https://github.com/llvm/llvm-project/commit/37f2f48c8f43b2b98869a6e5f009d3d2471ecdaf
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2023-12-01 (Fri, 01 Dec 2023)

  Changed paths:
    M llvm/include/llvm/IR/BasicBlock.h
    M llvm/include/llvm/IR/DebugProgramInstruction.h
    M llvm/lib/IR/BasicBlock.cpp
    M llvm/unittests/IR/BasicBlockDbgInfoTest.cpp

  Log Message:
  -----------
  [DebugInfo][RemoveDIs] Handle a debug-info splicing corner case (#73810)

A large amount of complexity when it comes to shuffling DPValue objects
around is pushed into BasicBlock::spliceDebugInfo, and it gets
comprehensive testing there via the unit tests. It turns out that there's a
corner case though: splicing instructions and debug-info to the end()
iterator requires blocks of DPValues to be concatenated, but the DPValues
don't behave normally as they're dangling at the end of a block. While this
splicing-to-an-empty-block case is rare, and it's even rarer for it to
contain debug-info, it does happen occasionally.

Fix this by wrapping spliceDebugInfo with an outer layer that removes any
dangling DPValues in the destination block -- that way the main splicing
function (renamed to spliceDebugInfoImpl) doesn't need to worry about that
scenario. See the diagram in the added function for more info.




More information about the All-commits mailing list