diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2016-06-06 22:32:52 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-06-06 22:32:52 +0000 |
commit | 71bb79430faf46e41baa55ab40d467af2b742d6b (patch) | |
tree | d42e74b9c25b26fb3bfdebd70cf8b565f6c49667 /llvm/lib/IR/Verifier.cpp | |
parent | d7caf5889b8db831a8f195f84c133d3bf4997d73 (diff) | |
download | llvm-71bb79430faf46e41baa55ab40d467af2b742d6b.zip llvm-71bb79430faf46e41baa55ab40d467af2b742d6b.tar.gz llvm-71bb79430faf46e41baa55ab40d467af2b742d6b.tar.bz2 |
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
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index f7807d1..82dadb4 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<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)); |