From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30419 invoked by alias); 30 Jul 2010 01:04:15 -0000 Received: (qmail 30411 invoked by uid 22791); 30 Jul 2010 01:04:14 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Jul 2010 01:04:09 +0000 Received: by vws13 with SMTP id 13so948012vws.20 for ; Thu, 29 Jul 2010 18:04:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.168.10 with SMTP id s10mr628343vcy.50.1280451846967; Thu, 29 Jul 2010 18:04:06 -0700 (PDT) Received: by 10.220.182.135 with HTTP; Thu, 29 Jul 2010 18:04:06 -0700 (PDT) In-Reply-To: References: <20100525235926.GA3326@kam.mff.cuni.cz> <20100527075632.GA12991@kam.mff.cuni.cz> <20100528085052.GA3423@kam.mff.cuni.cz> <20100529152243.GA18706@kam.mff.cuni.cz> <20100529191446.GA3996@kam.mff.cuni.cz> <20100604105451.GB5105@kam.mff.cuni.cz> Date: Fri, 30 Jul 2010 02:06:00 -0000 Message-ID: Subject: Re: IVOPT improvement patch From: "H.J. Lu" To: Xinliang David Li Cc: Richard Guenther , Pat Haugen , GCC Patches , Zdenek Dvorak 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: 2010-07/txt/msg02308.txt.bz2 It looks strange: + width =3D (GET_MODE_BITSIZE (address_mode) < HOST_BITS_PER_WIDE_INT= - 1) + ? GET_MODE_BITSIZE (address_mode) : HOST_BITS_PER_WIDE_INT - 1; addr =3D gen_rtx_fmt_ee (PLUS, address_mode, reg1, NULL_RTX); - for (i =3D start; i <=3D 1 << 20; i <<=3D 1) + for (i =3D 1; i < width; i++) { - XEXP (addr, 1) =3D gen_int_mode (i, address_mode); + HOST_WIDE_INT offset =3D (1ll << i); + XEXP (addr, 1) =3D gen_int_mode (offset, address_mode); if (!memory_address_addr_space_p (mem_mode, addr, as)) break; } HOST_WIDE_INT may be long or long long. "1ll" isn't always correct. I think width can be >=3D 31. Depending on HOST_WIDE_INT, HOST_WIDE_INT offset =3D -(1ll << i); may have different values. The whole function looks odd to me. H.J. ---- On Thu, Jul 29, 2010 at 5:55 PM, Xinliang David Li wro= te: > Please take a look at the following patch -- it is less conservative > than before and also does not lead to infinite loop (due to integer > overflow). > > Testing is under going. Ok for trunk after that is done? > > Thanks, > > David > > On Thu, Jul 29, 2010 at 9:51 AM, H.J. Lu wrote: >> On Thu, Jul 29, 2010 at 9:16 AM, Richard Guenther >> wrote: >>> On Thu, Jul 29, 2010 at 6:00 PM, H.J. Lu wrote: >>>> On Thu, Jul 29, 2010 at 8:22 AM, H.J. Lu wrote: >>>>> On Wed, Jul 28, 2010 at 9:32 PM, Xinliang David Li wrote: >>>>>> The attached patch should fix the problem -- it reverts a small part >>>>>> of the last patch that is needed for fixing sixtrack performance >>>>>> regression caused by wrong iv-use costs because address offset range >>>>>> is conservatively computed. I will revert the change first and >>>>>> investigate better fix (Suggestions are welcome). >>>>>> >>>>> >>>>> Since "gcc -m32" works on Linux/x86-64 and goes into an infinite loop, >>>>> it sounds like a HOST_WIDE_INT issue. >>>>> >>>> >>>> This patch fixed the infinite loop. >>> >>> That doesn't make sense. =A0Please use double_ints instead. >>> >>> Richard. >> >> I am not familiar wit this code. I will leave it to David. >> >> >> H.J. >> --- >>>> >>>> -- >>>> H.J. >>>> diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c >>>> index 519f66e..44f2eb2 100644 >>>> --- a/gcc/tree-ssa-loop-ivopts.c >>>> +++ b/gcc/tree-ssa-loop-ivopts.c >>>> @@ -3207,7 +3207,7 @@ multiplier_allowed_in_address_p (HOST_WIDE_INT >>>> ratio, enum machine_mode mode, >>>> >>>> =A0typedef struct >>>> =A0{ >>>> - =A0HOST_WIDE_INT min_offset, max_offset; >>>> + =A0HOST_WIDEST_INT min_offset, max_offset; >>>> =A0 unsigned costs[2][2][2][2]; >>>> =A0} *address_cost_data; >>>> >>>> @@ -3240,9 +3240,9 @@ get_address_cost (bool symbol_present, bool var_= present, >>>> =A0 data =3D VEC_index (address_cost_data, address_cost_data_list, dat= a_index); >>>> =A0 if (!data) >>>> =A0 =A0 { >>>> - =A0 =A0 =A0HOST_WIDE_INT i; >>>> - =A0 =A0 =A0HOST_WIDE_INT start =3D BIGGEST_ALIGNMENT / BITS_PER_UNIT; >>>> - =A0 =A0 =A0HOST_WIDE_INT rat, off; >>>> + =A0 =A0 =A0HOST_WIDEST_INT i; >>>> + =A0 =A0 =A0HOST_WIDEST_INT start =3D BIGGEST_ALIGNMENT / BITS_PER_UN= IT; >>>> + =A0 =A0 =A0HOST_WIDEST_INT rat, off; >>>> =A0 =A0 =A0 int old_cse_not_expected, width; >>>> =A0 =A0 =A0 unsigned sym_p, var_p, off_p, rat_p, add_c; >>>> =A0 =A0 =A0 rtx seq, addr, base; >>>> >>> >> >> >> >> -- >> H.J. >> > --=20 H.J.