llvm.org GIT mirror llvm / a0250a0
[Local] Remove unused LazyValueInfo pointer from removeUnreachableBlock. There are no users that pass in LazyValueInfo, so we can simplify the function a bit. Reviewers: brzycki, asbirlea, davide Reviewed By: davide Differential Revision: https://reviews.llvm.org/D68297 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373488 91177308-0d34-0410-b5e6-96231b3b80d8 Florian Hahn 1 year, 2 months ago
4 changed file(s) with 9 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
411411 /// Remove all blocks that can not be reached from the function's entry.
412412 ///
413413 /// Returns true if any basic block was removed.
414 bool removeUnreachableBlocks(Function &F, LazyValueInfo *LVI = nullptr,
415 DomTreeUpdater *DTU = nullptr,
414 bool removeUnreachableBlocks(Function &F, DomTreeUpdater *DTU = nullptr,
416415 MemorySSAUpdater *MSSAU = nullptr);
417416
418417 /// Combine the metadata of two instructions so that K can replace J. Some
25292529 // statepoints surviving this pass. This makes testing easier and the
25302530 // resulting IR less confusing to human readers.
25312531 DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
2532 bool MadeChange = removeUnreachableBlocks(F, nullptr, &DTU);
2532 bool MadeChange = removeUnreachableBlocks(F, &DTU);
25332533 // Flush the Dominator Tree.
25342534 DTU.getDomTree();
25352535
22092209
22102210 /// removeUnreachableBlocks - Remove blocks that are not reachable, even
22112211 /// if they are in a dead cycle. Return true if a change was made, false
2212 /// otherwise. If `LVI` is passed, this function preserves LazyValueInfo
2213 /// after modifying the CFG.
2214 bool llvm::removeUnreachableBlocks(Function &F, LazyValueInfo *LVI,
2215 DomTreeUpdater *DTU,
2212 /// otherwise.
2213 bool llvm::removeUnreachableBlocks(Function &F, DomTreeUpdater *DTU,
22162214 MemorySSAUpdater *MSSAU) {
22172215 SmallPtrSet Reachable;
22182216 bool Changed = markAliveBlocks(F, Reachable, DTU);
22362234 MSSAU->removeBlocks(DeadBlockSet);
22372235
22382236 // Loop over all of the basic blocks that are not reachable, dropping all of
2239 // their internal references. Update DTU and LVI if available.
2237 // their internal references. Update DTU if available.
22402238 std::vector Updates;
22412239 for (auto *BB : DeadBlockSet) {
22422240 for (BasicBlock *Successor : successors(BB)) {
22452243 if (DTU)
22462244 Updates.push_back({DominatorTree::Delete, BB, Successor});
22472245 }
2248 if (LVI)
2249 LVI->eraseBlock(BB);
22502246 BB->dropAllReferences();
22512247 if (DTU) {
22522248 // Remove the terminator of BB to clear the successor list of BB.
871871 auto runEager = [&](Function &F, DominatorTree *DT) {
872872 PostDominatorTree PDT = PostDominatorTree(F);
873873 DomTreeUpdater DTU(*DT, PDT, DomTreeUpdater::UpdateStrategy::Eager);
874 removeUnreachableBlocks(F, nullptr, &DTU);
874 removeUnreachableBlocks(F, &DTU);
875875 EXPECT_TRUE(DTU.getDomTree().verify());
876876 EXPECT_TRUE(DTU.getPostDomTree().verify());
877877 };
879879 auto runLazy = [&](Function &F, DominatorTree *DT) {
880880 PostDominatorTree PDT = PostDominatorTree(F);
881881 DomTreeUpdater DTU(*DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy);
882 removeUnreachableBlocks(F, nullptr, &DTU);
882 removeUnreachableBlocks(F, &DTU);
883883 EXPECT_TRUE(DTU.getDomTree().verify());
884884 EXPECT_TRUE(DTU.getPostDomTree().verify());
885885 };
908908
909909 auto checkRUBlocksRetVal = [&](Function &F, DominatorTree *DT) {
910910 DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
911 EXPECT_TRUE(removeUnreachableBlocks(F, nullptr, &DTU));
912 EXPECT_FALSE(removeUnreachableBlocks(F, nullptr, &DTU));
911 EXPECT_TRUE(removeUnreachableBlocks(F, &DTU));
912 EXPECT_FALSE(removeUnreachableBlocks(F, &DTU));
913913 EXPECT_TRUE(DTU.getDomTree().verify());
914914 };
915915