From patchwork Tue Aug 3 15:31:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 60770 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 99E27B70CC for ; Wed, 4 Aug 2010 01:31:27 +1000 (EST) Received: (qmail 21744 invoked by alias); 3 Aug 2010 15:31:24 -0000 Received: (qmail 21733 invoked by uid 22791); 3 Aug 2010 15:31:22 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_SV, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Aug 2010 15:31:17 +0000 Received: (qmail 19210 invoked from network); 3 Aug 2010 15:31:15 -0000 Received: from unknown (HELO ?84.152.232.205?) (bernds@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 Aug 2010 15:31:15 -0000 Message-ID: <4C583639.9070704@codesourcery.com> Date: Tue, 03 Aug 2010 17:31:05 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100724 Thunderbird/3.1.1 MIME-Version: 1.0 To: Jeff Law CC: Eric Botcazou , gcc-patches@gcc.gnu.org, Steven Bosscher , Jim Wilson Subject: Re: ifcvt/crossjump patch: Fix PR 42496, 21803 References: <4BB3CCCA.7000600@codesourcery.com> <201004101235.54302.ebotcazou@adacore.com> <4BC62EB2.40609@codesourcery.com> <201004200005.53901.ebotcazou@adacore.com> <4C460A1F.4000509@codesourcery.com> <4C56EABB.4030401@redhat.com> <4C56EB55.7010408@codesourcery.com> <4C56ECB1.9060302@redhat.com> <4C56EF21.1060801@codesourcery.com> <4C58232D.8090805@codesourcery.com> <4C58329F.6010902@redhat.com> In-Reply-To: <4C58329F.6010902@redhat.com> 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 08/03/2010 05:15 PM, Jeff Law wrote: > On 08/03/10 08:09, Bernd Schmidt wrote: >> On 08/02/2010 06:15 PM, Bernd Schmidt wrote: >>> On 08/02/2010 06:05 PM, Jeff Law wrote: >>>> OK. If you could highlight in a quick blurb what changed it'd be >>>> appreciated -- it'll save me from having to look over the whole thing >>>> again to figure out what changed from the previous version. >>> I intend to make the change I previously mentioned to add a per-bb flag >>> which notes it's been modified, so that we can use that on the second >>> pass to decide whether or not to try to optimize it, rather than using >>> df_get_bb_dirty (since that gets cleared on df_analyze). Earlier >>> versions of gcc had a BB_DIRTY bit in bb->flags, I'll reintroduce that >>> as BB_MODIFIED. That's cheaper to test anyway. >>> >>> The other change I'll make is to be slightly more careful wrt. volatile >>> asms, not moving memory references across them. >> Did that, and also fixed a crash I saw with a PPC cross compiler - >> mustn't try to look at insns in EXIT_BLOCK. Note that there's still a >> call to clear_bb_flags which I think is left over from before we were >> using df_get_bb_dirty and now has a purpose again. >> >> New patch below; search for BB_MODIFIED, ASM_OPERANDS and EXIT_BLOCK_PTR >> to find these changes. Also, added the two testcases for i386 as well >> and Paolo's suggestion of a gcc_assert before df_analyze. >> >> Bootstrapped and regression tested on i686-linux. >> >> >> Bernd > The testsuite changes weren't attached to the patch. quilt vs svn problem; now svn added them. > I guess one could ask whether or not we really need to carry a bit in > the BB structure if its only use is head merging -- we could just as > easily have a bitmap indicating what blocks changed that we allocate & > free within cfgcleanup. We have a flags word anyway, so I think using that is the simplest way. That way we also don't have to worry about BB numbers being stable. I'm open to suggestions for a better comment. > I don't see anything which ever clears BB_MODIFIED, so that bit is going > to accumulate in the block over time. That's what I meant when I mentioned the call to clear_bb_flags above. Bernd Index: testsuite/gcc.target/arm/headmerge-1.c =================================================================== --- testsuite/gcc.target/arm/headmerge-1.c (revision 0) +++ testsuite/gcc.target/arm/headmerge-1.c (revision 0) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "#120" 1 } } */ + +extern void foo1 (int); +extern void foo2 (int); + +void t (int x, int y) +{ + if (y < 5) + foo1 (120); + else + foo2 (120); +} Index: testsuite/gcc.target/arm/headmerge-2.c =================================================================== --- testsuite/gcc.target/arm/headmerge-2.c (revision 0) +++ testsuite/gcc.target/arm/headmerge-2.c (revision 0) @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "120" 1 } } */ + +extern void foo1 (int); +extern void foo2 (int); +extern void foo3 (int); +extern void foo4 (int); +extern void foo5 (int); +extern void foo6 (int); + +void t (int x, int y) +{ + switch (y) + { + case 1: + foo1 (120); + break; + case 5: + foo2 (120); + break; + case 7: + foo3 (120); + break; + case 10: + foo4 (120); + break; + case 13: + foo5 (120); + break; + default: + foo6 (120); + break; + } +} Index: testsuite/gcc.target/i386/headmerge-1.c =================================================================== --- testsuite/gcc.target/i386/headmerge-1.c (revision 0) +++ testsuite/gcc.target/i386/headmerge-1.c (revision 0) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "120" 1 } } */ + +extern void foo1 (int); +extern void foo2 (int); + +void t (int x, int y) +{ + if (y < 5) + foo1 (120); + else + foo2 (120); +} Index: testsuite/gcc.target/i386/headmerge-2.c =================================================================== --- testsuite/gcc.target/i386/headmerge-2.c (revision 0) +++ testsuite/gcc.target/i386/headmerge-2.c (revision 0) @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-times "120" 1 } } */ + +extern void foo1 (int); +extern void foo2 (int); +extern void foo3 (int); +extern void foo4 (int); +extern void foo5 (int); +extern void foo6 (int); + +void t (int x, int y) +{ + switch (y) + { + case 1: + foo1 (120); + break; + case 5: + foo2 (120); + break; + case 7: + foo3 (120); + break; + case 10: + foo4 (120); + break; + case 13: + foo5 (120); + break; + default: + foo6 (120); + break; + } +}