diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 65d30717752a..648d3eefc2a3 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -504,7 +504,8 @@ static void printExtendedName(raw_ostream &OS, const DINode *Node, if (!Res.empty()) OS << Res << "," << Line; - if (auto *InlinedAt = DL->getInlinedAt()) { + auto *InlinedAt = DL ? DL->getInlinedAt() : nullptr; + if (InlinedAt) { if (DebugLoc InlinedAtDL = InlinedAt) { OS << " @["; printDebugLoc(InlinedAtDL, OS, Ctx);