From patchwork Wed Sep 11 13:02:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 274273 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 86CAA2C010C for ; Wed, 11 Sep 2013 23:02:12 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=toLzZPK+U/ZJg+t7RMpdSl3uIngjWWwHmsL533I+Vk3tPJE5zb wERjc+J4C0gT5JzxOrbAzQ3gQPl4JAFNrrnR6swDEg6vwy2wIkFebUdpbyjiRXyE BcVxoqExhXjMTBZApujE8/G4CkHQyXP6UgAs/qusjZ32NqPCQ4YnY58KA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=w5wZorljkrgDPdsVgWQ4M8I7U8A=; b=CxEYB4Kmy1Dk4wQe1G7A kv6qaTeI/RWfcSGD/1cW6DS6TJPKwRjPfxv9bc/4yMySTqi8k5l0J7G6lIPTExpu iFAcNC+6WiYnD7tU/ObNs9FS1WXAUcd+hYLeBSc4Z1oR++RA+1p7W++xCAwTKLM/ /tryKdlAqf1gQ7/MAu7cXIk= Received: (qmail 23046 invoked by alias); 11 Sep 2013 13:02:06 -0000 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 Received: (qmail 23034 invoked by uid 89); 11 Sep 2013 13:02:06 -0000 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2013 13:02:06 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RDNS_NONE autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6D555A50E4; Wed, 11 Sep 2013 15:02:03 +0200 (CEST) Date: Wed, 11 Sep 2013 15:02:02 +0200 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH] Move edge_within_scc to ipa-utils.c Message-ID: <20130911130202.GF6732@virgil.suse> Mail-Followup-To: GCC Patches , Jan Hubicka MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, edge_within_scc should really be a part of API accompanying ipa_reduced_postorder just like ipa_get_nodes_in_cycle and so this patch moves it to ipa-utils.c and gives it the ipa_ prefix. Bootstrapped and tested on x86_64-linux. OK for trunk? Thanks, Martin 2013-09-10 Martin Jambor * ipa-utils.h (ipa_edge_within_scc): Declare. * ipa-cp.c (edge_within_scc): Moved... * ipa-utils.c (ipa_edge_within_scc): ...here. Updated all callers. Index: src/gcc/ipa-utils.c =================================================================== --- src.orig/gcc/ipa-utils.c +++ src/gcc/ipa-utils.c @@ -253,6 +253,22 @@ ipa_get_nodes_in_cycle (struct cgraph_no return v; } +/* Return true iff the CS is an edge within a strongly connected component as + computed by ipa_reduced_postorder. */ + +bool +ipa_edge_within_scc (struct cgraph_edge *cs) +{ + struct ipa_dfs_info *caller_dfs = (struct ipa_dfs_info *) cs->caller->symbol.aux; + struct ipa_dfs_info *callee_dfs; + struct cgraph_node *callee = cgraph_function_node (cs->callee, NULL); + + callee_dfs = (struct ipa_dfs_info *) callee->symbol.aux; + return (caller_dfs + && callee_dfs + && caller_dfs->scc_no == callee_dfs->scc_no); +} + struct postorder_stack { struct cgraph_node *node; Index: src/gcc/ipa-utils.h =================================================================== --- src.orig/gcc/ipa-utils.h +++ src/gcc/ipa-utils.h @@ -42,6 +42,7 @@ int ipa_reduced_postorder (struct cgraph bool (*ignore_edge) (struct cgraph_edge *)); void ipa_free_postorder_info (void); vec ipa_get_nodes_in_cycle (struct cgraph_node *); +bool ipa_edge_within_scc (struct cgraph_edge *); int ipa_reverse_postorder (struct cgraph_node **); tree get_base_var (tree); void ipa_merge_profiles (struct cgraph_node *dst, Index: src/gcc/ipa-cp.c =================================================================== --- src.orig/gcc/ipa-cp.c +++ src/gcc/ipa-cp.c @@ -287,22 +287,6 @@ ipa_lat_is_single_const (struct ipcp_lat return true; } -/* Return true iff the CS is an edge within a strongly connected component as - computed by ipa_reduced_postorder. */ - -static inline bool -edge_within_scc (struct cgraph_edge *cs) -{ - struct ipa_dfs_info *caller_dfs = (struct ipa_dfs_info *) cs->caller->symbol.aux; - struct ipa_dfs_info *callee_dfs; - struct cgraph_node *callee = cgraph_function_node (cs->callee, NULL); - - callee_dfs = (struct ipa_dfs_info *) callee->symbol.aux; - return (caller_dfs - && callee_dfs - && caller_dfs->scc_no == callee_dfs->scc_no); -} - /* Print V which is extracted from a value in a lattice to F. */ static void @@ -957,7 +941,7 @@ add_value_to_lattice (struct ipcp_lattic for (val = lat->values; val; val = val->next) if (values_equal_for_ipcp_p (val->value, newval)) { - if (edge_within_scc (cs)) + if (ipa_edge_within_scc (cs)) { struct ipcp_value_source *s; for (s = val->sources; s ; s = s->next) @@ -1030,7 +1014,7 @@ propagate_vals_accross_pass_through (str are arithmetic functions with circular dependencies, there is infinite number of them and we would just make lattices bottom. */ if ((ipa_get_jf_pass_through_operation (jfunc) != NOP_EXPR) - and edge_within_scc (cs)) + && ipa_edge_within_scc (cs)) ret = set_lattice_contains_variable (dest_lat); else for (src_val = src_lat->values; src_val; src_val = src_val->next) @@ -1061,7 +1045,7 @@ propagate_vals_accross_ancestor (struct struct ipcp_value *src_val; bool ret = false; - if (edge_within_scc (cs)) + if (ipa_edge_within_scc (cs)) return set_lattice_contains_variable (dest_lat); for (src_val = src_lat->values; src_val; src_val = src_val->next) @@ -2129,7 +2113,7 @@ propagate_constants_topo (struct topo_in struct cgraph_edge *cs; for (cs = v->callees; cs; cs = cs->next_callee) - if (edge_within_scc (cs) + if (ipa_edge_within_scc (cs) && propagate_constants_accross_call (cs)) push_node_to_stack (topo, cs->callee); v = pop_node_from_stack (topo); @@ -2146,7 +2130,7 @@ propagate_constants_topo (struct topo_in estimate_local_effects (v); add_all_node_vals_to_toposort (v); for (cs = v->callees; cs; cs = cs->next_callee) - if (!edge_within_scc (cs)) + if (!ipa_edge_within_scc (cs)) propagate_constants_accross_call (cs); } cycle_nodes.release (); @@ -3462,7 +3446,7 @@ spread_undeadness (struct cgraph_node *n struct cgraph_edge *cs; for (cs = node->callees; cs; cs = cs->next_callee) - if (edge_within_scc (cs)) + if (ipa_edge_within_scc (cs)) { struct cgraph_node *callee; struct ipa_node_params *info; @@ -3493,7 +3477,7 @@ has_undead_caller_from_outside_scc_p (st has_undead_caller_from_outside_scc_p, NULL, true)) return true; - else if (!edge_within_scc (cs) + else if (!ipa_edge_within_scc (cs) && !IPA_NODE_REF (cs->caller)->node_dead) return true; return false;