-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-llvm-ir Author: Tobias Kamm (kammt) ChangesCommit 8e70273 introduced a declaration for Full diff: https://github.com/llvm/llvm-project/pull/143093.diff 1 Files Affected:
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, certainly my bad. Thanks for fixing, LGTM!
(If you don't have commit access please say, and I'll land it on your behalf) |
This is my first PR here, so I don't have commit access (nor see an option here to merge the PR, as there usually is). So would be great if you could do that for me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second glance I've got a comment nit, see inline
llvm/lib/IR/Instruction.cpp
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second glance, I think this is supposed to be "after" as it's the moveAfter
method, would you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds right! That issue also exists in the existing implementations of Instruction::moveAfter(Instruction *MovePos)
/Instruction::moveAfterPreserving(Instruction *MovePos)
(methods above and below). Should I modify those as well while I'm at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please @ fixing those other comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will land in a few minutes
@kammt Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
…:iterator)` (llvm#143093) Commit 8e70273 introduced a declaration for `Instruction::moveAfter(InstListType::iterator)`. However, its implementation is missing. This PR adds it.
…:iterator)` (llvm#143093) Commit 8e70273 introduced a declaration for `Instruction::moveAfter(InstListType::iterator)`. However, its implementation is missing. This PR adds it.
…:iterator)` (llvm#143093) Commit 8e70273 introduced a declaration for `Instruction::moveAfter(InstListType::iterator)`. However, its implementation is missing. This PR adds it.
Commit 8e70273 introduced a declaration for
Instruction::moveAfter(InstListType::iterator)
. However, its implementation is missing. This PR adds it.