This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix ordering issue when removing varpool nodes

this is second part of fix for PR ipa/61548. Before removing an variable, it is better
to remove all its aliases so the constructors can be properly propagated.

Bootstrapped/regtested x86_64-linux.


	PR ipa/61548
	* ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering issue
	when removing varpool nodes.
Index: ipa.c
--- ipa.c	(revision 220417)
+++ ipa.c	(working copy)
@@ -597,8 +597,20 @@ symbol_table::remove_unreachable_nodes (
 	     or not.  */
 	  && (!flag_ltrans || !DECL_EXTERNAL (vnode->decl)))
+	  struct ipa_ref *ref = NULL;
+	  /* First remove the aliases, so varpool::remove can possibly lookup
+	     the constructor and save it for future use.  */
+	  while (vnode->iterate_direct_aliases (0, ref))
+	    {
+	      if (file)
+		fprintf (file, " %s/%i", ref->referred->name (),
+			 ref->referred->order);
+	      ref->referring->remove ();
+	    }
 	  if (file)
 	    fprintf (file, " %s/%i", vnode->name (), vnode->order);
+          vnext = next_variable (vnode);
 	  vnode->remove ();
 	  changed = true;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]