Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions llvm/lib/IR/Instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down