From 384fa91deb11e7bd153fb4228ff11b1f788cbaf9 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 26 Aug 2010 20:06:46 +0000 Subject: Update DanglingDebugInfo so that it can be used to track llvm.dbg.declare also. llvm-svn: 112213 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 15ad23de979..a1ff8adc462 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -875,12 +875,23 @@ void SelectionDAGBuilder::visit(unsigned Opcode, const User &I) { void SelectionDAGBuilder::resolveDanglingDebugInfo(const Value *V, SDValue Val) { DanglingDebugInfo &DDI = DanglingDebugInfoMap[V]; - if (DDI.getDI()) { - const DbgValueInst *DI = DDI.getDI(); + MDNode *Variable = NULL; + uint64_t Offset = 0; + + if (const DbgValueInst *DI = dyn_cast_or_null(DDI.getDI())) { + Variable = DI->getVariable(); + Offset = DI->getOffset(); + } else if (const DbgDeclareInst *DI = + dyn_cast_or_null(DDI.getDI())) + Variable = DI->getVariable(); + else { + assert (DDI.getDI() == NULL && "Invalid debug info intrinsic!"); + return; + } + + if (Variable) { DebugLoc dl = DDI.getdl(); unsigned DbgSDNodeOrder = DDI.getSDNodeOrder(); - MDNode *Variable = DI->getVariable(); - uint64_t Offset = DI->getOffset(); SDDbgValue *SDV; if (Val.getNode()) { if (!EmitFuncArgumentDbgValue(V, Variable, Offset, Val)) { -- cgit v1.2.3