[llvm-commits] [llvm-gcc-4.2] r68152 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-debug.cpp llvm-debug.h

Dale Johannesen dalej at apple.com
Tue Mar 31 15:22:14 PDT 2009


Author: johannes
Date: Tue Mar 31 17:22:13 2009
New Revision: 68152

URL: http://llvm.org/viewvc/llvm-project?rev=68152&view=rev
Log:
Fix nondeterminism in whether line numbers got
generated near the beginning of a function.  Now
they do, an improvement.  This allows checking
in 67884 finally:

Enable debug info at -O.  I've fixed a lot of
bugs where -g affects optimization recently; there
are currently no such cases in the llvm testsuite or
a substantial amount of other code on Darwin, which
seems sufficient to turn it on.  Woot.  I make
no claims about the quality of the generated debug
info.

Any cases where you see -g affecting optimization can
now usefully be reported as bugs.  TEST=ipodbgopt should
test this in the llvm testsuite.


Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.h

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=68152&r1=68151&r2=68152&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Mar 31 17:22:13 2009
@@ -668,7 +668,7 @@
   }
   if (TheDebugInfo) {
     TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock());
-    TheDebugInfo->EmitRegionEnd(Builder.GetInsertBlock());
+    TheDebugInfo->EmitRegionEnd(Builder.GetInsertBlock(), true);
   }
   if (RetVals.empty())
     Builder.CreateRetVoid();

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=68152&r1=68151&r2=68152&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Tue Mar 31 17:22:13 2009
@@ -273,10 +273,17 @@
 
 /// EmitRegionEnd - Constructs the debug code for exiting a declarative
 /// region - "llvm.dbg.region.end."
-void DebugInfo::EmitRegionEnd(BasicBlock *CurBB) {
+void DebugInfo::EmitRegionEnd(BasicBlock *CurBB, bool EndFunction) {
   assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
   DebugFactory.InsertRegionEnd(RegionStack.back(), CurBB);
   RegionStack.pop_back();
+  // Blocks get erased; clearing these is needed for determinism, and also
+  // a good idea if the next function gets inlined.
+  if (EndFunction) {
+    PrevBB = NULL;
+    PrevLineNo = 0;
+    PrevFullPath = NULL;
+  }
 }
 
 /// EmitDeclare - Constructs the debug code for allocation of a new variable.
@@ -310,10 +317,6 @@
 /// source line - "llvm.dbg.stoppoint."
 void DebugInfo::EmitStopPoint(Function *Fn, BasicBlock *CurBB) {
 
-  // Do not emit line number info, for now.
-  if (optimize)
-    return;
-
   // Don't bother if things are the same as last time.
   if (PrevLineNo == CurLineNo &&
       PrevBB == CurBB &&

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=68152&r1=68151&r2=68152&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Tue Mar 31 17:22:13 2009
@@ -89,7 +89,7 @@
 
   /// EmitRegionEnd - Constructs the debug code for exiting a declarative
   /// region - "llvm.dbg.region.end."
-  void EmitRegionEnd(BasicBlock *CurBB);
+  void EmitRegionEnd(BasicBlock *CurBB, bool EndFunction);
 
   /// EmitDeclare - Constructs the debug code for allocation of a new variable.
   /// region - "llvm.dbg.declare."





More information about the llvm-commits mailing list