[llvm] [IR] Remove deprecated Instruction*-based insertBefore/moveBefore overloads (PR #218234)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 23 07:34:30 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Marc Auberer (marcauberer)
<details>
<summary>Changes</summary>
Remove the deprecated Instruction::insertBefore(Instruction*), moveBefore(Instruction*), and moveBeforePreserving(Instruction*) overloads in favour of the iterator-accepting overloads. Follow-up commits migrate remaining in-tree callers.
---
Full diff: https://github.com/llvm/llvm-project/pull/218234.diff
2 Files Affected:
- (modified) llvm/include/llvm/IR/Instruction.h (-29)
- (modified) llvm/lib/IR/Instruction.cpp (-12)
``````````diff
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index 13646ec66d6b3..5615f51f6e6eb 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -235,16 +235,6 @@ class Instruction : public User,
/// \returns an iterator pointing to the element after the erased one
LLVM_ABI InstListType::iterator eraseFromParent();
- /// Insert an unlinked instruction into a basic block immediately before
- /// the specified instruction.
- ///
- /// Deprecated in favour of the iterator-accepting flavour. Iterators at the
- /// start of a block such as BasicBlock::getFirstNonPHIIt must be passed into
- /// insertBefore without unwrapping/rewrapping. For all other positions, call
- /// getIterator to fetch the instruction iterator.
- LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions",
- "") void insertBefore(Instruction *InsertPos);
-
/// Insert an unlinked instruction into a basic block immediately before
/// the specified position.
LLVM_ABI void insertBefore(InstListType::iterator InsertPos);
@@ -264,16 +254,6 @@ class Instruction : public User,
LLVM_ABI void insertBefore(BasicBlock &BB, InstListType::iterator InsertPos);
- /// Unlink this instruction from its current basic block and insert it into
- /// the basic block that MovePos lives in, right before MovePos.
- ///
- /// Deprecated in favour of the iterator-accepting flavour. Iterators at the
- /// start of a block such as BasicBlock::getFirstNonPHIIt must be passed into
- /// moveBefore without unwrapping/rewrapping. For all other positions, call
- /// getIterator to fetch the instruction iterator.
- LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions",
- "") void moveBefore(Instruction *MovePos);
-
/// Unlink this instruction from its current basic block and insert it into
/// the basic block that MovePos lives in, right before MovePos.
LLVM_ABI void moveBefore(InstListType::iterator InsertPos);
@@ -288,15 +268,6 @@ class Instruction : public User,
/// means that any adjacent debug-info should move with this instruction.
LLVM_ABI void moveBeforePreserving(BasicBlock &BB, InstListType::iterator I);
- /// Perform a \ref moveBefore operation, while signalling that the caller
- /// intends to preserve the original ordering of instructions. This implicitly
- /// means that any adjacent debug-info should move with this instruction.
- ///
- /// Deprecated in favour of the iterator-accepting flavour of
- /// moveBeforePreserving, as all insertions should be at iterator positions.
- LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions",
- "") void moveBeforePreserving(Instruction *MovePos);
-
private:
/// RemoveDIs project: all other moves implemented with this method,
/// centralising debug-info updates into one place.
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 1ac5bd6b636d1..a69365d1b1082 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -111,10 +111,6 @@ BasicBlock::iterator Instruction::eraseFromParent() {
return getParent()->getInstList().erase(getIterator());
}
-void Instruction::insertBefore(Instruction *InsertPos) {
- insertBefore(InsertPos->getIterator());
-}
-
/// Insert an unlinked instruction into a basic block immediately before the
/// specified instruction.
void Instruction::insertBefore(BasicBlock::iterator InsertPos) {
@@ -182,18 +178,10 @@ void Instruction::insertBefore(BasicBlock &BB,
/// Unlink this instruction from its current basic block and insert it into the
/// basic block that MovePos lives in, right before MovePos.
-void Instruction::moveBefore(Instruction *MovePos) {
- moveBeforeImpl(*MovePos->getParent(), MovePos->getIterator(), false);
-}
-
void Instruction::moveBefore(BasicBlock::iterator MovePos) {
moveBeforeImpl(*MovePos->getParent(), MovePos, false);
}
-void Instruction::moveBeforePreserving(Instruction *MovePos) {
- moveBeforeImpl(*MovePos->getParent(), MovePos->getIterator(), true);
-}
-
void Instruction::moveBeforePreserving(BasicBlock::iterator MovePos) {
moveBeforeImpl(*MovePos->getParent(), MovePos, true);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/218234
More information about the llvm-commits
mailing list