From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19857 invoked by alias); 10 Jun 2011 20:10:02 -0000 Received: (qmail 19734 invoked by uid 22791); 10 Jun 2011 20:09:53 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,TW_CF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jun 2011 20:09:38 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 3D9D09AC86C; Fri, 10 Jun 2011 22:09:37 +0200 (CEST) Date: Fri, 10 Jun 2011 21:06:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Cgraph alias reorg 14/14 (ipa-pure-const, ipa-reference and tree-profile fixes) Message-ID: <20110610200937.GB3252@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00884.txt.bz2 Hi, the patch series will be a bit longer as I found some problems exposed by the breakup. This patch fixes latent bug in tree-profile that needs to call execute_fixup_cfg. This is because local pure const might find some edges nothrow and cfg needs to be updated (that usually happens only after ipa passes). Second problem is ipa-pure-const overactively marking aliases as nothrow/const/pure. Since we ignore them for analysis, we should skip them while updating the flags, too. Bootstrapped/regested x86_64-linux, comitted. Honza * cgraph.c (cgraph_set_nothrow_flag_1): Update cgraph after setting the nothrow flag. * ipa-reference.c (propagate): Skip aliases. * ipa-pure-const.c (propagate_pure_const): Skip aliases. (propagate_nothrow): Skip aliases; do not update cgraph. (local_pure_const): Do not update cgraph. * tree-profile.c (tree_profiling): Do fixup_cfg. Index: cgraph.c =================================================================== *** cgraph.c (revision 174904) --- cgraph.c (working copy) *************** cgraph_make_node_local (struct cgraph_no *** 2681,2687 **** --- 2681,2693 ---- static bool cgraph_set_nothrow_flag_1 (struct cgraph_node *node, void *data) { + struct cgraph_edge *e; + TREE_NOTHROW (node->decl) = data != NULL; + + if (data != NULL) + for (e = node->callers; e; e = e->next_caller) + e->can_throw_external = false; return false; } Index: ipa-reference.c =================================================================== *** ipa-reference.c (revision 174904) --- ipa-reference.c (working copy) *************** propagate (void) *** 645,650 **** --- 645,652 ---- struct ipa_dfs_info * w_info; node = order[i]; + if (node->alias) + continue; node_info = get_reference_vars_info (node); gcc_assert (node_info); *************** propagate (void) *** 802,807 **** --- 804,811 ---- struct ipa_dfs_info * w_info; node = order[i]; + if (node->alias) + continue; node_info = get_reference_vars_info (node); node_g = &node_info->global; node_l = &node_info->local; *************** propagate (void) *** 885,891 **** ipa_reference_global_vars_info_t node_g; ipa_reference_optimization_summary_t opt; ! if (!node->analyzed) continue; node_info = get_reference_vars_info (node); --- 889,895 ---- ipa_reference_global_vars_info_t node_g; ipa_reference_optimization_summary_t opt; ! if (!node->analyzed || node->alias) continue; node_info = get_reference_vars_info (node); Index: ipa-pure-const.c =================================================================== *** ipa-pure-const.c (revision 174904) --- ipa-pure-const.c (working copy) *************** propagate_pure_const (void) *** 1116,1121 **** --- 1116,1124 ---- int count = 0; node = order[i]; + if (node->alias) + continue; + if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Starting cycle\n"); *************** propagate_nothrow (void) *** 1383,1388 **** --- 1386,1394 ---- bool can_throw = false; node = order[i]; + if (node->alias) + continue; + /* Find the worst state for any node in the cycle. */ w = node; while (w) *************** propagate_nothrow (void) *** 1430,1439 **** funct_state w_l = get_function_state (w); if (!can_throw && !TREE_NOTHROW (w->decl)) { - struct cgraph_edge *e; cgraph_set_nothrow_flag (w, true); - for (e = w->callers; e; e = e->next_caller) - e->can_throw_external = false; if (dump_file) fprintf (dump_file, "Function found to be nothrow: %s\n", cgraph_node_name (w)); --- 1436,1442 ---- *************** local_pure_const (void) *** 1640,1650 **** } if (!l->can_throw && !TREE_NOTHROW (current_function_decl)) { - struct cgraph_edge *e; - cgraph_set_nothrow_flag (node, true); - for (e = node->callers; e; e = e->next_caller) - e->can_throw_external = false; changed = true; if (dump_file) fprintf (dump_file, "Function found to be nothrow: %s\n", --- 1643,1649 ---- Index: tree-profile.c =================================================================== *** tree-profile.c (revision 174904) --- tree-profile.c (working copy) *************** tree_profiling (void) *** 470,477 **** for (node = cgraph_nodes; node; node = node->next) { if (!node->analyzed ! || !gimple_has_body_p (node->decl) ! || !(!node->clone_of || node->decl != node->clone_of->decl)) continue; /* Don't profile functions produced for builtin stuff. */ --- 470,476 ---- for (node = cgraph_nodes; node; node = node->next) { if (!node->analyzed ! || !gimple_has_body_p (node->decl)) continue; /* Don't profile functions produced for builtin stuff. */ *************** tree_profiling (void) *** 485,490 **** --- 484,491 ---- /* Re-set global shared temporary variable for edge-counters. */ gcov_type_tmp_var = NULL_TREE; + /* Local pure-const may imply need to fixup the cfg. */ + execute_fixup_cfg (); branch_prob (); if (! flag_branch_probabilities