From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7927 invoked by alias); 1 May 2007 23:15:16 -0000 Received: (qmail 7877 invoked by uid 22791); 1 May 2007 23:15:15 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.169) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 01 May 2007 23:15:13 +0000 Received: by ug-out-1314.google.com with SMTP id s2so104820uge for ; Tue, 01 May 2007 16:15:10 -0700 (PDT) Received: by 10.67.115.11 with SMTP id s11mr653153ugm.1178061309763; Tue, 01 May 2007 16:15:09 -0700 (PDT) Received: by 10.67.17.1 with HTTP; Tue, 1 May 2007 16:15:09 -0700 (PDT) Message-ID: Date: Tue, 01 May 2007 23:15:00 -0000 From: "Andrew Pinski" To: "Richard Guenther" Subject: Re: [PATCH] Fix PR 29715, fold produces &a - 4 Cc: "Andrew_Pinski@playstation.sony.com" , gcc-patches@gcc.gnu.org In-Reply-To: <84fc9c000703010206k37130468m911357497f4ec78@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_293839_20751752.1178061309679" References: <84fc9c000703010206k37130468m911357497f4ec78@mail.gmail.com> X-IsSubscribed: yes 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: 2007-05/txt/msg00065.txt.bz2 ------=_Part_293839_20751752.1178061309679 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1032 On 3/1/07, Richard Guenther wrote: > This optimization doesn't look too useful at all now that we gimplify all this > post/preinc/decrement anyway. This is actually the only place where we look > at this operators in fold, so I suggest removing the whole > transformation instead. Like this? I agree that this is no longer needed as we do gimplification and then optimize it later if we can (though sometimes we don't because we don't recombined the PLUS with the comparision but that is not actually tested :) ). This is not the first time this code has bought troubles: http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00582.html http://gcc.gnu.org/ml/gcc-patches/2000-07/msg00575.html http://gcc.gnu.org/ml/gcc-patches/2004-03/msg02369.html This was bootstrapped and tested many times on powerpc64-linux-gnu with no regressions and built and tested for spu-elf with no regressions. Thanks, Andrew Pinski ChangeLog: * fold-const.c (fold_comparision): Remove the "foo++ == CONST" transformation. ------=_Part_293839_20751752.1178061309679 Content-Type: text/plain; name=fixfold.diff.txt; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_f16yz67c Content-Disposition: attachment; filename="fixfold.diff.txt" Content-length: 3701 SW5kZXg6IGZvbGQtY29uc3QuYwo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0t LSBmb2xkLWNvbnN0LmMJKHJldmlzaW9uIDEyNDM0MykKKysrIGZvbGQtY29u c3QuYwkod29ya2luZyBjb3B5KQpAQCAtODY0OSw2OSArODY0OSw2IEBAIGZv bGRfY29tcGFyaXNvbiAoZW51bSB0cmVlX2NvZGUgY29kZSwgdHIKIAl9CiAg ICAgfQogCi0gIC8qIENvbnZlcnQgZm9vKysgPT0gQ09OU1QgaW50byArK2Zv byA9PSBDT05TVCArIElOQ1IuICAqLwotICBpZiAoVFJFRV9DT05TVEFOVCAo YXJnMSkKLSAgICAgICYmIChUUkVFX0NPREUgKGFyZzApID09IFBPU1RJTkNS RU1FTlRfRVhQUgotCSAgfHwgVFJFRV9DT0RFIChhcmcwKSA9PSBQT1NUREVD UkVNRU5UX0VYUFIpCi0gICAgICAvKiBUaGlzIG9wdGltaXphdGlvbiBpcyBp bnZhbGlkIGZvciBvcmRlcmVkIGNvbXBhcmlzb25zCi0gICAgICAgICBpZiBD T05TVCtJTkNSIG92ZXJmbG93cyBvciBpZiBmb28raW5jciBtaWdodCBvdmVy Zmxvdy4KLQkgVGhpcyBvcHRpbWl6YXRpb24gaXMgaW52YWxpZCBmb3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