From patchwork Thu Nov 14 18:05:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 291316 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 64CE12C008A for ; Fri, 15 Nov 2013 05:06:11 +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=dlacN3uA8xct8vSsjM/aR16bXz2eBCTT7rh7KzEczyl5Is yLcFV0oMzbTgjk27/qz7hSerRKl54sbaQBEl5WA6aB/2pXNdsh9ZnO5C3E1cfMDt X/oMXb8h5axUnYEnkpkL9sw4+AlQz/Bg7AqQihVMKVxFviJxfQsC3VieJQPQU= 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=jgBO2CBSillYtJIjEKtzL5UrsrY=; b=B3w5MZse7qx5aZduZMnY VUeaox8Rv5yyhBbkcaTIzL939+JP2vyIXaa4qLrPqHHQPHRgfgqCVyCbp8fCDDdo 6Js6t72/R7mcPUVQaKQK74Mke5F47hpaMwXWIxwmeWaChKFobTDqu7r5TzV/RVBV hUjMIQdqZdvYe/V8mjGu7CI= Received: (qmail 3118 invoked by alias); 14 Nov 2013 18:06:00 -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 3088 invoked by uid 89); 14 Nov 2013 18:05:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_40, 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; Thu, 14 Nov 2013 18:05:58 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAEI5pT9005920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Nov 2013 13:05:51 -0500 Received: from stumpy.slc.redhat.com (ovpn-113-161.phx2.redhat.com [10.3.113.161]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAEI5p4m029225 for ; Thu, 14 Nov 2013 13:05:51 -0500 Message-ID: <528510FF.1080609@redhat.com> Date: Thu, 14 Nov 2013 11:05:51 -0700 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: gcc-patches Subject: [PATCH] Generalize thread_through_normal_block X-IsSubscribed: yes As part of the generalized FSA optimization work we need the ability to start a jump threading path with a joiner, then later in the path have a normal jump threading block (ie, has side effects and thus requires duplication). thread_through_normal_block needs one tweak to make that possible. Namely it should only push the EDGE_START_JUMP_THREAD marker if the jump threading path is currently empty. Right now we don't call thread_through_normal_block after we've processed a joiner block, but we will soon :-) So at least today, this patch has no impact on the code we generate. Bootstrapped and regression tested on x86_64-unknown-linux-gnu. Installed on the trunk. * tree-ssa-threadedge.c (thread_through_normal_block): Only push the EDGE_START_JUMP_THREAD marker if the jump threading path is empty. diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index c9b2c69..cabfc82 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -940,12 +940,18 @@ thread_through_normal_block (edge e, || bitmap_bit_p (visited, dest->index)) return false; - jump_thread_edge *x - = new jump_thread_edge (e, EDGE_START_JUMP_THREAD); - path->safe_push (x); - *backedge_seen_p |= ((e->flags & EDGE_DFS_BACK) != 0); + /* Only push the EDGE_START_JUMP_THREAD marker if this is + first edge on the path. */ + if (path->length () == 0) + { + jump_thread_edge *x + = new jump_thread_edge (e, EDGE_START_JUMP_THREAD); + path->safe_push (x); + *backedge_seen_p |= ((e->flags & EDGE_DFS_BACK) != 0); + } - x = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_BLOCK); + jump_thread_edge *x + = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_BLOCK); path->safe_push (x); *backedge_seen_p |= ((taken_edge->flags & EDGE_DFS_BACK) != 0); @@ -953,7 +959,7 @@ thread_through_normal_block (edge e, secondary effects of threading without having to re-run DOM or VRP. */ if (!*backedge_seen_p - || ! cond_arg_set_in_bb (taken_edge, e->dest)) + || ! cond_arg_set_in_bb (taken_edge, e->dest)) { /* We don't want to thread back to a block we have already visited. This may be overly conservative. */