DebugInfo: Assert dbg.declare/value insts are valid

Remove early returns for when `getVariable()` is null, and just assert
that it never happens.  The Verifier already confirms that there's a
valid variable on these intrinsics, so we should assume the debug info
isn't broken.  I also updated a check for a `!dbg` attachment, which the
Verifier similarly guarantees.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-21 18:24:23 +00:00
parent 405cc64eac
commit 43eab6bce0
4 changed files with 11 additions and 15 deletions

View File

@ -1000,8 +1000,7 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
StoreInst *SI, DIBuilder &Builder) {
DIVariable DIVar = DDI->getVariable();
DIExpression DIExpr = DDI->getExpression();
if (!DIVar)
return false;
assert(DIVar && "Missing variable");
if (LdStHasDebugValue(DIVar, SI))
return true;
@ -1028,8 +1027,7 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
LoadInst *LI, DIBuilder &Builder) {
DIVariable DIVar = DDI->getVariable();
DIExpression DIExpr = DDI->getExpression();
if (!DIVar)
return false;
assert(DIVar && "Missing variable");
if (LdStHasDebugValue(DIVar, LI))
return true;
@ -1107,8 +1105,7 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
DebugLoc Loc = DDI->getDebugLoc();
DIVariable DIVar = DDI->getVariable();
DIExpression DIExpr = DDI->getExpression();
if (!DIVar)
return false;
assert(DIVar && "Missing variable");
if (Deref) {
// Create a copy of the original DIDescriptor for user variable, prepending