[llvm] [Instruction] Add missing implementation for `moveAfter(InstListType::iterator)` (PR #143093)
Tobias Kamm via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 02:56:58 PDT 2025
https://github.com/kammt updated https://github.com/llvm/llvm-project/pull/143093
>From 56d8c5f7ce0101c461acfeb9f9938f09c5e0ddff Mon Sep 17 00:00:00 2001
From: Tobias Kamm <tobias.kamm at tum.de>
Date: Fri, 6 Jun 2025 09:29:39 +0200
Subject: [PATCH 1/2] [Instruction] Add missing implementation for
moveAfter(InstListType::iterator)
---
llvm/lib/IR/Instruction.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 997f3849d4c1b..202fd4fdd5c5d 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -197,6 +197,13 @@ void Instruction::moveAfter(Instruction *MovePos) {
moveBeforeImpl(*MovePos->getParent(), NextIt, false);
}
+void Instruction::moveAfter(InstListType::iterator MovePos) {
+ // We want this instruction to be moved to before 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
>From 1ba058265538f93c4fa7a51d08ba0429c48721dd Mon Sep 17 00:00:00 2001
From: Tobias Kamm <tobias.kamm at tum.de>
Date: Fri, 6 Jun 2025 11:56:25 +0200
Subject: [PATCH 2/2] [Instruction] Updated comments in moveAfter*
implementations
before->after
---
llvm/lib/IR/Instruction.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 202fd4fdd5c5d..18ce16522af90 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -191,14 +191,14 @@ 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 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.
MovePos.setHeadBit(true);
moveBeforeImpl(*MovePos->getParent(), MovePos, false);
@@ -206,7 +206,7 @@ void Instruction::moveAfter(InstListType::iterator MovePos) {
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