From patchwork Tue Sep 25 19:12:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Gretton-Dann X-Patchwork-Id: 186880 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 CFE232C0097 for ; Wed, 26 Sep 2012 05:13:08 +1000 (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=1349205189; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Cc:Subject:Date:Message-ID:User-Agent: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=BqTYgIaQywiFb8xM1aHzit9w+7Q=; b=Sgub3JQ/m7mN68r /nbQm3ig77LcGI1w7ZqchByk+D2NZVrJmW+eDC+Kl7LYsyqRQk43aBRNQK+mdoEH RvY3jOMx9R+ABXAJjlv+g0DDC3QAOLRxexyVfwVPUADILeZjZgbg6NmTAD4yro64 3z7SlDPNZyhFK70ydBfEaPzQlxgE= 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:X-Google-DKIM-Signature:Received:Received:From:To:Cc:Subject:Date:Message-ID:User-Agent:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=nji9V5n0liz297Pa9JqXR8nZ/uXblStc9QDSQI5MG/yP8c68FUuknNc5AF4r5u w++GkmvkzVLeC/0x0m41ejJw+CPN8vHs2I4ZrNQkwy/ZacgXxT75cgLnWDsH023X NH12sUzQnasNr4zdaNT3JX4Wy1rWNtguoV/h6uGE4ngiA=; Received: (qmail 22524 invoked by alias); 25 Sep 2012 19:13:04 -0000 Received: (qmail 22514 invoked by uid 22791); 25 Sep 2012 19:13:03 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f175.google.com (HELO mail-we0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Sep 2012 19:12:49 +0000 Received: by weyt44 with SMTP id t44so3335548wey.20 for ; Tue, 25 Sep 2012 12:12:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=5jXdilxyM3ssGVh13sBIg/GuhYDW2z/HP/revqrG4gI=; b=mVi7CaJLhcU24rf0YOphWLVyZmjkI/b3CpqgT1dc2L23mRKPdb2xlYKyikwDcE2JGX +t1biL1iSc9bS53bIP57x99PzFI1lUUOjCsfeYqrqyvQYsDE2oN7BLw8rbYxCaMgudRu NUH8tmyzm9uwc+4McYPxoXCi6fnl45ucFEzdQEm2g0hcB+7HZ0kOvd8EL7CGf0qHiIrv aAhdEyKpQ5iNLzvU7UQUOB51IgJ5SovEYU6eBeyCLfFJuUbLQN6E9zJJBqk3vBCJQNNM HdYvO4F0SFlwkk39/Sd5flgAFyE/ZujzV6ALJGRm+S71pvsIZPgmMm8PRqEOpJfnULVJ pdhQ== Received: by 10.216.241.198 with SMTP id g48mr8700155wer.161.1348600368353; Tue, 25 Sep 2012 12:12:48 -0700 (PDT) Received: from e103209-lin.localnet (12.190.125.91.dyn.plus.net. [91.125.190.12]) by mx.google.com with ESMTPS id v3sm21489844wiw.7.2012.09.25.12.12.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 12:12:47 -0700 (PDT) From: Matthew Gretton-Dann To: Steven Bosscher Cc: Richard Earnshaw , "gcc-patches@gcc.gnu.org" , "jle@rice.edu" , Ramana Radhakrishnan , "law@redhat.com" , "ebotcazou@libertysurf.fr" , "rdsandiford@googlemail.com" Subject: Re: [RFA 2/n] Don't lift loads above register using jumps in postreload-gcse.c Date: Tue, 25 Sep 2012 20:12:43 +0100 Message-ID: <3828314.5fHR3eBOVy@e103209-lin> User-Agent: KMail/4.8.5 (Linux/3.2.0-30-generic; KDE/4.8.5; x86_64; ; ) In-Reply-To: References: <1721935.92zzXaUnD9@e103209-lin> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmro5qqCKxATq2hEMARqcZ5HISPgvPC140NtOz9PsY6+Pfu4lNBMCuoAmT2ZSmwXQy3nuyn X-IsSubscribed: yes 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 On Wednesday 05 September 2012 17:40:23 Steven Bosscher wrote: > On Wed, Sep 5, 2012 at 3:18 PM, Matthew Gretton-Dann > > wrote: > > On 5 September 2012 13:45, Richard Earnshaw wrote: > >> On 05/09/12 13:02, Steven Bosscher wrote: > >>> On Wed, Sep 5, 2012 at 1:42 PM, Matthew Gretton-Dann wrote: > >>>> Whilst this fix works for this particular case I am not sure it is the > >>>> best fix for the general issue, and so if others have a better idea how > >>>> to fix this I would be very happy. > >>> > >>> postreload-gcse.c is broken in "interesting" ways. Look at this gem for > >>> example: > >>> > >>> static bool > >>> reg_changed_after_insn_p (rtx x, int cuid) > >>> { > >>> > >>> unsigned int regno, end_regno; > >>> > >>> regno = REGNO (x); > >>> end_regno = END_HARD_REGNO (x); > >>> do > >>> > >>> if (reg_avail_info[regno] > cuid) > >>> > >>> return true; > >>> > >>> while (++regno < end_regno); > >>> return false; > >>> > >>> } > >>> > >>> So the more conservative the fix, the better :-) > > > > I suppose removing the pass is too conservative :-) > > > >>> The patch looks correct to me. But perhaps the pass should just punt > >>> on blocks not ending in a simple jump in > >>> bb_has_well_behaved_predecessors? > > > > By 'simple jump' you mean any block with at most only EDGE_FALLTHRU on the > > edge? > No, I mean using the onlyjump_p predicate. Again sorry for the delay. Attached is an updated patch using the onlyjump_p predicate as suggested by Steven. Tested cross arm-none-linux-gnueabi with QEmu. OK for trunk? Thanks, Matt gcc/ChangeLog: 2012-09-25 Matthew Gretton-Dann * postreload-gcse.c (bb_has_well_behaved_predecessors): Don't handle blocks that end in a non-simple jump. diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c index b9e9f25..412c8fc 100644 --- a/gcc/postreload-gcse.c +++ b/gcc/postreload-gcse.c @@ -925,6 +925,9 @@ bb_has_well_behaved_predecessors (basic_block bb) if (JUMP_TABLE_DATA_P (BB_END (pred->src))) return false; + + if (onlyjump_p (BB_END (pred->src))) + return false; } return true; }