[incremental] Patch: FYI: 2 cgraph tweaks

Tom Tromey tromey@redhat.com
Wed Oct 10 22:28:00 GMT 2007


I'm checking this in on the incremental-compiler branch.

My change to cgraphbuild.c the other day was ill-advised.  We need to
look at the canonical decl in record_reference to handle the case of
an initializer referring to a non-canonical function decl.

Also, an assertion in cgraph_note_duplicate could incorrectly trigger
when -fno-unit-at-a-time.

This still doesn't bootstrap but gets much further.

Tom

ChangeLog:
2007-10-10  Tom Tromey  <tromey@redhat.com>

	* cgraph.c (cgraph_note_duplicate): Refine assertion.
	* cgraphbuild.c (record_reference): Use cgraph_canonical_decl.

Index: cgraphbuild.c
===================================================================
--- cgraphbuild.c	(revision 129141)
+++ cgraphbuild.c	(working copy)
@@ -59,7 +59,7 @@
 	     functions reachable unconditionally.  */
 	  tree decl = TREE_OPERAND (*tp, 0);
 	  if (TREE_CODE (decl) == FUNCTION_DECL)
-	    cgraph_mark_needed_node (cgraph_node (decl));
+	    cgraph_mark_needed_node (cgraph_node (cgraph_canonical_decl (decl)));
 	}
       break;
 
Index: cgraph.c
===================================================================
--- cgraph.c	(revision 129141)
+++ cgraph.c	(working copy)
@@ -278,7 +278,9 @@
 	  /* We already saw a definition of the function, so reverse
 	     the duplication.  */
 	  tree tem;
-	  gcc_assert (DECL_INITIAL (decl));
+	  /* If unit-at-a-time, we should only see definitions here.
+	     If no-unit-at-a-time, we might see a declaration.  */
+	  gcc_assert (!flag_unit_at_a_time || DECL_INITIAL (decl));
 	  tem = duplicate;
 	  duplicate = decl;
 	  decl = tem;



More information about the Gcc-patches mailing list