diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-08-29 14:07:48 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-08-29 14:07:48 +0000 |
commit | 674d2c23ea3519a8b482f98eb56a59505ea694b9 (patch) | |
tree | 779cae0c9948ba9021cbebe2cd6a93dda4240f9d /llvm/lib/IR/Instruction.cpp | |
parent | 86873030ae67d05fadfb228c33254bae59c905a1 (diff) | |
download | bcm5719-llvm-674d2c23ea3519a8b482f98eb56a59505ea694b9.tar.gz bcm5719-llvm-674d2c23ea3519a8b482f98eb56a59505ea694b9.zip |
[Instruction] add moveAfter() convenience function; NFCI
As suggested in D37121, here's a wrapper for removeFromParent() + insertAfter(),
but implemented using moveBefore() for symmetry/efficiency.
Differential Revision: https://reviews.llvm.org/D37239
llvm-svn: 312001
Diffstat (limited to 'llvm/lib/IR/Instruction.cpp')
-rw-r--r-- | llvm/lib/IR/Instruction.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp index 365cb019aec..ceb521c4c48 100644 --- a/llvm/lib/IR/Instruction.cpp +++ b/llvm/lib/IR/Instruction.cpp @@ -89,6 +89,10 @@ void Instruction::moveBefore(Instruction *MovePos) { moveBefore(*MovePos->getParent(), MovePos->getIterator()); } +void Instruction::moveAfter(Instruction *MovePos) { + moveBefore(*MovePos->getParent(), ++MovePos->getIterator()); +} + void Instruction::moveBefore(BasicBlock &BB, SymbolTableList<Instruction>::iterator I) { assert(I == BB.end() || I->getParent() == &BB); |