[llvm] [NFC][DebugInfo] Deprecate iterator-taking moveBefore and getFirstNonPHI (PR #124290)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 07:28:30 PST 2025
================
@@ -280,14 +280,26 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// When adding instructions to the beginning of the basic block, they should
/// be added before the returned value, not before the first instruction,
/// which might be PHI. Returns 0 is there's no non-PHI instruction.
+ ///
+ /// Deprecated in favour of getFirstNonPHIIt, which returns an iterator that
+ /// preserves some debugging information.
+ LLVM_DEPRECATED("Use iterators as instruction positions", "getFirstNonPHIIt")
const Instruction* getFirstNonPHI() const;
+ LLVM_DEPRECATED("Use iterators as instruction positions", "getFirstNonPHIIt")
Instruction* getFirstNonPHI() {
return const_cast<Instruction *>(
static_cast<const BasicBlock *>(this)->getFirstNonPHI());
}
- /// Iterator returning form of getFirstNonPHI. Installed as a placeholder for
- /// the RemoveDIs project that will eventually remove debug intrinsics.
+ /// Returns an iterator to the first instruction in this block that is not a
+ /// PHINode instruction.
+ ///
+ /// When adding instructions to the beginning of the basic block, they should
+ /// be added before the returned value, not before the first instruction,
+ /// which might be PHI. Returns end() if there's no non-PHI instruction.
+ ///
+ /// Avoid unwrapping the iterator to an Instruction* before inserting here,
+ /// as debug-info relevant information is preserved in the iterator.
----------------
OCHyams wrote:
Perhaps we can collapse "debug-info ... info" into just "debug-info" for simplicity?
```suggestion
/// Avoid unwrapping the iterator to an Instruction* before inserting here,
/// as important debug-info is preserved in the iterator.
```
https://github.com/llvm/llvm-project/pull/124290
More information about the llvm-commits
mailing list