diff mbox

[google,main] Fix broken test cases in google/main branch (issue4961065)

Message ID 20110907014433.229C9B21A6@azwildcat.mtv.corp.google.com
State New
Headers show

Commit Message

Sriraman Tallam Sept. 7, 2011, 1:44 a.m. UTC
This patches fixes bugs that caused the multi-version tests to fail.

	* mversn-dispatch.c (specialize_call): Rebuild cgraph edges after
	specialization.
	(clone_and_dispatch_function): Rebuild cgraph edges to compute
	inline parameters.
	(do_convert_builtin_dispatch): Ditto.
	(convert_builtin_dispatch): Remove call to mark_syms_for_renaming
	for phi nodes.
	* passes.c (init_optimization_passes): Remove pass to rebuild
	cgraph edges after converting __builtin_dispatch.



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

Comments

Diego Novillo Sept. 7, 2011, 2:14 p.m. UTC | #1
On Tue, Sep 6, 2011 at 21:44, Sriraman Tallam <tmsriram@google.com> wrote:
> This patches fixes bugs that caused the multi-version tests to fail.
>
>        * mversn-dispatch.c (specialize_call): Rebuild cgraph edges after
>        specialization.
>        (clone_and_dispatch_function): Rebuild cgraph edges to compute
>        inline parameters.
>        (do_convert_builtin_dispatch): Ditto.
>        (convert_builtin_dispatch): Remove call to mark_syms_for_renaming
>        for phi nodes.
>        * passes.c (init_optimization_passes): Remove pass to rebuild
>        cgraph edges after converting __builtin_dispatch.

OK, thanks for the fix.


Diego.
diff mbox

Patch

Index: mversn-dispatch.c
===================================================================
--- mversn-dispatch.c	(revision 178618)
+++ mversn-dispatch.c	(working copy)
@@ -1166,6 +1166,10 @@  specialize_call (tree clone_decl, int side)
           gsi = gsi_for_stmt (specialized_call_stmt);
 	}
     }
+
+  /* Rebuild cgraph edges for the clone. */
+  rebuild_cgraph_edges ();
+
   current_function_decl = old_current_function_decl;
   pop_cfun ();
 }
@@ -1282,6 +1286,8 @@  clone_and_dispatch_function (struct cgraph_node *o
      global. */
   update_ssa (TODO_update_ssa);
 
+  /* cgraph edges need to be updated before computing inline parameters. */
+  rebuild_cgraph_edges ();
   compute_inline_parameters (cgraph_get_create_node (orig_fndecl), false);
   DECL_DECLARED_INLINE_P (orig_fndecl) = 1;
   DECL_UNINLINABLE (orig_fndecl) = 0;
@@ -1623,7 +1629,6 @@  convert_builtin_dispatch (gimple stmt)
       phinode = create_phi_node (tmp_var, bb4);
       add_phi_arg (phinode, ssa_if_name, e24, UNKNOWN_LOCATION);
       add_phi_arg (phinode, ssa_else_name, e34, UNKNOWN_LOCATION);
-      mark_symbols_for_renaming (phinode);
       gcc_assert (lhs_result);
       assign_stmt
         = gimple_build_assign (lhs_result, gimple_phi_result (phinode));
@@ -1732,6 +1737,8 @@  do_convert_builtin_dispatch (void)
        ++ix)
     convert_builtin_dispatch (builtin_stmt);
 
+  /* cgraph edges need to be updated before computing inline parameters. */
+  rebuild_cgraph_edges ();
   compute_inline_parameters (cgraph_get_create_node (current_function_decl),
 			     false);
  
Index: passes.c
===================================================================
--- passes.c	(revision 178618)
+++ passes.c	(working copy)
@@ -1254,10 +1254,6 @@  init_optimization_passes (void)
     {
       struct opt_pass **p = &pass_ipa_multiversion_dispatch.pass.sub;
       NEXT_PASS (pass_tree_convert_builtin_dispatch);
-      /* Rebuilding cgraph edges is necessary as the above passes change
-         the call graph.  Otherwise, future optimizations use the old
-	 call graph and make wrong decisions sometimes.*/
-      NEXT_PASS (pass_rebuild_cgraph_edges);
     }
   NEXT_PASS (pass_ipa_lower_emutls);
   *p = NULL;