[llvm-commits] [dragonegg] r104036 - in /dragonegg/trunk: llvm-convert.cpp llvm-debug.cpp

Duncan Sands baldrick at free.fr
Tue May 18 10:36:06 PDT 2010


Author: baldrick
Date: Tue May 18 12:36:06 2010
New Revision: 104036

URL: http://llvm.org/viewvc/llvm-project?rev=104036&view=rev
Log:
Port commit 101302 (dpatel) from llvm-gcc:
Enable local variable debug info at -O1+. Take2.

The additional mucking around in llvm-convert.cpp is explained
in the comment there.  The fact that phi node population probably
needs to happen after the return value is computed is what is
stopping the simple solution of moving phi node population earlier.

Modified:
    dragonegg/trunk/llvm-convert.cpp
    dragonegg/trunk/llvm-debug.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=104036&r1=104035&r2=104036&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue May 18 12:36:06 2010
@@ -954,10 +954,6 @@
       }
     }
   }
-  if (EmitDebugInfo()) {
-    TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
-    TheDebugInfo->EmitFunctionEnd(Builder.GetInsertBlock(), true);
-  }
   if (RetVals.empty())
     Builder.CreateRetVoid();
   else if (RetVals.size() == 1 && RetVals[0]->getType() == Fn->getReturnType()){
@@ -976,6 +972,16 @@
   EmitFailureBlocks();
   EmitRewindBlock();
 
+  if (EmitDebugInfo()) {
+    // FIXME: This should be output just before the return call generated above.
+    // But because EmitFunctionEnd pops the region stack, that means that if the
+    // call to PopulatePhiNodes (for example) generates complicated debug info,
+    // then the debug info logic barfs.  Testcases showing this are 20011126-2.c
+    // or pr42221.c from the gcc testsuite compiled with -g -O3.
+    TheDebugInfo->EmitStopPoint(Fn, ReturnBB, Builder);
+    TheDebugInfo->EmitFunctionEnd(ReturnBB, true);
+  }
+
 #ifndef NDEBUG
   if (!errorcount && !sorrycount)
     for (DenseMap<tree, TrackingVH<Value> >::const_iterator I = SSANames.begin(),

Modified: dragonegg/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=104036&r1=104035&r2=104036&view=diff
==============================================================================
--- dragonegg/trunk/llvm-debug.cpp (original)
+++ dragonegg/trunk/llvm-debug.cpp Tue May 18 12:36:06 2010
@@ -389,10 +389,6 @@
 void DebugInfo::EmitDeclare(tree decl, unsigned Tag, const char *Name,
                             tree type, Value *AI, LLVMBuilder &Builder) {
 
-  // Do not emit variable declaration info, for now.
-  if (optimize)
-    return;
-
   // Ignore compiler generated temporaries.
   if (DECL_IGNORED_P(decl))
     return;





More information about the llvm-commits mailing list