summaryrefslogtreecommitdiff
path: root/tools/opt/opt.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-04-15 16:27:38 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-04-15 16:27:38 +0000
commit32791b02facda5b879f2bcf7dd3f1faea1e4782d (patch)
tree1fe8ec4d917295d0a54e8d538006088bb6b781e3 /tools/opt/opt.cpp
parentabf483ba524027caa3c5cd3de452d9feb11170d3 (diff)
downloadllvm-32791b02facda5b879f2bcf7dd3f1faea1e4782d.tar.gz
llvm-32791b02facda5b879f2bcf7dd3f1faea1e4782d.tar.bz2
llvm-32791b02facda5b879f2bcf7dd3f1faea1e4782d.tar.xz
verify-di: Implement DebugInfoVerifier
Implement DebugInfoVerifier, which steals verification relying on DebugInfoFinder from Verifier. - Adds LegacyDebugInfoVerifierPassPass, a ModulePass which wraps DebugInfoVerifier. Uses -verify-di command-line flag. - Change verifyModule() to invoke DebugInfoVerifier as well as Verifier. - Add a call to createDebugInfoVerifierPass() wherever there was a call to createVerifierPass(). This implementation as a module pass should sidestep efficiency issues, allowing us to turn debug info verification back on. <rdar://problem/15500563> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206300 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r--tools/opt/opt.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 5a198816e6..8f958bbd0a 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -191,7 +191,10 @@ static inline void addPass(PassManagerBase &PM, Pass *P) {
PM.add(P);
// If we are verifying all of the intermediate steps, add the verifier...
- if (VerifyEach) PM.add(createVerifierPass());
+ if (VerifyEach) {
+ PM.add(createVerifierPass());
+ PM.add(createDebugInfoVerifierPass());
+ }
}
/// AddOptimizationPasses - This routine adds optimization passes
@@ -201,7 +204,8 @@ static inline void addPass(PassManagerBase &PM, Pass *P) {
/// OptLevel - Optimization Level
static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM,
unsigned OptLevel, unsigned SizeLevel) {
- FPM.add(createVerifierPass()); // Verify that input is correct
+ FPM.add(createVerifierPass()); // Verify that input is correct
+ MPM.add(createDebugInfoVerifierPass()); // Verify that debug info is correct
PassManagerBuilder Builder;
Builder.OptLevel = OptLevel;
@@ -240,6 +244,9 @@ static void AddStandardCompilePasses(PassManagerBase &PM) {
if (StripDebug)
addPass(PM, createStripSymbolsPass(true));
+ // Verify debug info only after it's (possibly) stripped.
+ PM.add(createDebugInfoVerifierPass());
+
if (DisableOptimizations) return;
// -std-compile-opts adds the same module passes as -O3.
@@ -257,6 +264,9 @@ static void AddStandardLinkPasses(PassManagerBase &PM) {
if (StripDebug)
addPass(PM, createStripSymbolsPass(true));
+ // Verify debug info only after it's (possibly) stripped.
+ PM.add(createDebugInfoVerifierPass());
+
if (DisableOptimizations) return;
PassManagerBuilder Builder;
@@ -600,8 +610,10 @@ int main(int argc, char **argv) {
}
// Check that the module is well formed on completion of optimization
- if (!NoVerify && !VerifyEach)
+ if (!NoVerify && !VerifyEach) {
Passes.add(createVerifierPass());
+ Passes.add(createDebugInfoVerifierPass());
+ }
// Write bitcode or assembly to the output as the last step...
if (!NoOutput && !AnalyzeOnly) {