[llvm] 55e4c6d - [Instruction] Add missing implementation for `moveAfter(InstListType::iterator)` (#143093)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 04:15:25 PDT 2025
Author: Tobias Kamm
Date: 2025-06-06T12:15:22+01:00
New Revision: 55e4c6d95dad7954e15af5da1672b7108f358e71
URL: https://github.com/llvm/llvm-project/commit/55e4c6d95dad7954e15af5da1672b7108f358e71
DIFF: https://github.com/llvm/llvm-project/commit/55e4c6d95dad7954e15af5da1672b7108f358e71.diff
LOG: [Instruction] Add missing implementation for `moveAfter(InstListType::iterator)` (#143093)
Commit 8e702735090388a3231a863e343f880d0f96fecb introduced a declaration
for `Instruction::moveAfter(InstListType::iterator)`. However, its
implementation is missing. This PR adds it.
Added:
Modified:
llvm/lib/IR/Instruction.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 997f3849d4c1b..18ce16522af90 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -191,15 +191,22 @@ void Instruction::moveBeforePreserving(BasicBlock::iterator MovePos) {
void Instruction::moveAfter(Instruction *MovePos) {
auto NextIt = std::next(MovePos->getIterator());
- // We want this instruction to be moved to before NextIt in the instruction
+ // We want this instruction to be moved to after NextIt in the instruction
// list, but before NextIt's debug value range.
NextIt.setHeadBit(true);
moveBeforeImpl(*MovePos->getParent(), NextIt, false);
}
+void Instruction::moveAfter(InstListType::iterator MovePos) {
+ // We want this instruction to be moved to after NextIt in the instruction
+ // list, but before NextIt's debug value range.
+ MovePos.setHeadBit(true);
+ moveBeforeImpl(*MovePos->getParent(), MovePos, false);
+}
+
void Instruction::moveAfterPreserving(Instruction *MovePos) {
auto NextIt = std::next(MovePos->getIterator());
- // We want this instruction and its debug range to be moved to before NextIt
+ // We want this instruction and its debug range to be moved to after NextIt
// in the instruction list, but before NextIt's debug value range.
NextIt.setHeadBit(true);
moveBeforeImpl(*MovePos->getParent(), NextIt, true);
More information about the llvm-commits
mailing list