From 71bb79430faf46e41baa55ab40d467af2b742d6b Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Mon, 6 Jun 2016 22:32:52 +0000 Subject: [PATCH] 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. llvm-svn: 271948 --- llvm/lib/IR/Verifier.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index f7807d1e1b0a..82dadb472102 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -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(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(F)); - Broken = false; // FIXME: We strip const here because the inst visitor strips const. visit(const_cast(F));