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
This commit is contained in:
Manman Ren 2013-11-17 18:48:57 +00:00
parent 2b31b8227f
commit 9564d643d7

View File

@ -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();