Add DISubprogram is not null check.

This fixes test/CodeGen//2009-01-21-invalid-debug-info.m test case.

llvm-svn: 69210
This commit is contained in:
Devang Patel 2009-04-15 20:11:08 +00:00
parent 8aa28b9c34
commit 2738d7312a
1 changed files with 4 additions and 2 deletions

View File

@ -357,11 +357,13 @@ bool FastISel::SelectCall(User *I) {
if (DW && DW->ValidDebugInfo(REI->getContext(), true)) {
unsigned ID = 0;
DISubprogram Subprogram(cast<GlobalVariable>(REI->getContext()));
if (!Subprogram.describes(MF.getFunction())) {
if (!Subprogram.isNull() && !Subprogram.describes(MF.getFunction())) {
// This is end of an inlined function.
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
ID = DW->RecordInlinedFnEnd(Subprogram);
BuildMI(MBB, DL, II).addImm(ID);
if (ID)
// If ID is 0 then this was not an end of inlined region.
BuildMI(MBB, DL, II).addImm(ID);
} else {
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
ID = DW->RecordRegionEnd(cast<GlobalVariable>(REI->getContext()));