From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31460 invoked by alias); 30 Nov 2012 22:03:29 -0000 Received: (qmail 31439 invoked by uid 22791); 30 Nov 2012 22:03:28 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Nov 2012 22:03:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 0F576CB295C; Fri, 30 Nov 2012 23:03:29 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yvlRRaNumW10; Fri, 30 Nov 2012 23:03:28 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id B2FCECB2105; Fri, 30 Nov 2012 23:03:28 +0100 (CET) From: Eric Botcazou To: Marek Polacek Cc: gcc-patches@gcc.gnu.org, Richard Biener Subject: Re: [PATCH] Don't bypass blocks with multiple latch edges (PR middle-end/54838) Date: Fri, 30 Nov 2012 22:33:00 -0000 Message-ID: <3679567.118qcDcHed@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) In-Reply-To: <20121129153852.GC10621@redhat.com> References: <20121126142843.GH17362@redhat.com> <20121129153852.GC10621@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg02575.txt.bz2 > Yikes, sorry, it wasn't clear to me what PROP_loops really does. Anyway, > I think I have a better fix now. The problem is just that when removing > BB 4 (which was a header), we have to zap ->header and ->latch. We > already have code for this: > > if (current_loops != NULL > && e->src->loop_father->latch == e->src) > { > /* ??? Now we are creating (or may create) a loop > with multiple entries. Simply mark it for > removal. Alternatively we could not do this > threading. */ > e->src->loop_father->header = NULL; > e->src->loop_father->latch = NULL; > } > > but the thing is that when there are multiple latch edges, then > ->latch is NULL. So we need to keep track of how many latch edges > the header has. Regtested/bootstrapped on x86_64, ok for trunk? > > Can I get rid of may_be_loop_header (and just use n_latch_edges > 0 > instead at that one place) in a followup? > > 2012-11-29 Marek Polacek > > PR middle-end/54838 > * cprop.c (bypass_block): Set header and latch to NULL when > BB has more than one latch edge. > (n_latches): New variable. OK, let's tweak the patch as follows: 1) when current_loops is not NULL, we compute may_be_loop_header and whether the loop has more than 1 latch edge exactly, 2) when current_loops is NULL, we use your above method to do the same, 3) once this is done, we return from the function before entering the loop if this is a (potential) header with more than 1 (potential) latch edge. The comment can say that threading through a loop header with more than 1 latch edge is delicate and cite tree-threadupdate.c:thread_through_loop_header. -- Eric Botcazou