From patchwork Mon Nov 18 19:10:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 292171 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 413902C00B6 for ; Tue, 19 Nov 2013 06:10:46 +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:content-type; q= dns; s=default; b=vV1JW/HrCPWbJC8UJUmU+4jfCW3rCFx8M/EGJlYLp9/R2N bmmJ3CueM9RSJ24FXRpvkqtVnODnGhD/2GQN6byvGmCBvxmrHt1YERkL7oiNDxdZ lfc/N80+iOctSoL1+Jj5d380k1AjQyV0O2/BurTLRwkk4zTo7JTzTbB3Tc5kA= 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:content-type; s= default; bh=ELSJtJhx3dSZAjF2oq15QlgBKec=; b=Z4v6tfq4oddkehu7StsQ HMIztsLFVKLhC0KhXXgPhFDHi7LuhENL1o/SEcY0xZPv5Jyclqd+Mqoia2/Hqmuf 4dHySLZGbaOUa2Tx4DCLVP8OS/XHKU1Qx7tS75ml+BfEK5w6T+6D1wv4cNciV6MG lBUBMVj5NNZ+0G8M1u3C/do= Received: (qmail 2562 invoked by alias); 18 Nov 2013 19:10:36 -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 2539 invoked by uid 89); 18 Nov 2013 19:10:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Nov 2013 19:10:34 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAIJAQBZ008723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Nov 2013 14:10:26 -0500 Received: from stumpy.slc.redhat.com (ovpn-113-162.phx2.redhat.com [10.3.113.162]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAIJAQtq003753 for ; Mon, 18 Nov 2013 14:10:26 -0500 Message-ID: <528A6621.5050704@redhat.com> Date: Mon, 18 Nov 2013 12:10:25 -0700 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: gcc-patches Subject: [PATCH] Cleaning up comments and indention fix in tree-ssa-threadupdate.c X-IsSubscribed: yes Just some preparatory work. Just comments and an indention fix. Installed on the trunk. diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index e819d65..eb733b2 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -73,19 +73,16 @@ along with GCC; see the file COPYING3. If not see set of unique destination blocks that the incoming edges should be threaded to. - Block duplication can be further minimized by using B instead of - creating B' for one destination if all edges into B are going to be - threaded to a successor of B. We had code to do this at one time, but - I'm not convinced it is correct with the changes to avoid mucking up - the loop structure (which may cancel threading requests, thus a block - which we thought was going to become unreachable may still be reachable). - This code was also going to get ugly with the introduction of the ability - for a single jump thread request to bypass multiple blocks. + We reduce the number of edges and statements we create by not copying all + the outgoing edges and the control statement in step #1. We instead create + a template block without the outgoing edges and duplicate the template. - We further reduce the number of edges and statements we create by - not copying all the outgoing edges and the control statement in - step #1. We instead create a template block without the outgoing - edges and duplicate the template. */ + Another case this code handles is threading through a "joiner" block. In + this case, we do not know the destination of the joiner block, but one + of the outgoing edges from the joiner block leads to a threadable path. This + case largely works as outlined above, except the duplicate of the joiner + block still contains a full set of outgoing edges and its control statement. + We just redirect one of its outgoing edges to our jump threading path. */ /* Steps #5 and #6 of the above algorithm are best implemented by walking @@ -357,18 +354,13 @@ update_destination_phis (basic_block orig_bb, basic_block new_bb) } } -/* Given a duplicate block and its single destination (both stored - in RD). Create an edge between the duplicate and its single - destination. - - Add an additional argument to any PHI nodes at the single - destination. */ +/* Create an edge between BB and DEST_EDGE->dest. Add additional arguments + to any PHI nodes at DEST_EDGE->dest as needed. */ static void -create_edge_and_update_destination_phis (struct redirection_data *rd, - basic_block bb) +create_edge_and_update_destination_phis (basic_block bb, edge dest_edge) { - edge e = make_edge (bb, rd->path->last ()->e->dest, EDGE_FALLTHRU); + edge e = make_edge (bb, dest_edge->dest, EDGE_FALLTHRU); rescan_loop_exit (e, true, false); e->probability = REG_BR_PROB_BASE; @@ -376,9 +368,9 @@ create_edge_and_update_destination_phis (struct redirection_data *rd, /* We have to copy path -- which means creating a new vector as well as all the jump_thread_edge entries. */ - if (rd->path->last ()->e->aux) + if (dest_edge->aux) { - vec *path = THREAD_PATH (rd->path->last ()->e); + vec *path = THREAD_PATH (dest_edge); vec *copy = new vec (); /* Sadly, the elements of the vector are pointers and need to @@ -389,7 +381,7 @@ create_edge_and_update_destination_phis (struct redirection_data *rd, = new jump_thread_edge ((*path)[i]->e, (*path)[i]->type); copy->safe_push (x); } - e->aux = (void *)copy; + e->aux = (void *)copy; } else { @@ -400,10 +392,10 @@ create_edge_and_update_destination_phis (struct redirection_data *rd, from the duplicate block, then we will need to add a new argument to them. The argument should have the same value as the argument associated with the outgoing edge stored in RD. */ - copy_phi_args (e->dest, rd->path->last ()->e, e); + copy_phi_args (e->dest, dest_edge, e); } -/* Wire up the outgoing edges from the duplicate block and +/* Wire up the outgoing edges from the duplicate blocks and update any PHIs as needed. */ void ssa_fix_duplicate_block_edges (struct redirection_data *rd, @@ -440,7 +432,7 @@ ssa_fix_duplicate_block_edges (struct redirection_data *rd, else { remove_ctrl_stmt_and_useless_edges (rd->dup_block, NULL); - create_edge_and_update_destination_phis (rd, rd->dup_block); + create_edge_and_update_destination_phis (rd->dup_block, path->last ()->e); } } /* Hash table traversal callback routine to create duplicate blocks. */ @@ -481,7 +473,7 @@ ssa_create_duplicates (struct redirection_data **slot, inline int ssa_fixup_template_block (struct redirection_data **slot, - ssa_local_info_t *local_info) + ssa_local_info_t *local_info) { struct redirection_data *rd = *slot; @@ -832,7 +824,7 @@ thread_single_edge (edge e) create_block_for_threading (bb, &rd); remove_ctrl_stmt_and_useless_edges (rd.dup_block, NULL); - create_edge_and_update_destination_phis (&rd, rd.dup_block); + create_edge_and_update_destination_phis (rd.dup_block, npath->last ()->e); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, " Threaded jump %d --> %d to %d\n",