[llvm] r271948 - Verifier: Remove dead code.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 15:32:53 PDT 2016


Author: pcc
Date: Mon Jun  6 17:32:52 2016
New Revision: 271948

URL: http://llvm.org/viewvc/llvm-project?rev=271948&view=rev
Log:
Verifier: Remove dead code.

Remove previously unreachable code that verifies that a function definition has
an entry block. By definition, a function definition has at least one block.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=271948&r1=271947&r2=271948&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Mon Jun  6 17:32:52 2016
@@ -276,13 +276,14 @@ public:
     Context = &M->getContext();
 
     // First ensure the function is well-enough formed to compute dominance
-    // information.
-    if (F.empty()) {
-      if (OS)
-        *OS << "Function '" << F.getName()
-            << "' does not contain an entry block!\n";
-      return false;
-    }
+    // information, and directly compute a dominance tree. We don't rely on the
+    // pass manager to provide this as it isolates us from a potentially
+    // out-of-date dominator tree and makes it significantly more complex to run
+    // this code outside of a pass manager.
+    // FIXME: It's really gross that we have to cast away constness here.
+    if (!F.empty())
+      DT.recalculate(const_cast<Function &>(F));
+
     for (const BasicBlock &BB : F) {
       if (!BB.empty() && BB.back().isTerminator())
         continue;
@@ -296,13 +297,6 @@ public:
       return false;
     }
 
-    // Now directly compute a dominance tree. We don't rely on the pass
-    // manager to provide this as it isolates us from a potentially
-    // out-of-date dominator tree and makes it significantly more complex to
-    // run this code outside of a pass manager.
-    // FIXME: It's really gross that we have to cast away constness here.
-    DT.recalculate(const_cast<Function &>(F));
-
     Broken = false;
     // FIXME: We strip const here because the inst visitor strips const.
     visit(const_cast<Function &>(F));




More information about the llvm-commits mailing list