[llvm] [Instruction] Add missing implementation for `moveAfter(InstListType::iterator)` (PR #143093)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 01:52:51 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Tobias Kamm (kammt)

<details>
<summary>Changes</summary>

Commit 8e702735090388a3231a863e343f880d0f96fecb introduced a declaration for `Instruction::moveAfter(InstListType::iterator)`. However, its implementation is missing. This PR adds it.

---
Full diff: https://github.com/llvm/llvm-project/pull/143093.diff


1 Files Affected:

- (modified) llvm/lib/IR/Instruction.cpp (+7) 


``````````diff
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

``````````

</details>


https://github.com/llvm/llvm-project/pull/143093


More information about the llvm-commits mailing list