IVOPT improvement patch

H.J. Lu hjl.tools@gmail.com
Thu Dec 30 17:23:00 GMT 2010


On Sat, May 29, 2010 at 3:20 PM, Xinliang David Li <davidxl@google.com> wrote:
> patch-1 ok for this revision?
>
> David
>
> On Sat, May 29, 2010 at 12:14 PM, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote:
>> Hi,
>>
>>> >> > Also, note that for loops with one exit, your change actually makes the test weaker.
>>> >> > For instance, before your change, we could deduce that
>>> >> >
>>> >> > int a[100];
>>> >> > for (i = 0; i < n; i++)
>>> >> >  a[i] = i;
>>> >> >
>>> >> > iterates at most 100 times.
>>> >>
>>> >> Fixed and added two test cases.
>>> >>
>>> >> (Note -- one more bug in the original code was found and fixed -- the
>>> >> period computation is wrong when step is not power of 2).
>>> >
>>> > that is wrong, the original computation is correct.  If step is (e.g.) odd,
>>> > then it takes (range of type) iterations before the variable achieves the same
>>> > value (that it overflows in the meantime several times does not matter, since
>>> > we are careful to use the type in that overflow has defined semantics, and
>>> > we test for equality in the replacement condition),
>>>
>>> The overflow semantics is indeed different -- it is also true for any
>>> iv cand with non zero base. The period is really LCM (type_range,
>>> step)/step - 1 --- the computation in original code matches this --
>>> but the comment seems wrong.
>>
>> yes, the comment needs to be fixed,
>>
>> Zdenek
>>
>

This patch caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47028


-- 
H.J.



More information about the Gcc-patches mailing list