[llvm] 5ebddd1 - [IR] Remove deprecated Instruction*-based insertBefore/moveBefore overloads (#218234)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 23 09:25:46 PDT 2026
Author: Marc Auberer
Date: 2026-08-23T18:25:41+02:00
New Revision: 5ebddd10133002d10e667a2264cbf46d4ba0ca60
URL: https://github.com/llvm/llvm-project/commit/5ebddd10133002d10e667a2264cbf46d4ba0ca60
DIFF: https://github.com/llvm/llvm-project/commit/5ebddd10133002d10e667a2264cbf46d4ba0ca60.diff
LOG: [IR] Remove deprecated Instruction*-based insertBefore/moveBefore overloads (#218234)
Remove the deprecated Instruction::insertBefore(Instruction*),
moveBefore(Instruction*), and moveBeforePreserving(Instruction*)
overloads in favour of the iterator-accepting overloads.
Co-authored-by: Claude <noreply at anthropic.com>
Added:
Modified:
llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/Instruction.cpp
Removed:
################################################################################
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);
}
More information about the llvm-commits
mailing list