Author: dpatel
Date: Fri Jun  3 14:21:47 2011
New Revision: 132576

URL: http://llvm.org/viewvc/llvm-project?rev=132576&view=rev
Log:
Emit debug info only if there is an insertion point. The debug info should not 
force an insertion point. Codegen may later on decide to not emit code for some 
reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info 
should not get in the way.

Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CGStmt.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=132576&r1=132575&r2=132576&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Fri Jun  3 14:21:47 2011
@@ -629,15 +629,16 @@
   emission.Address = DeclPtr;
 
   // Emit debug info for local var declaration.
-  if (CGDebugInfo *DI = getDebugInfo()) {
-    assert(HaveInsertPoint() && "Unexpected unreachable point!");
-
-    DI->setLocation(D.getLocation());
-    if (Target.useGlobalsForAutomaticVariables()) {
-      DI->EmitGlobalVariable(static_cast<llvm::GlobalVariable *>(DeclPtr), &D);
-    } else
-      DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
-  }
+  if (HaveInsertPoint())
+    if (CGDebugInfo *DI = getDebugInfo()) {
+      DI->setLocation(D.getLocation());
+      DI->UpdateLineDirectiveRegion(Builder);
+      DI->EmitStopPoint(Builder);
+      if (Target.useGlobalsForAutomaticVariables()) {
+        DI->EmitGlobalVariable(static_cast<llvm::GlobalVariable *>(DeclPtr), 
&D);
+      } else
+        DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
+    }
 
   return emission;
 }

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=132576&r1=132575&r2=132576&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri Jun  3 14:21:47 2011
@@ -771,13 +771,6 @@
 }
 
 void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
-  // As long as debug info is modeled with instructions, we have to ensure we
-  // have a place to insert here and write the stop point here.
-  if (getDebugInfo()) {
-    EnsureInsertPoint();
-    EmitStopPoint(&S);
-  }
-
   for (DeclStmt::const_decl_iterator I = S.decl_begin(), E = S.decl_end();
        I != E; ++I)
     EmitDecl(**I);


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to