diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5ae2d2a..c27f100 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -936,6 +936,8 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP, if (MI.hasDelaySlot() && !delaySlotSupported(*&MI)) return; + DIType *AllocSiteTy = dyn_cast_or_null<DIType>(MI.getHeapAllocMarker()); + // If this is a direct call, find the callee's subprogram. // In the case of an indirect call find the register that holds // the callee. @@ -950,23 +952,23 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP, PhysRegCalleeOperand = PhysRegCalleeOperand && MCOI.OperandType == MCOI::OPERAND_REGISTER; } - if (!CalleeOp.isGlobal() && !PhysRegCalleeOperand) - continue; unsigned CallReg = 0; const DISubprogram *CalleeSP = nullptr; const Function *CalleeDecl = nullptr; if (PhysRegCalleeOperand) { - CallReg = CalleeOp.getReg(); - if (!CallReg) - continue; - } else { + CallReg = CalleeOp.getReg(); // might be zero + } else if (CalleeOp.isGlobal()) { CalleeDecl = dyn_cast<Function>(CalleeOp.getGlobal()); - if (!CalleeDecl || !CalleeDecl->getSubprogram()) - continue; - CalleeSP = CalleeDecl->getSubprogram(); + if (CalleeDecl) + CalleeSP = CalleeDecl->getSubprogram(); // might be nullptr } + // Omit DIE if we can't tell where the call goes *and* we don't want to + // add metadata to it. + if (CalleeSP == nullptr && CallReg == 0 && AllocSiteTy == nullptr) + continue; + // TODO: Omit call site entries for runtime calls (objc_msgSend, etc). bool IsTail = TII->isTailCall(MI); @@ -1000,7 +1002,7 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP, << (IsTail ? " [IsTail]" : "") << "\n"); DIE &CallSiteDIE = CU.constructCallSiteEntryDIE( - ScopeDIE, CalleeSP, IsTail, PCAddr, CallAddr, CallReg); + ScopeDIE, CalleeSP, IsTail, PCAddr, CallAddr, CallReg, AllocSiteTy); // Optionally emit call-site-param debug info. if (emitDebugEntryValues()) { |