[all-commits] [llvm/llvm-project] 79499f: [NFC][DebugInfo] Deprecate iterator-taking moveBef...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Tue Jan 28 06:03:35 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 79499f010d2bfe809187a9a5f042d4e4ee1f1bcc
      https://github.com/llvm/llvm-project/commit/79499f010d2bfe809187a9a5f042d4e4ee1f1bcc
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2025-01-28 (Tue, 28 Jan 2025)

  Changed paths:
    M llvm/include/llvm/IR/BasicBlock.h
    M llvm/include/llvm/IR/Instruction.h
    M llvm/lib/IR/BasicBlock.cpp
    M llvm/lib/IR/Instruction.cpp

  Log Message:
  -----------
  [NFC][DebugInfo] Deprecate iterator-taking moveBefore and getFirstNonPHI (#124290)

The RemoveDIs project [0] makes debug intrinsics obsolete and to support
this instruction iterators carry an extra bit of debug information. To
maintain debug information accuracy insertion needs to be performed with a
BasicBlock::iterator rather than with Instruction pointers, otherwise the
extra bit of debug information is lost.

To that end, we're deprecating getFirstNonPHI and moveBefore for
instruction pointers. They're replaced by getFirstNonPHIIt and an
iterator-taking moveBefore: switching to the replacement is
straightforwards, and 99% of call-sites need only to unwrap the iterator
with &* or call getIterator() on an Instruction pointer.

The exception is when inserting instructions at the start of a block: if
you call getFirstNonPHI() (or begin() or getFirstInsertionPt()) and then
insert something at that position, you must pass the BasicBlock::iterator
returned into the insertion method. Unwrapping with &* and then calling
getIterator strips the debug-info bit we wish to preserve. Please do
contact us about any use case that's confusing or unclear [1].

[0] https://llvm.org/docs/RemoveDIsDebugInfo.html
[1] https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list