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/unittests/Transforms/Vectorize/VPlanTest.cpp | |
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/unittests/Transforms/Vectorize/VPlanTest.cpp')
-rw-r--r-- | llvm/unittests/Transforms/Vectorize/VPlanTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp index 90f79a3eaf4..57567e7d843 100644 --- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp +++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp @@ -59,5 +59,31 @@ TEST(VPInstructionTest, eraseFromParent) { EXPECT_TRUE(VPBB1.empty()); } +TEST(VPInstructionTest, moveAfter) { + VPInstruction *I1 = new VPInstruction(0, {}); + VPInstruction *I2 = new VPInstruction(1, {}); + VPInstruction *I3 = new VPInstruction(2, {}); + + VPBasicBlock VPBB1; + VPBB1.appendRecipe(I1); + VPBB1.appendRecipe(I2); + VPBB1.appendRecipe(I3); + + I1->moveAfter(I2); + + CHECK_ITERATOR(VPBB1, I2, I1, I3); + + VPInstruction *I4 = new VPInstruction(4, {}); + VPInstruction *I5 = new VPInstruction(5, {}); + VPBasicBlock VPBB2; + VPBB2.appendRecipe(I4); + VPBB2.appendRecipe(I5); + + I3->moveAfter(I4); + + CHECK_ITERATOR(VPBB1, I2, I1); + CHECK_ITERATOR(VPBB2, I4, I3, I5); +} + } // namespace } // namespace llvm |