diff options
author | Manman Ren <mren@apple.com> | 2013-06-28 05:43:10 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2013-06-28 05:43:10 +0000 |
commit | 983a16c08adbeb89c34e894647d4ae08a0417481 (patch) | |
tree | 064443222a08013d92f082ec72a34db4e400894c /llvm/lib/Transforms | |
parent | 0a00836bb7be52daa291c681d6041300b627bc21 (diff) | |
download | bcm5719-llvm-983a16c08adbeb89c34e894647d4ae08a0417481.tar.gz bcm5719-llvm-983a16c08adbeb89c34e894647d4ae08a0417481.zip |
Debug Info: clean up usage of Verify.
No functionality change.
It should suffice to check the type of a debug info metadata, instead of
calling Verify. For cases where we know the type of a DI metadata, use
assert.
Also update testing cases to make them conform to the format of DI classes.
llvm-svn: 185135
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/StripSymbols.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 12 |
4 files changed, 28 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 70d03178cb7..2e27ae04170 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -211,7 +211,9 @@ void DAE::CollectFunctionDIs(Module &M) { for (unsigned SPIndex = 0, SPNum = SPs.getNumElements(); SPIndex < SPNum; ++SPIndex) { DISubprogram SP(SPs.getElement(SPIndex)); - if (!SP.Verify()) + assert((!SP || SP.isSubprogram()) && + "A MDNode in subprograms of a CU should be null or a DISubprogram."); + if (!SP) continue; if (Function *F = SP.getFunction()) FunctionDIs[F] = SP; diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp index 754eff6a673..ba131eedc12 100644 --- a/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp @@ -344,8 +344,11 @@ bool StripDeadDebugInfo::runOnModule(Module &M) { if (NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv")) { SmallVector<MDNode *, 8> MDs; for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) - if (DIGlobalVariable(NMD->getOperand(i)).Verify()) + if (NMD->getOperand(i)) { + assert(DIGlobalVariable(NMD->getOperand(i)).isGlobalVariable() && + "A MDNode in llvm.dbg.gv should be a DIGlobalVariable."); MDs.push_back(NMD->getOperand(i)); + } else Changed = true; NMD->eraseFromParent(); @@ -368,8 +371,11 @@ bool StripDeadDebugInfo::runOnModule(Module &M) { if (NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.sp")) { SmallVector<MDNode *, 8> MDs; for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) - if (DISubprogram(NMD->getOperand(i)).Verify()) + if (NMD->getOperand(i)) { + assert(DISubprogram(NMD->getOperand(i)).isSubprogram() && + "A MDNode in llvm.dbg.sp should be a DISubprogram."); MDs.push_back(NMD->getOperand(i)); + } else Changed = true; NMD->eraseFromParent(); diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index ef66bf8e11c..06a0f2645e9 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -434,7 +434,10 @@ void GCOVProfiler::emitProfileNotes() { DIArray SPs = CU.getSubprograms(); for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { DISubprogram SP(SPs.getElement(i)); - if (!SP.Verify()) continue; + assert((!SP || SP.isSubprogram()) && + "A MDNode in subprograms of a CU should be null or a DISubprogram."); + if (!SP) + continue; Function *F = SP.getFunction(); if (!F) continue; @@ -483,7 +486,10 @@ bool GCOVProfiler::emitProfileArcs() { SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP; for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) { DISubprogram SP(SPs.getElement(i)); - if (!SP.Verify()) continue; + assert((!SP || SP.isSubprogram()) && + "A MDNode in subprograms of a CU should be null or a DISubprogram."); + if (!SP) + continue; Function *F = SP.getFunction(); if (!F) continue; if (!Result) Result = true; diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 12e5b3e9d2e..f8f00cd1d50 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -854,7 +854,9 @@ static bool LdStHasDebugValue(DIVariable &DIVar, Instruction *I) { bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, StoreInst *SI, DIBuilder &Builder) { DIVariable DIVar(DDI->getVariable()); - if (!DIVar.Verify()) + assert((!DIVar || DIVar.isVariable()) && + "Variable in DbgDeclareInst should be either null or a DIVariable."); + if (!DIVar) return false; if (LdStHasDebugValue(DIVar, SI)) @@ -888,7 +890,9 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, LoadInst *LI, DIBuilder &Builder) { DIVariable DIVar(DDI->getVariable()); - if (!DIVar.Verify()) + assert((!DIVar || DIVar.isVariable()) && + "Variable in DbgDeclareInst should be either null or a DIVariable."); + if (!DIVar) return false; if (LdStHasDebugValue(DIVar, LI)) @@ -961,7 +965,9 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress, if (!DDI) return false; DIVariable DIVar(DDI->getVariable()); - if (!DIVar.Verify()) + assert((!DIVar || DIVar.isVariable()) && + "Variable in DbgDeclareInst should be either null or a DIVariable."); + if (!DIVar) return false; // Create a copy of the original DIDescriptor for user variable, appending |