From patchwork Fri Oct 18 13:39:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 284593 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 2EE8E2C00A4 for ; Sat, 19 Oct 2013 00:39:59 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=uNTvpvsWZfhxfrbLd p74jof4ohE8sQy7+ROUlStJqYV6HLCbgtePhpTJcuCn7ZxJnco+R3Qq0lGaQAa9N LVSKet3XcYj++2LesAtgG5aNJZDHTRPlwpAxTzaxPKp+hIFxId4Y4srBZx8ZoQhX j3ARbAJaMIaF8ZUgyx6hP7JAoU= 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 :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=f4oOaYQJo2ltCe+pThplE6Z ldss=; b=NGyddC8MEN9XU3g4o7IdNfIEilNgcis5vqCm849Jp2CmdZ4gSdmzlWK JVhqJ5lfAeibd9LL8XfC7Oku3oVxNYzruDtHUn+QIUWq+iksQSw42SNNdjLkGABZ 4X/GK59uTN+cBSCLsuYBsWNKX5emae4M0n959WDVnq94OjWH5Gs0= Received: (qmail 23894 invoked by alias); 18 Oct 2013 13:39:53 -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 23883 invoked by uid 89); 18 Oct 2013 13:39:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Oct 2013 13:39:52 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9IDdpPF003491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Oct 2013 09:39:51 -0400 Received: from [10.10.61.67] (vpn-61-67.rdu2.redhat.com [10.10.61.67]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9IDdoYo008136; Fri, 18 Oct 2013 09:39:50 -0400 Message-ID: <52613A26.9040703@redhat.com> Date: Fri, 18 Oct 2013 09:39:50 -0400 From: Andrew MacLeod User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: gcc-patches , Richard Biener Subject: [patch 4/8] Remove tree-ssa-dom.h from the tree-ssa.h include list. References: <5260856C.7070008@redhat.com> In-Reply-To: <5260856C.7070008@redhat.com> X-IsSubscribed: yes degenerate_phi_result was defined in tree-ssa-dom.c, I moved it to tree-phinodes since all it does is determine whether the arguements of the phi which are not the same as the result are all the same. This reduced by half the number fo files which required tree-ssa-dom.h. bootstraps on x86_64-unknown-linux-gnu with no new regressions. OK? Andrew * tree-ssa.h: Don't include tree-ssa-dom.h. * tree-ssa-dom.c: Include tree-ssa-dom.h. (degenerate_phi_result): Move to tree-phinodes.c. * tree-phinodes.c (degenerate_phi_result): Relocate here. * tree-ssa-dom.h: Remove Prototype. * tree-phinodes.h: Add prototype. * tree-ssa-copy.c: Include tree-ssa-dom.h. * tree-ssa-forwprop.c: Likewise. *** T5/tree-ssa.h 2013-10-17 13:05:11.372947947 -0400 --- tree-ssa.h 2013-10-17 13:05:32.445945346 -0400 *************** along with GCC; see the file COPYING3. *** 31,37 **** #include "tree-phinodes.h" #include "ssa-iterators.h" #include "tree-ssanames.h" - #include "tree-ssa-dom.h" #include "tree-ssa-loop.h" #include "tree-into-ssa.h" #include "tree-dfa.h" --- 31,36 ---- *** T5/tree-ssa-dom.c 2013-10-17 13:05:11.368947948 -0400 --- tree-ssa-dom.c 2013-10-17 13:14:26.712902297 -0400 *************** along with GCC; see the file COPYING3. *** 38,43 **** --- 38,44 ---- #include "langhooks.h" #include "params.h" #include "tree-ssa-threadedge.h" + #include "tree-ssa-dom.h" /* This file implements optimizations on the dominator tree. */ *************** avail_expr_hash (const void *p) *** 2589,2630 **** /* PHI-ONLY copy and constant propagation. This pass is meant to clean up degenerate PHIs created by or exposed by jump threading. */ - /* Given PHI, return its RHS if the PHI is a degenerate, otherwise return - NULL. */ - - tree - degenerate_phi_result (gimple phi) - { - tree lhs = gimple_phi_result (phi); - tree val = NULL; - size_t i; - - /* Ignoring arguments which are the same as LHS, if all the remaining - arguments are the same, then the PHI is a degenerate and has the - value of that common argument. */ - for (i = 0; i < gimple_phi_num_args (phi); i++) - { - tree arg = gimple_phi_arg_def (phi, i); - - if (arg == lhs) - continue; - else if (!arg) - break; - else if (!val) - val = arg; - else if (arg == val) - continue; - /* We bring in some of operand_equal_p not only to speed things - up, but also to avoid crashing when dereferencing the type of - a released SSA name. */ - else if (TREE_CODE (val) != TREE_CODE (arg) - || TREE_CODE (val) == SSA_NAME - || !operand_equal_p (arg, val, 0)) - break; - } - return (i == gimple_phi_num_args (phi) ? val : NULL); - } - /* Given a statement STMT, which is either a PHI node or an assignment, remove it from the IL. */ --- 2590,2595 ---- *** T5/tree-phinodes.c 2013-10-17 13:05:11.366947948 -0400 --- tree-phinodes.c 2013-10-17 13:10:14.281917669 -0400 *************** remove_phi_nodes (basic_block bb) *** 464,467 **** --- 464,504 ---- set_phi_nodes (bb, NULL); } + /* Given PHI, return its RHS if the PHI is a degenerate, otherwise return + NULL. */ + + tree + degenerate_phi_result (gimple phi) + { + tree lhs = gimple_phi_result (phi); + tree val = NULL; + size_t i; + + /* Ignoring arguments which are the same as LHS, if all the remaining + arguments are the same, then the PHI is a degenerate and has the + value of that common argument. */ + for (i = 0; i < gimple_phi_num_args (phi); i++) + { + tree arg = gimple_phi_arg_def (phi, i); + + if (arg == lhs) + continue; + else if (!arg) + break; + else if (!val) + val = arg; + else if (arg == val) + continue; + /* We bring in some of operand_equal_p not only to speed things + up, but also to avoid crashing when dereferencing the type of + a released SSA name. */ + else if (TREE_CODE (val) != TREE_CODE (arg) + || TREE_CODE (val) == SSA_NAME + || !operand_equal_p (arg, val, 0)) + break; + } + return (i == gimple_phi_num_args (phi) ? val : NULL); + } + + #include "gt-tree-phinodes.h" *** T5/tree-ssa-dom.h 2013-10-17 13:05:11.368947948 -0400 --- tree-ssa-dom.h 2013-10-17 13:11:27.636912389 -0400 *************** extern void dump_dominator_optimization_ *** 24,29 **** extern void debug_dominator_optimization_stats (void); extern int loop_depth_of_name (tree); extern bool simple_iv_increment_p (gimple); - extern tree degenerate_phi_result (gimple); #endif /* GCC_TREE_SSA_DOM_H */ --- 24,28 ---- *** T5/tree-phinodes.h 2013-10-17 13:05:11.366947948 -0400 --- tree-phinodes.h 2013-10-17 13:11:25.245912550 -0400 *************** extern void add_phi_arg (gimple, tree, e *** 29,35 **** extern void remove_phi_args (edge); extern void remove_phi_node (gimple_stmt_iterator *, bool); extern void remove_phi_nodes (basic_block); ! /* Return a use_operand_p pointer for argument I of PHI node GS. */ /* Set PHI nodes of a basic block BB to SEQ. */ --- 29,35 ---- extern void remove_phi_args (edge); extern void remove_phi_node (gimple_stmt_iterator *, bool); extern void remove_phi_nodes (basic_block); ! extern tree degenerate_phi_result (gimple); /* Set PHI nodes of a basic block BB to SEQ. */ *** T5/tree-ssa-copy.c 2013-10-17 13:05:11.368947948 -0400 --- tree-ssa-copy.c 2013-10-17 13:14:19.934902613 -0400 *************** along with GCC; see the file COPYING3. *** 33,38 **** --- 33,39 ---- #include "langhooks.h" #include "cfgloop.h" #include "tree-scalar-evolution.h" + #include "tree-ssa-dom.h" /* This file implements the copy propagation pass and provides a handful of interfaces for performing const/copy propagation and *** T5/tree-ssa-forwprop.c 2013-10-17 13:05:11.368947948 -0400 --- tree-ssa-forwprop.c 2013-10-17 13:14:30.945902103 -0400 *************** along with GCC; see the file COPYING3. *** 34,39 **** --- 34,40 ---- #include "cfgloop.h" #include "optabs.h" #include "tree-ssa-propagate.h" + #include "tree-ssa-dom.h" /* This pass propagates the RHS of assignment statements into use sites of the LHS of the assignment. It's basically a specialized