diff options
author | Florian Hahn <florian.hahn@arm.com> | 2018-11-13 17:54:43 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2018-11-13 17:54:43 +0000 |
commit | 107d0a87565ac7f067e38b1f73866959cad6f52f (patch) | |
tree | 015c914d553352a51b835fbbad8bccf8852475b7 /llvm/unittests/Transforms/Utils/CloningTest.cpp | |
parent | fa43892d6fdf77e373dcf54f1c934380b8731df2 (diff) | |
download | bcm5719-llvm-107d0a87565ac7f067e38b1f73866959cad6f52f.tar.gz bcm5719-llvm-107d0a87565ac7f067e38b1f73866959cad6f52f.zip |
[CSP, Cloning] Update DuplicateInstructionsInSplitBetween to use DomTreeUpdater.
This patch updates DuplicateInstructionsInSplitBetween to update a DTU
instead of applying updates to the DT directly.
Given that there only are 2 users, also updated them in this patch to
avoid churn.
I slightly moved the code in CallSiteSplitting around to reduce the
places where we have to pass in DTU. If necessary, I could split those
changes in a separate patch.
This fixes missing DT updates when dealing with musttail calls in
CallSiteSplitting, by using DTU->deleteBB.
Reviewers: junbuml, kuhar, NutshellySima, indutny, brzycki
Reviewed By: NutshellySima
llvm-svn: 346769
Diffstat (limited to 'llvm/unittests/Transforms/Utils/CloningTest.cpp')
-rw-r--r-- | llvm/unittests/Transforms/Utils/CloningTest.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/llvm/unittests/Transforms/Utils/CloningTest.cpp b/llvm/unittests/Transforms/Utils/CloningTest.cpp index 9a1ad19ebaa..051e3cd6235 100644 --- a/llvm/unittests/Transforms/Utils/CloningTest.cpp +++ b/llvm/unittests/Transforms/Utils/CloningTest.cpp @@ -14,6 +14,7 @@ #include "llvm/IR/Constant.h" #include "llvm/IR/DIBuilder.h" #include "llvm/IR/DebugInfo.h" +#include "llvm/IR/DomTreeUpdater.h" #include "llvm/IR/Function.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/InstIterator.h" @@ -224,9 +225,11 @@ TEST_F(CloneInstruction, DuplicateInstructionsToSplit) { Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V)); Builder2.CreateRetVoid(); + // Dummy DTU. ValueToValueMapTy Mapping; - - auto Split = DuplicateInstructionsInSplitBetween(BB2, BB1, SubInst, Mapping); + DomTreeUpdater DTU(DomTreeUpdater::UpdateStrategy::Lazy); + auto Split = + DuplicateInstructionsInSplitBetween(BB2, BB1, SubInst, Mapping, DTU); EXPECT_TRUE(Split); EXPECT_EQ(Mapping.size(), 2u); @@ -271,9 +274,11 @@ TEST_F(CloneInstruction, DuplicateInstructionsToSplitBlocksEq1) { Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V)); Builder2.CreateBr(BB2); + // Dummy DTU. + DomTreeUpdater DTU(DomTreeUpdater::UpdateStrategy::Lazy); ValueToValueMapTy Mapping; - - auto Split = DuplicateInstructionsInSplitBetween(BB2, BB2, BB2->getTerminator(), Mapping); + auto Split = DuplicateInstructionsInSplitBetween( + BB2, BB2, BB2->getTerminator(), Mapping, DTU); EXPECT_TRUE(Split); EXPECT_EQ(Mapping.size(), 3u); @@ -322,9 +327,11 @@ TEST_F(CloneInstruction, DuplicateInstructionsToSplitBlocksEq2) { Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V)); Builder2.CreateBr(BB2); + // Dummy DTU. + DomTreeUpdater DTU(DomTreeUpdater::UpdateStrategy::Lazy); ValueToValueMapTy Mapping; - - auto Split = DuplicateInstructionsInSplitBetween(BB2, BB2, SubInst, Mapping); + auto Split = + DuplicateInstructionsInSplitBetween(BB2, BB2, SubInst, Mapping, DTU); EXPECT_TRUE(Split); EXPECT_EQ(Mapping.size(), 2u); |