Revert "[LoopSimplifyCFG] Delete dead in-loop blocks"

This reverts commit r348457.
The original commit causes clang to crash when doing an instrumented
build with a new pass manager. Reverting to unbreak our integrate.

llvm-svn: 348484
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
index 9d5b33e..3de701e 100644
--- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -46,8 +46,6 @@
 
 STATISTIC(NumTerminatorsFolded,
           "Number of terminators folded to unconditional branches");
-STATISTIC(NumLoopBlocksDeleted,
-          "Number of loop blocks deleted");
 
 /// If \p BB is a switch or a conditional branch, but only one of its successors
 /// can be reached from this block in runtime, return this successor. Otherwise,
@@ -236,27 +234,6 @@
            "All blocks that stay in loop should be live!");
   }
 
-  /// Delete loop blocks that have become unreachable after folding. Make all
-  /// relevant updates to DT and LI.
-  void deleteDeadLoopBlocks() {
-    DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);
-    if (MSSAU)
-      MSSAU->removeBlocks(DeadLoopBlocks);
-    for (auto *BB : DeadLoopBlocks) {
-      assert(BB != L.getHeader() &&
-             "Header of the current loop cannot be dead!");
-      LLVM_DEBUG(dbgs() << "Deleting dead loop block " << BB->getName()
-                        << "\n");
-      if (LI.isLoopHeader(BB)) {
-        assert(LI.getLoopFor(BB) != &L && "Attempt to remove current loop!");
-        LI.erase(LI.getLoopFor(BB));
-      }
-      LI.removeBlock(BB);
-      DeleteDeadBlock(BB, &DTU);
-      ++NumLoopBlocksDeleted;
-    }
-  }
-
   /// Constant-fold terminators of blocks acculumated in FoldCandidates into the
   /// unconditional branches.
   void foldTerminators() {
@@ -341,6 +318,15 @@
       return false;
     }
 
+    // TODO: Support deletion of dead loop blocks.
+    if (!DeadLoopBlocks.empty()) {
+      LLVM_DEBUG(dbgs() << "Give up constant terminator folding in loop "
+                        << L.getHeader()->getName()
+                        << ": we don't currently"
+                           " support deletion of dead in-loop blocks.\n");
+      return false;
+    }
+
     // TODO: Support dead loop exits.
     if (!DeadExitBlocks.empty()) {
       LLVM_DEBUG(dbgs() << "Give up constant terminator folding in loop "
@@ -351,8 +337,7 @@
 
     // TODO: Support blocks that are not dead, but also not in loop after the
     // folding.
-    if (BlocksInLoopAfterFolding.size() + DeadLoopBlocks.size() !=
-        L.getNumBlocks()) {
+    if (BlocksInLoopAfterFolding.size() != L.getNumBlocks()) {
       LLVM_DEBUG(
           dbgs() << "Give up constant terminator folding in loop "
                  << L.getHeader()->getName()
@@ -372,13 +357,6 @@
     // Make the actual transforms.
     foldTerminators();
 
-    if (!DeadLoopBlocks.empty()) {
-      LLVM_DEBUG(dbgs() << "Deleting " << DeadLoopBlocks.size()
-                    << " dead blocks in loop " << L.getHeader()->getName()
-                    << "\n");
-      deleteDeadLoopBlocks();
-    }
-
 #ifndef NDEBUG
     // Make sure that we have preserved all data structures after the transform.
     DT.verify();