]> granicus.if.org Git - llvm/commitdiff
[Local] Remove unused LazyValueInfo pointer from removeUnreachableBlock.
authorFlorian Hahn <flo@fhahn.com>
Wed, 2 Oct 2019 16:58:13 +0000 (16:58 +0000)
committerFlorian Hahn <flo@fhahn.com>
Wed, 2 Oct 2019 16:58:13 +0000 (16:58 +0000)
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

include/llvm/Transforms/Utils/Local.h
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
lib/Transforms/Utils/Local.cpp
unittests/Transforms/Utils/LocalTest.cpp

index 5c5e0aef34cdf4e1a2dcc8de48a61f8c6cd653d3..9fcb2f64d79b837c088ccc8849e7cbcd99173ee1 100644 (file)
@@ -412,8 +412,7 @@ void removeUnwindEdge(BasicBlock *BB, DomTreeUpdater *DTU = nullptr);
 /// Remove all blocks that can not be reached from the function's entry.
 ///
 /// Returns true if any basic block was removed.
-bool removeUnreachableBlocks(Function &F, LazyValueInfo *LVI = nullptr,
-                             DomTreeUpdater *DTU = nullptr,
+bool removeUnreachableBlocks(Function &F, DomTreeUpdater *DTU = nullptr,
                              MemorySSAUpdater *MSSAU = nullptr);
 
 /// Combine the metadata of two instructions so that K can replace J. Some
index 47d226f83a42626ca637e45c695edf5e4d6ecf3f..48bbdd8d1b33fef92b63f203087edecafeb9beaf 100644 (file)
@@ -2530,7 +2530,7 @@ bool RewriteStatepointsForGC::runOnFunction(Function &F, DominatorTree &DT,
   // statepoints surviving this pass.  This makes testing easier and the
   // resulting IR less confusing to human readers.
   DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
-  bool MadeChange = removeUnreachableBlocks(F, nullptr, &DTU);
+  bool MadeChange = removeUnreachableBlocks(F, &DTU);
   // Flush the Dominator Tree.
   DTU.getDomTree();
 
index eabf4bfa422dad3532d96b737076e46e57f8ba1f..3a6b7a6a6555739e339b6ecfae40b40656fbbdcc 100644 (file)
@@ -2210,10 +2210,8 @@ void llvm::removeUnwindEdge(BasicBlock *BB, DomTreeUpdater *DTU) {
 
 /// removeUnreachableBlocks - Remove blocks that are not reachable, even
 /// if they are in a dead cycle.  Return true if a change was made, false
-/// otherwise. If `LVI` is passed, this function preserves LazyValueInfo
-/// after modifying the CFG.
-bool llvm::removeUnreachableBlocks(Function &F, LazyValueInfo *LVI,
-                                   DomTreeUpdater *DTU,
+/// otherwise.
+bool llvm::removeUnreachableBlocks(Function &F, DomTreeUpdater *DTU,
                                    MemorySSAUpdater *MSSAU) {
   SmallPtrSet<BasicBlock *, 16> Reachable;
   bool Changed = markAliveBlocks(F, Reachable, DTU);
@@ -2237,7 +2235,7 @@ bool llvm::removeUnreachableBlocks(Function &F, LazyValueInfo *LVI,
     MSSAU->removeBlocks(DeadBlockSet);
 
   // Loop over all of the basic blocks that are not reachable, dropping all of
-  // their internal references. Update DTU and LVI if available.
+  // their internal references. Update DTU if available.
   std::vector<DominatorTree::UpdateType> Updates;
   for (auto *BB : DeadBlockSet) {
     for (BasicBlock *Successor : successors(BB)) {
@@ -2246,8 +2244,6 @@ bool llvm::removeUnreachableBlocks(Function &F, LazyValueInfo *LVI,
       if (DTU)
         Updates.push_back({DominatorTree::Delete, BB, Successor});
     }
-    if (LVI)
-      LVI->eraseBlock(BB);
     BB->dropAllReferences();
     if (DTU) {
       // Remove the terminator of BB to clear the successor list of BB.
index 55f04e98d77dc164a08d5baf1de205bc127556ae..ff2eda1cec0344dadbdec9adff4f4008d5e93a74 100644 (file)
@@ -872,7 +872,7 @@ TEST(Local, RemoveUnreachableBlocks) {
   auto runEager = [&](Function &F, DominatorTree *DT) {
     PostDominatorTree PDT = PostDominatorTree(F);
     DomTreeUpdater DTU(*DT, PDT, DomTreeUpdater::UpdateStrategy::Eager);
-    removeUnreachableBlocks(F, nullptr, &DTU);
+    removeUnreachableBlocks(F, &DTU);
     EXPECT_TRUE(DTU.getDomTree().verify());
     EXPECT_TRUE(DTU.getPostDomTree().verify());
   };
@@ -880,7 +880,7 @@ TEST(Local, RemoveUnreachableBlocks) {
   auto runLazy = [&](Function &F, DominatorTree *DT) {
     PostDominatorTree PDT = PostDominatorTree(F);
     DomTreeUpdater DTU(*DT, PDT, DomTreeUpdater::UpdateStrategy::Lazy);
-    removeUnreachableBlocks(F, nullptr, &DTU);
+    removeUnreachableBlocks(F, &DTU);
     EXPECT_TRUE(DTU.getDomTree().verify());
     EXPECT_TRUE(DTU.getPostDomTree().verify());
   };
@@ -909,8 +909,8 @@ TEST(Local, RemoveUnreachableBlocks) {
 
   auto checkRUBlocksRetVal = [&](Function &F, DominatorTree *DT) {
     DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
-    EXPECT_TRUE(removeUnreachableBlocks(F, nullptr, &DTU));
-    EXPECT_FALSE(removeUnreachableBlocks(F, nullptr, &DTU));
+    EXPECT_TRUE(removeUnreachableBlocks(F, &DTU));
+    EXPECT_FALSE(removeUnreachableBlocks(F, &DTU));
     EXPECT_TRUE(DTU.getDomTree().verify());
   };