diff mbox

Fix gomp failures introduced by my prevoius patch

Message ID 20101026223537.GD11809@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Oct. 26, 2010, 10:35 p.m. UTC
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.
diff mbox

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))