Hi,
On Tue, 3 May 2011, Richard Guenther wrote:
> --- 5858,5890 ----
>
> /* If these are the same operation types, we can associate them
> assuming no overflow. */
> ! if (tcode == code)
> ! {
> ! double_int mul;
> ! int overflow_p;
> ! mul = double_int_mul_with_sign
> ! (double_int_ext
> ! (tree_to_double_int (op1),
> ! TYPE_PRECISION (ctype), TYPE_UNSIGNED (ctype)),
> ! double_int_ext
> ! (tree_to_double_int (c),
> ! TYPE_PRECISION (ctype), TYPE_UNSIGNED (ctype)),
> ! false, &overflow_p);
> ! overflow_p = (((!TYPE_UNSIGNED (ctype)
> ! || (TREE_CODE (ctype) == INTEGER_TYPE
> ! && TYPE_IS_SIZETYPE (ctype))) && overflow_p)
> ! | TREE_OVERFLOW (c) | TREE_OVERFLOW (op1));
> ! if (!double_int_fits_to_tree_p (ctype, mul)
> ! && ((TYPE_UNSIGNED (ctype) && tcode != MULT_EXPR)
> ! || (!(TYPE_UNSIGNED (ctype) && tcode != MULT_EXPR)
> ! && (!TYPE_UNSIGNED (ctype)
> ! || (TREE_CODE (ctype) == INTEGER_TYPE
> ! && TYPE_IS_SIZETYPE (ctype))))))
Doubled "(TYPE_UNSIGNED (ctype) && tcode != MULT_EXPR)". Clearer is:
if (!double_int_fits_to_tree_p (ctype, mul)
&& ((TYPE_UNSIGNED (ctype) && tcode != MULT_EXPR)
|| !TYPE_UNSIGNED (ctype)
|| (TREE_CODE (ctype) == INTEGER_TYPE
&& TYPE_IS_SIZETYPE (ctype))))
I've tried to determine if it's otherwise an equivalent transformation but
became confused with your intermediate updating of the overflow_p flag.
The new code sort of makes sense but I can't say if it's exactly what the
old code did :)
Ciao,
Michael.