IVOPT improvement patch

H.J. Lu hjl.tools@gmail.com
Fri Jul 30 17:43:00 GMT 2010


On Fri, Jul 30, 2010 at 9:58 AM, Xinliang David Li <davidxl@google.com> wrote:
> There is a problem in this patch -- when i wraps to zero and terminate
> the loop, the maxoffset computed will be zero which is wrong.
>
> My previous patch won't have this problem.

Your patch changed the start offset.  Here is the updated patch.


H.J.
>
> David
>
> On Fri, Jul 30, 2010 at 9:49 AM, Xinliang David Li <davidxl@google.com> wrote:
>> This looks fine to me -- Zdenek or other reviewers --- is this one ok?
>>
>> Thanks,
>>
>> David
>>
>> On Fri, Jul 30, 2010 at 8:45 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Thu, Jul 29, 2010 at 6:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> It looks strange:
>>>>
>>>> +      width = (GET_MODE_BITSIZE (address_mode) <  HOST_BITS_PER_WIDE_INT - 1)
>>>> +          ? GET_MODE_BITSIZE (address_mode) : HOST_BITS_PER_WIDE_INT - 1;
>>>>       addr = gen_rtx_fmt_ee (PLUS, address_mode, reg1, NULL_RTX);
>>>> -      for (i = start; i <= 1 << 20; i <<= 1)
>>>> +      for (i = 1; i < width; i++)
>>>>        {
>>>> -         XEXP (addr, 1) = gen_int_mode (i, address_mode);
>>>> +          HOST_WIDE_INT offset = (1ll << i);
>>>> +         XEXP (addr, 1) = 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 >= 31. Depending on HOST_WIDE_INT,
>>>>
>>>> HOST_WIDE_INT offset = -(1ll << i);
>>>>
>>>> may have different values. The whole function looks odd to me.
>>>>
>>>>
>>>
>>> Here is a different approach to check address overflow.
>>>
>>>
>>> --
>>> H.J.
>>> --
>>> 2010-07-29  H.J. Lu  <hongjiu.lu@intel.com>
>>>
>>>        PR bootstrap/45119
>>>        * tree-ssa-loop-ivopts.c (get_address_cost): Re-apply revision
>>>        162652.  Check address overflow.
>>>
>>
>



-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-pr45119-3.patch
Type: text/x-csrc
Size: 2483 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100730/744c238a/attachment.bin>


More information about the Gcc-patches mailing list