diff options
author | Florian Hahn <flo@fhahn.com> | 2019-10-11 15:36:55 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-10-11 15:36:55 +0000 |
commit | 39d4c9fd56e353cc6ce55d5e482c8d14fb340ecc (patch) | |
tree | 1baffb02698ea8bdaaf27eb2b4172859bdb157ce /llvm/lib | |
parent | 033d16cedc08163d9ab3dcb15b30b9642e6b5282 (diff) | |
download | bcm5719-llvm-39d4c9fd56e353cc6ce55d5e482c8d14fb340ecc.tar.gz bcm5719-llvm-39d4c9fd56e353cc6ce55d5e482c8d14fb340ecc.zip |
[VPlan] Add moveAfter to VPRecipeBase.
This patch adds a moveAfter method to VPRecipeBase, which can be used to
move elements after other elements, across VPBasicBlocks, if necessary.
Reviewers: dcaballe, hsaito, rengolin, hfinkel
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D46825
llvm-svn: 374565
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/VPlan.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/VPlan.h | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index f2420f6f656..4b80d1fb20a 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -283,6 +283,12 @@ iplist<VPRecipeBase>::iterator VPRecipeBase::eraseFromParent() { return getParent()->getRecipeList().erase(getIterator()); } +void VPRecipeBase::moveAfter(VPRecipeBase *InsertPos) { + InsertPos->getParent()->getRecipeList().splice( + std::next(InsertPos->getIterator()), getParent()->getRecipeList(), + getIterator()); +} + void VPInstruction::generateInstruction(VPTransformState &State, unsigned Part) { IRBuilder<> &Builder = State.Builder; diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index 8a06412ad59..44d8a198f27 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -615,6 +615,10 @@ public: /// the specified recipe. void insertBefore(VPRecipeBase *InsertPos); + /// Unlink this recipe from its current VPBasicBlock and insert it into + /// the VPBasicBlock that MovePos lives in, right after MovePos. + void moveAfter(VPRecipeBase *MovePos); + /// This method unlinks 'this' from the containing basic block and deletes it. /// /// \returns an iterator pointing to the element after the erased one |