public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [debug-early] reuse old DIE if it was dumped early
@ 2014-09-26 18:17 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2014-09-26 18:17 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

I'm not sure, but somewhere along the last few commits I caused a 
regression that inhibits libgfortran from building.  Serves me right for 
forgetting to rebuild all the target libraries after each patch.

For some instances of subprograms, we do not reuse the prexisting die, 
and we trigger the check I had added here:

   /* If we early created a DIE, make sure it didn't get re-created by
      mistake.  */
   if (early_die && early_die->dumped_early)
     gcc_assert (early_die == die);

Since we already have the dumped_early bit set for subprograms, we can 
just check that and proceed to reuse the previously generated die.

Fixed.  Cleaned some other trivia.  Committed to branch.

No guality regressions for any languages.  All target libraries built.

Aldy

[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 3318 bytes --]

commit 10d7286a26e8a0e29ecbbd0b362ecb8fcc8bfc62
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Fri Sep 26 11:11:27 2014 -0700

    	* dwarf2out.c (gen_subprogram_die): Use old die if it was dumped
    	early.
    	Rearrange some comments.
    	(gen_variable_die): Move initialization of origin_die closer to
    	use.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 339e547..41c4feb 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18308,14 +18308,14 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
 	  && !get_AT (old_die, DW_AT_inline))
 	{
 	  /* Detect and ignore this case, where we are trying to output
-	     something we have already output.
-
-	     If we have no location information, this must be a
-	     partially generated DIE from early dwarf generation.
-	     Fall through and generate it.  */
+	     something we have already output.  */
 	  if (get_AT (old_die, DW_AT_low_pc)
 	      || get_AT (old_die, DW_AT_ranges))
 	  return;
+
+	  /* If we have no location information, this must be a
+	     partially generated DIE from early dwarf generation.
+	     Fall through and generate it.  */
 	}
 
       /* If the definition comes from the same place as the declaration,
@@ -18325,11 +18325,12 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
 	 instances of inlines, since the spec requires the out-of-line copy
 	 to have the same parent.  For local class methods, this doesn't
 	 apply; we just use the old DIE.  */
-      if ((is_cu_die (old_die->die_parent) || context_die == NULL)
-	  && (DECL_ARTIFICIAL (decl)
-	      || (get_AT_file (old_die, DW_AT_decl_file) == file_index
-		  && (get_AT_unsigned (old_die, DW_AT_decl_line)
-		      == (unsigned) s.line))))
+      if (old_die->dumped_early
+	  || ((is_cu_die (old_die->die_parent) || context_die == NULL)
+	      && (DECL_ARTIFICIAL (decl)
+		  || (get_AT_file (old_die, DW_AT_decl_file) == file_index
+		      && (get_AT_unsigned (old_die, DW_AT_decl_line)
+			  == (unsigned) s.line)))))
 	{
 	  subr_die = old_die;
 
@@ -18926,7 +18927,6 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
   tree ultimate_origin;
   dw_die_ref var_die;
   dw_die_ref old_die = decl ? lookup_decl_die (decl) : NULL;
-  dw_die_ref origin_die;
   bool declaration = (DECL_EXTERNAL (decl_or_origin)
 		      || class_or_namespace_scope_p (context_die));
   bool specialization_p = false;
@@ -19050,6 +19050,8 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
   if (old_die && !declaration && !local_scope_p (context_die))
     return;
 
+  dw_die_ref origin_die = NULL;
+
   /* If a DIE was dumped early, it still needs location info.  Skip to
      the part where we fill the location bits.  */
   if (old_die && old_die->dumped_early)
@@ -19057,7 +19059,6 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
       gcc_assert (old_die->die_parent == context_die);
       var_die = old_die;
       old_die = NULL;
-      origin_die = NULL;
       goto gen_variable_die_location;
     }
 
@@ -19069,7 +19070,6 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
   else
     var_die = new_die (DW_TAG_variable, context_die, decl);
 
-  origin_die = NULL;
   if (origin != NULL)
     origin_die = add_abstract_origin_attribute (var_die, origin);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-26 18:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 18:17 [debug-early] reuse old DIE if it was dumped early Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).