From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6354 invoked by alias); 27 Sep 2011 07:30:33 -0000 Received: (qmail 6316 invoked by uid 22791); 27 Sep 2011 07:30:29 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW,TW_OV X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Sep 2011 07:30:13 +0000 Received: by gyg8 with SMTP id 8so5493522gyg.20 for ; Tue, 27 Sep 2011 00:30:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.237.21 with SMTP id k21mr6764927ybh.10.1317108612493; Tue, 27 Sep 2011 00:30:12 -0700 (PDT) Received: by 10.150.177.4 with HTTP; Tue, 27 Sep 2011 00:30:12 -0700 (PDT) In-Reply-To: <4E80AB90.6060201@redhat.com> References: <4e3762ed.030d440a.1143.2af2SMTPIN_ADDED@mx.google.com> <4e72add8.c9d0e30a.142a.ffffe60eSMTPIN_ADDED@mx.google.com> <4e802c3d.94ebd80a.4b1f.ffff8101SMTPIN_ADDED@mx.google.com> <4E80AB90.6060201@redhat.com> Date: Tue, 27 Sep 2011 13:44:00 -0000 Message-ID: Subject: Re: A case that PRE optimization hurts performance From: Richard Guenther To: Jeff Law Cc: Jiangning Liu , gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00339.txt.bz2 On Mon, Sep 26, 2011 at 6:42 PM, Jeff Law wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 09/26/11 05:00, Richard Guenther wrote: >> On Mon, Sep 26, 2011 at 9:39 AM, Jiangning Liu >> wrote: >>>>> * Without PRE, >>>>> >>>>> Path1: movl =A0 =A0$2, %eax cmpl =A0 =A0$1, %eax je =A0 =A0 =A0.L3 >>>>> >>>>> Path2: movb =A0 =A0$3, %al cmpl =A0 =A0$1, %eax je =A0 =A0 =A0.L3 >>>>> >>>>> Path3: cmpl =A0 =A0$1, %eax jne =A0 =A0 .L14 >>>>> >>>>> * With PRE, >>>>> >>>>> Path1: movl =A0 =A0$1, %ebx movl =A0 =A0$2, %eax testb =A0 %bl, %bl je >>>>> .L3 >>>>> >>>>> Path2: movl =A0 =A0$1, %ebx movb =A0 =A0$3, %al testb =A0 %bl, %bl je >>>>> .L3 >>>>> >>>>> Path3: cmpl =A0 =A0$1, %eax setne =A0 %bl testb =A0 %bl, %bl jne >>>>> .L14 >>>>> >>>>> Do you have any more thoughts? >>>> >>>> It seems to me that with PRE all the testb %bl, %bl should be >>>> evaluated at compile-time considering the preceeding movl $1, >>>> %ebx. =A0Am I missing something? >>>> >>> >>> Yes. Can this be done by PRE or any other optimizations in middle >>> end? >> >> Hm, the paths as you quote them are obfuscated by missed >> jump-threading. On the tree level we have >> >> # s_2 =3D PHI <2(5), 3(4), 2(6), s_25(7)> # prephitmp.6_1 =3D PHI >> <1(5), 1(4), 1(6), prephitmp.6_3(7)> : t_14 =3D t_24 + 1; >> D.2729_6 =3D MEM[base: t_14, offset: 0B]; D.2732_7 =3D D.2729_6 !=3D 0; >> D.2734_9 =3D prephitmp.6_1 & D.2732_7; if (D.2734_9 !=3D 0) >> >> where we could thread the cases with prephitmp.6_1 =3D=3D 1, >> ultimately removing the & and forwarding the D.2729_6 !=3D 0 test. >> Which would of course cause some code duplication. >> >> Jeff, you recently looked at tree jump-threading, can you see if >> we can improve things on this particular testcase? > There's nothing threading can do here because it doesn't know anything > about the value MEM[t14]. It knows something about prephitmp.6_1 and thus could simplify D.2734_9 =3D prephitmp_6.1 & D.2732_7; to D.2734_9 =3D D.2732_7; But admittedly I have no idea if DOM tries to simplify things other than comparisons within the jump threading machinery ... (the above block basically ends in if (D.2729_6 !=3D 0 && prephitmp_6.1), so I'd guess it's worth to simplify the (complex) conditional expression). Richard. > > Jeff > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJOgKuLAAoJEBRtltQi2kC75aIH/iikuOQXrMrQJFbQw0COXznB > OGq8iXdGwTJGH13vxdItTE0upJp7RgUVLzuhdqj1elTLHv/ujYygMsQRNGKcc8tb > GMLECmWDhZqQTFXcTJCgJNZiv7MH1PNELXSdIkkSnxY+pwyn9AX5D3+HcTSjGU6B > 51AdUNVph/VSaVboAgcrFpu9S0pX9HVTqFy4JI83Lh613zDVSmPo14DDy7vjBvE9 > 2Srlvlw0srYup97bGmRqN8wT4ZLLlyYSB2rjEFc6jmgXVncxiteQYIUZpy0lcC0M > q3j80aXjZ57/iWyAbqDr1jI5tbVKDBkRa9LL1jvn9534adiG4GrnSMPhoog0ibA=3D > =3Dazr5 > -----END PGP SIGNATURE----- >