[PATCH] D154353: [DebugInfo][RemoveDIs] Implement behind-the-scenes debug-info maintenance in splice / moveBefore / insertBefore APIs

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 08:10:53 PST 2023


jmorse added inline comments.


================
Comment at: llvm/lib/IR/Instruction.cpp:118-119
+
+  // No need to manually update DPValues: if we insert after an instruction
+  // position, then we can never have any DPValues on "this".
+  if (DestParent->IsNewDbgInfoFormat)
----------------
Orlando wrote:
> jmorse wrote:
> > Orlando wrote:
> > > I'm a bit confused about what this comment is saying, please can you explain further (here)?
> > My recollection is that there are no scenarios where DPValues can change what instruction they're attached to as a result of insertAfter, for example:
> > 
> >     call dbg.value
> >     %foo = add
> >     call dbg.value
> >     %bar = sub
> >     call dbg.value
> > 
> > Inserting after %foo or after %bar doesn't cause an instruction be inserted inbetween dbg.values and the next instruction. All the dbg.values continue to "happen" at the next instruction, and that's preserved using DPValues too.
> > 
> > Of course, if the insert position of an instruction is a dbg.value intrinsic then this is no longer true. Not allowing people to do that is one of the design goals though: doing that is always a bug.
> That makes sense, though I still find the code comment confusing. If there's anything you can do to make it clearer that might help. YMMV
Ah yeah, I was going to update it, whoops. How about instead:

"There cannot be any debug-info records in the gap between this instruction, and the one we're inserting right now, therefore no DPValue maintenance is required".

?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154353/new/

https://reviews.llvm.org/D154353



More information about the llvm-commits mailing list