Patchwork [google] Fix lipo regression test failures after merge from trunk (issue4806053)

login
register
mail settings
Submitter Xinliang David Li
Date July 26, 2011, 7:48 p.m.
Message ID <20110726194844.2E6FC1B40A9@aples.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/106930/
State New
Headers show

Comments

Xinliang David Li - July 26, 2011, 7:48 p.m.
The patch is committed to google/main to fix lipo test regressions after trunk merge.

2011-07-26  David Li  <davidxl@google.com>

	* value-prof.c (gimple_value_profile_transformations): Remove redundant code.
	* cgraphunit.c (cgraph_mark_functions_to_output): Fix assertion in lipo mode.
	* ipa-inline.c (early_inliner): Check fake edge.
	* l-ipo.c (pop_module_scope): Process alias node.
	(cgraph_unify_type_alias_sets): Skip empty function.
	* testsuite/gcc.dg/tree-prof/lipo/val-prof-2_0.c: update test case


--
This patch is available for review at http://codereview.appspot.com/4806053

Patch

Index: value-prof.c
===================================================================
--- value-prof.c	(revision 176763)
+++ value-prof.c	(working copy)
@@ -613,18 +613,7 @@  gimple_value_profile_transformations (vo
     }
 
   if (changed)
-    {
-      counts_to_freqs ();
-      /* Value profile transformations may change inline parameters
-         a lot (e.g., indirect call promotion introduces new direct calls).
-         The update is also needed to avoid compiler ICE -- when MULTI
-         target icall promotion happens, the caller's size may become
-         negative when the promoted direct calls get promoted.  */
-      /* Guard this for LIPO for now.  */
-      if (L_IPO_COMP_MODE)
-        compute_inline_parameters (cgraph_get_node (current_function_decl),
-				   false);
-    }
+    counts_to_freqs ();
 
   return changed;
 }
Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 176763)
+++ cgraphunit.c	(working copy)
@@ -1531,7 +1531,8 @@  cgraph_mark_functions_to_output (void)
 	  gcc_assert (node->global.inlined_to
 		      || !gimple_has_body_p (decl)
 		      || node->in_other_partition
-		      || DECL_EXTERNAL (decl));
+		      || DECL_EXTERNAL (decl)
+                      || cgraph_is_auxiliary (node->decl));
 
 	}
 
Index: testsuite/gcc.dg/tree-prof/lipo/val-prof-2_0.c
===================================================================
--- testsuite/gcc.dg/tree-prof/lipo/val-prof-2_0.c	(revision 176763)
+++ testsuite/gcc.dg/tree-prof/lipo/val-prof-2_0.c	(working copy)
@@ -26,7 +26,7 @@  main ()
 /* { dg-final-use { scan-ipa-dump "Mod power of 2 transformation on insn" "profile" } } */
 /* This is part of code checking that n is power of 2, so we are sure that the transformation
    didn't get optimized out.  */
-/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 0xffff" "optimized"} } */
+/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ (4294967295|0x0*ffffffff)" "optimized"} } */
 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
 /* { dg-final-use { cleanup-tree-dump "optimized" } } */
 /* { dg-final-use { cleanup-ipa-dump "profile" } } */
Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 176763)
+++ ipa-inline.c	(working copy)
@@ -2008,6 +2008,9 @@  early_inliner (void)
 	  for (edge = node->callees; edge; edge = edge->next_callee)
 	    {
 	      struct inline_edge_summary *es = inline_edge_summary (edge);
+
+	      if (!edge->call_stmt)
+	        continue;
 	      es->call_stmt_size
 		= estimate_num_insns (edge->call_stmt, &eni_size_weights);
 	      es->call_stmt_time
Index: l-ipo.c
===================================================================
--- l-ipo.c	(revision 176763)
+++ l-ipo.c	(working copy)
@@ -390,6 +390,7 @@  pop_module_scope (void)
     primary_module_last_loc = input_location;
 
   at_eof = 1;
+  cgraph_process_same_body_aliases ();
   lang_hooks.l_ipo.process_pending_decls (input_location);
   lang_hooks.l_ipo.clear_deferred_fns ();
   at_eof = 0;
@@ -1067,7 +1068,8 @@  cgraph_unify_type_alias_sets (void)
         {
           push_cfun (DECL_STRUCT_FUNCTION (node->decl));
           current_function_decl = node->decl;
-          cgraph_collect_type_referenced ();
+          if (gimple_has_body_p (current_function_decl))
+            cgraph_collect_type_referenced ();
           current_function_decl = NULL;
           pop_cfun ();
         }