From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25712 invoked by alias); 25 Jul 2011 11:26:53 -0000 Received: (qmail 25702 invoked by uid 22791); 25 Jul 2011 11:26:52 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gw0-f47.google.com (HELO mail-gw0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jul 2011 11:26:35 +0000 Received: by gwb11 with SMTP id 11so2911005gwb.20 for ; Mon, 25 Jul 2011 04:26:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.51.10 with SMTP id d10mr4149002ybk.330.1311593193389; Mon, 25 Jul 2011 04:26:33 -0700 (PDT) Received: by 10.150.205.2 with HTTP; Mon, 25 Jul 2011 04:26:33 -0700 (PDT) In-Reply-To: References: <201107250910.p6P9AeaS014391@d06av02.portsmouth.uk.ibm.com> Date: Mon, 25 Jul 2011 13:07:00 -0000 Message-ID: Subject: Re: [patch] Fix PR tree-optimization/49771 From: Richard Guenther To: Ira Rosen Cc: Ulrich Weigand , gcc-patches@gcc.gnu.org, Patch Tracking Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2011-07/txt/msg02133.txt.bz2 On Mon, Jul 25, 2011 at 1:15 PM, Richard Guenther wrote: > On Mon, Jul 25, 2011 at 1:09 PM, Ira Rosen wrote: >> On 25 July 2011 13:57, Richard Guenther wro= te: >>> On Mon, Jul 25, 2011 at 12:52 PM, Ira Rosen wrot= e: >>>> On 25 July 2011 12:39, Richard Guenther w= rote: >>>>> On Mon, Jul 25, 2011 at 11:10 AM, Ulrich Weigand wrote: >>>>>> Richard Guenther wrote: >>>>>>> On Sun, Jul 24, 2011 at 2:02 PM, Ira Rosen w= rote: >>>>>>> > On 21 July 2011 15:19, Ira Rosen wrote: >>>>>>> >> I reproduced the failure. It occurs without Richard's >>>>>>> >> (http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01022.html) and th= is >>>>>>> >> patches too. Obviously the vectorized loop is executed, but at t= he >>>>>>> >> moment I don't understand why. I'll have a better look on Sunday. >>>>>>> > >>>>>>> > Actually it doesn't choose the vectorized code. But the scalar ve= rsion >>>>>>> > gets optimized in a harmful way for SPU, AFAIU. >>>>>>> > Here is the scalar loop after vrp2 >>>>>>> > >>>>>>> > : >>>>>>> > =A0# ivtmp.42_50 =3D PHI >>>>>>> > =A0D.4593_42 =3D (void *) ivtmp.53_32; >>>>>>> > =A0D.4520_33 =3D MEM[base: D.4593_42, offset: 0B]; >>>>>>> > =A0D.4521_34 =3D D.4520_33 + 1; >>>>>>> > =A0MEM[symbol: a, index: ivtmp.42_50, offset: 0B] =3D D.4521_34; >>>>>>> > =A0ivtmp.42_45 =3D ivtmp.42_50 + 4; >>>>>>> > =A0if (ivtmp.42_45 !=3D 16) >>>>>>> > =A0 =A0goto ; >>>>>>> > =A0else >>>>>>> > =A0 =A0goto ; >>>>>>> > >>>>>>> > and the load is changed by dom2 to: >>>>>>> > >>>>>>> > : >>>>>>> > =A0... >>>>>>> > =A0D.4520_33 =3D MEM[base: vect_pa.9_19, offset: 0B]; >>>>>>> > =A0 ... >>>>>>> > >>>>>>> > where vector(4) int * vect_pa.9; >>>>>>> > >>>>>>> > And the scalar loop has no rotate for that load: >>>>>>> >>>>>>> Hum. =A0This smells like we are hiding sth from the tree optimizers? >>>>>> >>>>>> Well, the back-end assumes a pointer to vector type is always >>>>>> naturally aligned, and therefore the data it points to can be >>>>>> accessed via a simple load, with no extra rotate needed. >>>>> >>>>> I can't see any use of VECTOR_TYPE in config/spu/, and assuming >>>>> anything about alignment just because of the kind of the pointer >>>>> is bogus - the scalar code does a scalar read using that pointer. >>>>> So the backend better should look at the memory operation, not >>>>> at the pointer type. =A0That said, I can't find any code that looks >>>>> suspicious in the spu backend. >>>>> >>>>>> It seems what happened here is that somehow, a pointer to int >>>>>> gets replaced by a pointer to vector, even though their alignment >>>>>> properties are different. >>>>> >>>>> No, they are not. =A0They get replaced if they are value-equivalent >>>>> in which case they are also alignment-equivalent. =A0But well, the >>>>> dump snippet wasn't complete and I don't feel like building a >>>>> SPU cross to verify myself. >>>> >>>> I am attaching the complete file. >>> >>> The issue seems to be that the IV in question, vect_pa.9_19, is >>> defined as >>> >>> =A0vect_pa.9_19 =3D (vector(4) int *) ivtmp.53_32; >>> >>> but ivtmp.53_32 does not have a definition at all. >>> >> >> I am sorry, it's my fault, resending the file. > > Seems perfectly valid to me. =A0Or well - I suppose we might run into > the issue that the vectorizer sets alignment data at the wrong spot? > You can check alignment info when dumping with the -alias flag. > Building a spu cross now. Nope, all perfectly valid. > Richard. >