summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-11-17 18:48:57 +0000
committerManman Ren <manman.ren@gmail.com>2013-11-17 18:48:57 +0000
commit9564d643d7b5ec2ea4068d7dadae88f285ae928e (patch)
tree386b290477da793e628366eaeb2d4b8f11265562
parent2b31b8227fb5507c26a8c4724574fc87fb90f482 (diff)
downloadllvm-9564d643d7b5ec2ea4068d7dadae88f285ae928e.tar.gz
llvm-9564d643d7b5ec2ea4068d7dadae88f285ae928e.tar.bz2
llvm-9564d643d7b5ec2ea4068d7dadae88f285ae928e.tar.xz
Debug Info Verifier: fix when to find debug info nodes and when to verify them.
We used to collect debug info MDNodes in doInitialization and verify them in doFinalization. That is incorrect since MDNodes can be modified by passes run between doInitialization and doFinalization. To fix the problem, we handle debug info MDNodes that can be reached from a function in runOnFunction (i.e we collect those nodes by calling processDeclare, processValue and processLocation, and then verify them in runOnFunction). We handle debug info MDNodes that can be reached from named metadata in doFinalization. This is in line with how Verifier handles module-level data (they are verified in doFinalization). rdar://15472296 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194974 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/IR/Verifier.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 32acfbd9cc..3331a37def 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -167,11 +167,8 @@ namespace {
bool doInitialization(Module &M) {
Mod = &M;
Context = &M.getContext();
- Finder.reset();
DL = getAnalysisIfAvailable<DataLayout>();
- if (!DisableDebugInfoVerifier)
- Finder.processModule(M);
// We must abort before returning back to the pass manager, or else the
// pass manager may try to run other passes on the broken module.
@@ -185,10 +182,15 @@ namespace {
Mod = F.getParent();
if (!Context) Context = &F.getContext();
+ Finder.reset();
visit(F);
InstsInThisBlock.clear();
PersonalityFn = 0;
+ if (!DisableDebugInfoVerifier)
+ // Verify Debug Info.
+ verifyDebugInfo();
+
// We must abort before returning back to the pass manager, or else the
// pass manager may try to run other passes on the broken module.
return abortIfBroken();
@@ -218,8 +220,12 @@ namespace {
visitModuleFlags(M);
visitModuleIdents(M);
- // Verify Debug Info.
- verifyDebugInfo();
+ if (!DisableDebugInfoVerifier) {
+ Finder.reset();
+ Finder.processModule(M);
+ // Verify Debug Info.
+ verifyDebugInfo();
+ }
// If the module is broken, abort at this time.
return abortIfBroken();