summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-30 22:37:51 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-30 22:37:51 +0000
commit415b33f161537be38be213cb7cb89314173f6549 (patch)
treed847fc74e6ebf228ba828b082d4610b3ed5936f9 /lib/IR
parent2cc546db188d5e4d4537681cab3d52781125518c (diff)
downloadllvm-415b33f161537be38be213cb7cb89314173f6549.tar.gz
llvm-415b33f161537be38be213cb7cb89314173f6549.tar.bz2
llvm-415b33f161537be38be213cb7cb89314173f6549.tar.xz
Add calls to doInitialization() and doFinalization() in verifyFunction()
The function verifyFunction() in lib/IR/Verifier.cpp misses some calls. It creates a temporary FunctionPassManager that will run a single Verifier pass. Unfortunately, FunctionPassManager is no PassManager and does not call doInitialization() and doFinalization() by itself. Verifier does important tasks in doInitialization() such as collecting type information used to check DebugInfo metadata and doFinalization() does some additional checks. Therefore these checks were missed and debug info couldn't be verified at all, it just crashed if the function had some. verifyFunction() is currently not used in llvm unless -debug option is enabled, and in unittests/IR/VerifierTest.cpp VerifierTest had to be changed to create the function in a module from which the type debug info can be collected. Patch by Michael Kruse. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Verifier.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 7d657def32..de2b6727d8 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -2364,7 +2364,9 @@ bool llvm::verifyFunction(const Function &f, VerifierFailureAction action) {
FunctionPassManager FPM(F.getParent());
Verifier *V = new Verifier(action);
FPM.add(V);
+ FPM.doInitialization();
FPM.run(F);
+ FPM.doFinalization();
return V->Broken;
}