[PATCH, ivopts] Handle type-converted IVs better

Adam Nemet anemet@caviumnetworks.com
Tue Sep 19 07:24:00 GMT 2006


Zdenek Dvorak writes:
> >   (int) ((unsigned int) (data_offset_5 + 2)
> >          - (unsigned int) data_offset_5
> >          + (unsigned int) data_offset_11 - 1)
> > 
> > Instead of trying to fold this which I am not even sure is valid in
> > the generic case (can we remove overflows?)
> 
> under most circumstances, the answer is yes (as long as you do not
> create new overflowing expressions);  the only case when the answer
> might be no is with -ftrapv, but that probably should not apply for
> expressions generated by compiler anyway.

But the same code is used to deal with uses of original IVs in which
case the expression is not really generated by the compiler.

> 1) using the following patch (that enables you to use affine
>    combinations even with types whose values do not fit in
>    HOST_WIDE_INT)
>    http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00345.html,
>    and
> 
> 2) making get_computation_aff work in double_ints instead of
>    HOST_WIDE_INTs.
> 
> With this cleanup (and possibly a minor change similar to your
> aff_combination_convert), you should be able to get the required folding
> easily

Why do you think that moving over to double_ints would help my case?
The problem is not that we fail to use affine combinations but that we
fail to fold the result when adding the affine combination for cbase
(-1 * (unsigned int) data_offset_5) to ubase ((unsigned int)
(data_offset_5 + 2)) in get_computation_aff.

Adam



More information about the Gcc-patches mailing list