diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -1372,7 +1372,16 @@ // This instruction will be skipped, no LineInfo has // been generated, construct one based on function signature. if (LineInfoGenerated == false) { - auto *S = MI->getMF()->getFunction().getSubprogram(); + const Function &F = MI->getMF()->getFunction(); + auto *S = F.getSubprogram(); + if (!S) { + std::string Str; + { + raw_string_ostream OS(Str); + OS << "call to subprogram '" << F.getName() << "' without line info"; + } + report_fatal_error(Str.c_str()); + } MCSymbol *FuncLabel = Asm->getFunctionBegin(); constructLineInfo(S->getFile(), FuncLabel, S->getLine(), 0); LineInfoGenerated = true;