[llvm-commits] [llvm] r69210 - /llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Devang Patel dpatel at apple.com
Wed Apr 15 13:11:09 PDT 2009


Author: dpatel
Date: Wed Apr 15 15:11:08 2009
New Revision: 69210

URL: http://llvm.org/viewvc/llvm-project?rev=69210&view=rev
Log:
Add DISubprogram is not null check.
This fixes test/CodeGen//2009-01-21-invalid-debug-info.m test case.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=69210&r1=69209&r2=69210&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Wed Apr 15 15:11:08 2009
@@ -357,11 +357,13 @@
     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()));





More information about the llvm-commits mailing list