[llvm-commits] [llvm] r69300 - in /llvm/trunk/lib/CodeGen/SelectionDAG: FastISel.cpp SelectionDAGBuild.cpp

Devang Patel dpatel at apple.com
Thu Apr 16 10:55:30 PDT 2009


Author: dpatel
Date: Thu Apr 16 12:55:30 2009
New Revision: 69300

URL: http://llvm.org/viewvc/llvm-project?rev=69300&view=rev
Log:
Do not treat beginning of inlined scope as beginning of normal function scope if the location info is missing.

Insetad of doing ...
if (inlined_subroutine && known_location)
  DW_TAG_inline_subroutine
else
  DW_TAG_subprogram

do

if (inlined_subroutine) {
 if (known_location)
   DW_TAG_inline_subroutine
} else {
 DW_TAG_subprogram
}


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

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

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Apr 16 12:55:30 2009
@@ -362,7 +362,10 @@
         const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
         ID = DW->RecordInlinedFnEnd(Subprogram);
         if (ID)
-          // If ID is 0 then this was not an end of inlined region.
+          // Returned ID is 0 if this is unbalanced "end of inlined
+          // scope". This could happen if optimizer eats dbg intrinsics
+          // or "beginning of inlined scope" is not recoginized due to
+          // missing location info. In such cases, do ignore this region.end.
           BuildMI(MBB, DL, II).addImm(ID);
       } else {
         const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
@@ -387,9 +390,14 @@
       unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
                                                  CompileUnit.getFilename(FN));
 
-      if (!Subprogram.describes(MF.getFunction()) && !PrevLoc.isUnknown()) {
+      if (!Subprogram.describes(MF.getFunction())) {
         // This is a beginning of an inlined function.
         
+        // If llvm.dbg.func.start is seen in a new block before any
+        // llvm.dbg.stoppoint intrinsic then the location info is unknown.
+        // FIXME : Why DebugLoc is reset at the beginning of each block ?
+        if (PrevLoc.isUnknown())
+          return true;
         // Record the source line.
         unsigned Line = Subprogram.getLineNumber();
         unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);

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

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Thu Apr 16 12:55:30 2009
@@ -3966,6 +3966,10 @@
         if (Fast) {
           unsigned ID = DW->RecordInlinedFnEnd(Subprogram);
           if (ID != 0)
+            // Returned ID is 0 if this is unbalanced "end of inlined
+            // scope". This could happen if optimizer eats dbg intrinsics
+            // or "beginning of inlined scope" is not recoginized due to
+            // missing location info. In such cases, do ignore this region.end.
             DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), 
                                      getRoot(), ID));
         }
@@ -4000,6 +4004,12 @@
         if (!Subprogram.describes(MF.getFunction())) {
           // This is a beginning of an inlined function.
 
+          // If llvm.dbg.func.start is seen in a new block before any
+          // llvm.dbg.stoppoint intrinsic then the location info is unknown.
+          // FIXME : Why DebugLoc is reset at the beginning of each block ?
+          if (PrevLoc.isUnknown())
+            return 0;
+
           // Record the source line.
           unsigned Line = Subprogram.getLineNumber();
           unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);





More information about the llvm-commits mailing list