Patchwork Fix gomp failures introduced by my prevoius patch

login
register
mail settings
Submitter Jan Hubicka
Date Oct. 26, 2010, 10:35 p.m.
Message ID <20101026223537.GD11809@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/69302/
State New
Headers show

Comments

Jan Hubicka - Oct. 26, 2010, 10:35 p.m.
Hi,
I managed to screw patch order and introduce a libgomp failures.  The problem
is that unreachable node removal (that is needed for correctness of LTO symbol
tables) results in cgraph removing decl functions produced by OMP code since we
do not explicitely represent the references for OMP child functions and they live
in callgraph unanalyzed till the lowering.

This patch sort of fixes it by adding reference edges that prevent callgraph from
sweeping away the function body.

Bootstrapping/regtesting x86_64-linux, will commit it once it finish.
My apologizes for the breakage.

Honza

	* cgraphbuild.c (build_cgraph_edges): Handle OMP using references.

Patch

Index: cgraphbuild.c
===================================================================
--- cgraphbuild.c	(revision 165985)
+++ cgraphbuild.c	(working copy)
@@ -361,16 +361,19 @@  build_cgraph_edges (void)
 	      && gimple_omp_parallel_child_fn (stmt))
 	    {
 	      tree fn = gimple_omp_parallel_child_fn (stmt);
-	      cgraph_mark_needed_node (cgraph_node (fn));
+	      ipa_record_reference (node, NULL, cgraph_node (fn),
+				    NULL, IPA_REF_ADDR, stmt);
 	    }
 	  if (gimple_code (stmt) == GIMPLE_OMP_TASK)
 	    {
 	      tree fn = gimple_omp_task_child_fn (stmt);
 	      if (fn)
-		cgraph_mark_needed_node (cgraph_node (fn));
+		ipa_record_reference (node, NULL, cgraph_node (fn),
+				      NULL, IPA_REF_ADDR, stmt);
 	      fn = gimple_omp_task_copy_fn (stmt);
 	      if (fn)
-		cgraph_mark_needed_node (cgraph_node (fn));
+		ipa_record_reference (node, NULL, cgraph_node (fn),
+				      NULL, IPA_REF_ADDR, stmt);
 	    }
 	}
       for (gsi = gsi_start (phi_nodes (bb)); !gsi_end_p (gsi); gsi_next (&gsi))