From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62451 invoked by alias); 19 May 2016 08:56:08 -0000 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 Received: (qmail 62433 invoked by uid 89); 19 May 2016 08:56:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=*6, ending X-HELO: mail-wm0-f43.google.com Received: from mail-wm0-f43.google.com (HELO mail-wm0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 19 May 2016 08:55:53 +0000 Received: by mail-wm0-f43.google.com with SMTP id a17so115241356wme.0 for ; Thu, 19 May 2016 01:55:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-transfer-encoding; bh=MFoWHW5wz2IlVfS8HuiKwOldu4uVrBrk0+RkaQsLZmk=; b=mikTTpmNRSfrzRl6SqjgFYFMkYMekxtOXDJ8JdsiksDuBCx09HhbG+jApANWDdx+iX 0uWoZh2TFn74c3Ipu15GFERo6ZOaeGVC68Gupyy1WYfwLejegap7nqNHpB0RSAbdquw4 KJNWXPj++5pNNEVrU+dmWFZZY45050JJb0eXeSHG1TRbdXFm41HQXXolECVvQH4jT12D ertRAS3boK+ii+v5UZkr6Vcl/BXqx9ldvB5MyZIQ3WIarK4mPnCdVvT707x3doHd/y5M gb3SO2Gzk4+a2ueJgzzjfKUU7vHLTiHmVdxSD4y4geHzDJEJX4oDygmQqVGYj7udHg91 I1qw== X-Gm-Message-State: AOPr4FVzUiN2ExRXIp0XKvt1YUcLwaLsnAfb4y/UKLFlSKrpRmCZLxhgo9hnsizlPDBIPHZZAotWO5grFGWNRg== MIME-Version: 1.0 X-Received: by 10.194.24.38 with SMTP id r6mr11640286wjf.88.1463648150315; Thu, 19 May 2016 01:55:50 -0700 (PDT) Received: by 10.194.87.34 with HTTP; Thu, 19 May 2016 01:55:50 -0700 (PDT) In-Reply-To: <573D78CE.6020900@linaro.org> References: <573D7394.5050208@suse.cz> <573D78CE.6020900@linaro.org> Date: Thu, 19 May 2016 08:56:00 -0000 Message-ID: Subject: Re: [PATCH] Fix PR tree-optimization/71170 From: Richard Biener To: Kugan Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , GCC Patches Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg01448.txt.bz2 On Thu, May 19, 2016 at 10:26 AM, Kugan wrote: > Hi, > > > On 19/05/16 18:21, Richard Biener wrote: >> On Thu, May 19, 2016 at 10:12 AM, Kugan Vivekanandarajah >> wrote: >>> Hi Martin, >>> >>> Thanks for the fix. Just to elaborate (as mentioned in PR) >>> >>> At tree-ssa-reassoc.c:3897, we have: >>> >>> stmt: >>> _15 =3D _4 + c_7(D); >>> >>> oe->op def_stmt: >>> _17 =3D c_7(D) * 3; >>> >>> >>> : >>> a1_6 =3D s_5(D) * 2; >>> _1 =3D (long int) a1_6; >>> x1_8 =3D _1 + c_7(D); >>> a2_9 =3D s_5(D) * 4; >>> _2 =3D (long int) a2_9; >>> a3_11 =3D s_5(D) * 6; >>> _3 =3D (long int) a3_11; >>> _16 =3D x1_8 + c_7(D); >>> _18 =3D _1 + _2; >>> _4 =3D _16 + _2; >>> _15 =3D _4 + c_7(D); >>> _17 =3D c_7(D) * 3; >>> x_13 =3D _15 + _3; >>> return x_13; >>> >>> >>> The root cause of this the place in which we are adding (_17 =3D c_7(D) >>> * 3). Finding the right place is not always straightforward as this >>> case shows. >>> >>> We could try Martin Li=C5=A1ka's approach, We could also move _17 =3D = c_7(D) >>> * 3; at tree-ssa-reassoc.c:3897 satisfy the gcc_assert. We could do >>> this based on the use count of _17. >>> >>> >>> This patch does this. I have no preferences. Any thoughts ? >> >> I think the issue may be that you fail to set changed to true for the >> degenerate case of ending up with a multiply only. >> >> Not sure because neither patch contains a testcase. >> > > Sorry, I should have been specific. There is an existing test-case that > is failing. Thats why I didn't include a test case. > > FAIL: gcc.dg/tree-ssa/slsr-30.c (internal compiler error) Btw, it also looks like ops are not sorted after rank: (gdb) p ops.m_vec->m_vecdata[0] $4 =3D (operand_entry *) 0x27a82e0 (gdb) p ops.m_vec->m_vecdata[1] $5 =3D (operand_entry *) 0x27a82a0 (gdb) p ops.m_vec->m_vecdata[2] $6 =3D (operand_entry *) 0x27a8260 (gdb) p ops.m_vec->m_vecdata[3] $7 =3D (operand_entry *) 0x27a8300 (gdb) p *$4 $8 =3D {rank =3D 7, id =3D 5, op =3D , count =3D 1} (gdb) p *$5 $9 =3D {rank =3D 5, id =3D 3, op =3D , count =3D 1} (gdb) p *$6 $10 =3D {rank =3D 7, id =3D 1, op =3D , count =3D = 1} (gdb) p *$7 $11 =3D {rank =3D 7, id =3D 6, op =3D , count =3D = 1} Richard. > > Thanks, > Kugan