From patchwork Tue Oct 16 14:30:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 191805 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]) by ozlabs.org (Postfix) with SMTP id 7EA6F2C008D for ; Wed, 17 Oct 2012 01:30:23 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351002624; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:To:Cc:Subject:References:In-Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=p+nTdx3Ofb99n2e7iDVk JK+WiwQ=; b=iHZqdNER9fbyh/RZ5k5rGR/s5Zs7OS0bS/RRg2MvXUbDSHXdWjVc DOs1oSPpS9SbtKRyG/qQmhnNTZO2oEyDaeYRxD+dzShgciiKHd2bpGZY8oYx2YDv Tm4ode8PQg1UMujJo9bFzTAYOQjrBYfZZnWGSM/nmXE+KSwjrF/NeTk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:To:Cc:Subject:References:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=kPE7RpxV65mUw9BW9CBtOOtHpUu3xGFz6kLX3mQ30578PCNhQlzm/5RIy82WBt bhuQFeepMenRQ+mExqFirl8/sxW/LY0R/OzmP903xH0tVcpjQY40/n2fZk2qa+Zx 8PZRuA0vx9s2wZd+Li8rMQAQE5bf8T5nz2LoIR4ebE6OU=; Received: (qmail 13126 invoked by alias); 16 Oct 2012 14:30:19 -0000 Received: (qmail 13117 invoked by uid 22791); 16 Oct 2012 14:30:18 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, MIME_QP_LONG_LINE, TW_CF X-Spam-Check-By: sourceware.org Received: from c62.cesmail.net (HELO c62.cesmail.net) (216.154.195.54) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Oct 2012 14:30:12 +0000 Received: from unknown (HELO delta2) ([192.168.1.50]) by c62.cesmail.net with ESMTP; 16 Oct 2012 10:30:11 -0400 Received: from cust213-dsl91-135-11.idnet.net (cust213-dsl91-135-11.idnet.net [91.135.11.213]) by webmail.spamcop.net (Horde MIME library) with HTTP; Tue, 16 Oct 2012 10:30:11 -0400 Message-ID: <20121016103011.8w1hwfa73ms0c8sw-nzlynne@webmail.spamcop.net> Date: Tue, 16 Oct 2012 10:30:11 -0400 From: Joern Rennecke To: Zdenek Dvorak Cc: gcc-patches@gcc.gnu.org, Daniel Berlin Subject: Re: Ping: RFA: Improve doloop_begin support References: <20121015005038.n7i3gxpezogggogs-nzlynne@webmail.spamcop.net> <20121016092110.GA22706@kam.mff.cuni.cz> <20121016091833.8n3no4dis0cs8wwg-nzlynne@webmail.spamcop.net> <20121016140130.GA23613@kam.mff.cuni.cz> In-Reply-To: <20121016140130.GA23613@kam.mff.cuni.cz> MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) 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 Quoting Zdenek Dvorak : > no -- you should also test that latch contains no active insns. > I.e., factorize > out whatever forwarder_block_p does except for the test > "(dest->loop_father->header == dest)" test, Like this? * basic-block.h (forwarder_block_p_1): Declare. * cfgrtl.c (orwarder_block_p_1): New function, factored out of ... (orwarder_block_p): ... here. --- cfgrtl.c-old 2012-10-16 15:21:06.025532573 +0100 +++ cfgrtl.c 2012-10-16 15:23:23.135529867 +0100 @@ -541,10 +541,9 @@ flow_active_insn_p (const_rtx insn) /* Return true if the block has no effect and only forwards control flow to its single destination. */ -/* FIXME: Make this a cfg hook. */ bool -forwarder_block_p (const_basic_block bb) +forwarder_block_p_1 (const_basic_block bb) { rtx insn; @@ -552,6 +551,24 @@ forwarder_block_p (const_basic_block bb) || !single_succ_p (bb)) return false; + for (insn = BB_HEAD (bb); insn != BB_END (bb); insn = NEXT_INSN (insn)) + if (INSN_P (insn) && flow_active_insn_p (insn)) + return false; + + return (!INSN_P (insn) + || (JUMP_P (insn) && simplejump_p (insn)) + || !flow_active_insn_p (insn)); +} + +/* Likewise, but protect loop latches, headers and preheaders. */ +/* FIXME: Make this a cfg hook. */ + +bool +forwarder_block_p (const_basic_block bb) +{ + if (!forwarder_block_p_1 (bb)) + return false; + /* Protect loop latches, headers and preheaders. */ if (current_loops) { @@ -563,13 +580,7 @@ forwarder_block_p (const_basic_block bb) return false; } - for (insn = BB_HEAD (bb); insn != BB_END (bb); insn = NEXT_INSN (insn)) - if (INSN_P (insn) && flow_active_insn_p (insn)) - return false; - - return (!INSN_P (insn) - || (JUMP_P (insn) && simplejump_p (insn)) - || !flow_active_insn_p (insn)); + return true; } /* Return nonzero if we can reach target from src by falling through. */