for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/44248
	* lto-streamer-in.c (input_bb): Leave debug stmts alone.
	(input_function): Drop them here, if VTA is disabled.
	
Index: gcc/lto-streamer-in.c
===================================================================
--- gcc/lto-streamer-in.c.orig	2010-06-14 23:22:09.000000000 -0300
+++ gcc/lto-streamer-in.c	2010-06-14 23:46:42.000000000 -0300
@@ -1204,13 +1204,6 @@ input_bb (struct lto_input_block *ib, en
     {
       gimple stmt = input_gimple_stmt (ib, data_in, fn, tag);
 
-      /* Change debug stmts to nops on-the-fly if we do not have VTA enabled.
-	 This allows us to build for example static libs with debugging
-	 enabled and do the final link without.  */
-      if (!MAY_HAVE_DEBUG_STMTS
-	  && is_gimple_debug (stmt))
-	stmt = gimple_build_nop ();
-
       find_referenced_vars_in (stmt);
       gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
 
@@ -1395,6 +1388,22 @@ input_function (tree fn_decl, struct dat
   free_dominance_info (CDI_DOMINATORS);
   free_dominance_info (CDI_POST_DOMINATORS);
   free (stmts);
+
+  /* Having applied fixups, drop debug stmts if VTA is disabled.  This
+     allows us to build for example static libs with debugging enabled
+     and do the final link without.  */
+  if (!MAY_HAVE_DEBUG_STMTS)
+    FOR_ALL_BB (bb)
+    {
+      gimple_stmt_iterator bsi = gsi_start_bb (bb);
+      while (!gsi_end_p (bsi))
+	{
+	  gimple_stmt_iterator gsi = bsi;
+	  gsi_next (&bsi);
+	  if (is_gimple_debug (gsi_stmt (gsi)))
+	    gsi_remove (&gsi, true);
+	}
+    }
 }
 
 
