[llvm] [DebugInfo][RemoveDIs] Handle a debug-info splicing corner case (PR #73810)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 02:51:39 PST 2023


================
@@ -829,6 +829,90 @@ void BasicBlock::spliceDebugInfoEmptyBlock(BasicBlock::iterator Dest,
 void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src,
                                  BasicBlock::iterator First,
                                  BasicBlock::iterator Last) {
+  /* Do a quick normalisation before calling the real splice implementation. We
+     might be operating on a degenerate basic block that has no instructions
+     in it, a legitimate transient state. In that case, Dest will be end() and
+     any DPValues temporarily stored in the TrailingDPValues map in LLVMContext.
+     We might illustrate it thus:
+
+                         Dest
+                           |
+     this-block:    ~~~~~~~~
+      Src-block             ++++B---B---B---B:::C
+                                |               |
+                               First           Last
+
----------------
OCHyams wrote:

nit: `Src-block:` (added `:`)

https://github.com/llvm/llvm-project/pull/73810


More information about the llvm-commits mailing list