[llvm-commits] [llvm-gcc-4.2] r106244 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Stuart Hastings stuart at apple.com
Thu Jun 17 15:43:58 PDT 2010


Author: stuart
Date: Thu Jun 17 17:43:58 2010
New Revision: 106244

URL: http://llvm.org/viewvc/llvm-project?rev=106244&view=rev
Log:
Add a stop point to empty basic blocks.  Radar 7421831.

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

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=106244&r1=106243&r2=106244&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jun 17 17:43:58 2010
@@ -812,11 +812,12 @@
   basic_block bb;
   edge e;
   edge_iterator ei;
+  tree stmt = NULL_TREE;
   FOR_EACH_BB (bb) {
     for (block_stmt_iterator bsi = bsi_start (bb); !bsi_end_p (bsi);
          bsi_next (&bsi)) {
       MemRef DestLoc;
-      tree stmt = bsi_stmt (bsi);
+      stmt = bsi_stmt (bsi);
 
       // If this stmt returns an aggregate value (e.g. a call whose result is
       // ignored), create a temporary to receive the value.  Note that we don't
@@ -828,6 +829,21 @@
       Emit(stmt, DestLoc.Ptr ? &DestLoc : NULL);
     }
 
+    // If we didn't see any statements, the current bb is an empty
+    // basic block.  But an empty block must have one outgoing edge,
+    // and there might be some location info there; grab it.
+    if (!stmt && EmitDebugInfo()) {
+      assert(EDGE_COUNT(b->succs) == 1 && "empty basic block with multiple successors?") ;
+      e = EDGE_I(bb->succs, 0);
+      source_locus locus = e->goto_locus;
+      if (locus) {
+        // Set new location on the way up the tree.
+        TheDebugInfo->setLocationFile(LOCATION_FILE(*locus));
+        TheDebugInfo->setLocationLine(LOCATION_LINE(*locus));
+      }
+      TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
+    }
+
     FOR_EACH_EDGE (e, ei, bb->succs)
       if (e->flags & EDGE_FALLTHRU)
         break;





More information about the llvm-commits mailing list