From patchwork Wed Sep 7 01:44:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriraman Tallam X-Patchwork-Id: 113686 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5F0F4B6F77 for ; Wed, 7 Sep 2011 11:44:55 +1000 (EST) Received: (qmail 3629 invoked by alias); 7 Sep 2011 01:44:53 -0000 Received: (qmail 3618 invoked by uid 22791); 7 Sep 2011 01:44:52 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_TM X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Sep 2011 01:44:36 +0000 Received: from hpaq12.eem.corp.google.com (hpaq12.eem.corp.google.com [172.25.149.12]) by smtp-out.google.com with ESMTP id p871iZ2Q023883; Tue, 6 Sep 2011 18:44:35 -0700 Received: from azwildcat.mtv.corp.google.com (azwildcat.mtv.corp.google.com [172.18.110.231]) by hpaq12.eem.corp.google.com with ESMTP id p871iXHr016198; Tue, 6 Sep 2011 18:44:34 -0700 Received: by azwildcat.mtv.corp.google.com (Postfix, from userid 69128) id 229C9B21A6; Tue, 6 Sep 2011 18:44:32 -0700 (PDT) To: reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org Subject: [google][main]Fix broken test cases in google/main branch (issue4961065) Message-Id: <20110907014433.229C9B21A6@azwildcat.mtv.corp.google.com> Date: Tue, 6 Sep 2011 18:44:32 -0700 (PDT) From: tmsriram@google.com (Sriraman Tallam) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 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;