Simplify.
authorDevang Patel <dpatel@apple.com>
Thu, 2 Jul 2009 00:28:03 +0000 (00:28 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 2 Jul 2009 00:28:03 +0000 (00:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74677 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/FastISel.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

index 45c7ace78bdb87e8580324cc54bb51d8712b40d9..9437e86f0f73e325024d4ab8b7b8efb56c8d9105 100644 (file)
@@ -376,24 +376,24 @@ bool FastISel::SelectCall(User *I) {
     if (!DIDescriptor::ValidDebugInfo(SP, CodeGenOpt::None))
       return true;
 
-    // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what
-    // (most?) gdb expects.
-    DebugLoc PrevLoc = DL;
     DISubprogram Subprogram(cast<GlobalVariable>(SP));
     DICompileUnit CompileUnit = Subprogram.getCompileUnit();
+    unsigned Line = Subprogram.getLineNumber();
 
+    // If this subprogram does not describe current function then this is
+    // beginning of a inlined function.
     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 ?
+      DebugLoc PrevLoc = DL;
       if (PrevLoc.isUnknown())
         return true;
       // Record the source line.
-      unsigned Line = Subprogram.getLineNumber();
-      setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
-                                              CompileUnit.getGV(), Line, 0)));
+      unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0);
+      setCurDebugLoc(DebugLoc::get(LocID));
 
       if (DW && DW->ShouldEmitDwarfDebug()) {
         DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
@@ -404,17 +404,18 @@ bool FastISel::SelectCall(User *I) {
         const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
         BuildMI(MBB, DL, II).addImm(LabelID);
       }
-    } else {
-      // Record the source line.
-      unsigned Line = Subprogram.getLineNumber();
-      MF.setDefaultDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
-                                              CompileUnit.getGV(), Line, 0)));
-      if (DW && DW->ShouldEmitDwarfDebug()) {
-        // llvm.dbg.func_start also defines beginning of function scope.
-        DW->RecordRegionStart(cast<GlobalVariable>(FSI->getSubprogram()));
-      }
+      return true;
     }
-
+     
+    // This is a beginning of a new function.
+    // Record the source line.
+    unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0);
+    MF.setDefaultDebugLoc(DebugLoc::get(LocID));
+
+    if (DW && DW->ShouldEmitDwarfDebug())
+      // llvm.dbg.func_start also defines beginning of function scope.
+      DW->RecordRegionStart(cast<GlobalVariable>(FSI->getSubprogram()));
+    
     return true;
   }
   case Intrinsic::dbg_declare: {
index a5fe32b8535efc460892d4a236c08992eea20694..d4a330b0125ae2ded3bca36cc00b36b1a7a71910 100644 (file)
@@ -3962,7 +3962,6 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
     MachineFunction &MF = DAG.getMachineFunction();
     // If this subprogram does not describe current function then this is
     // beginning of a inlined function.
-
     bool isInlinedFnStart = !Subprogram.describes(MF.getFunction());
     if (isInlinedFnStart && OptLevel != CodeGenOpt::None)
       // FIXME: Debugging informaation for inlined function is only