tree-chrec.c (chrec_convert_aggressive): Do not eliminate conversions where TYPE_MIN_VALUE/TYPE_MAX_VALUE do not cover...

* tree-chrec.c (chrec_convert_aggressive): Do not eliminate
        conversions where TYPE_MIN_VALUE/TYPE_MAX_VALUE do not cover
        the range allowed by TYPE_PRECISION.

From-SVN: r111568
This commit is contained in:
Jeff Law 2006-02-28 09:49:12 -07:00 committed by Jeff Law
parent ea45681a7a
commit e5c7f9f582
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2006-02-28 Jeff Law <law@redhat.com>
* tree-chrec.c (chrec_convert_aggressive): Do not eliminate
conversions where TYPE_MIN_VALUE/TYPE_MAX_VALUE do not cover
the range allowed by TYPE_PRECISION.
* tree.h (strct phi_arg_d): Remove unused NONZERO field.
2006-02-28 Dorit Nuzman <dorit@il.ibm.com>

View File

@ -1219,6 +1219,26 @@ chrec_convert_aggressive (tree type, tree chrec)
if (!rc)
rc = chrec_convert (type, right, NULL_TREE);
/* Ada creates sub-types where TYPE_MIN_VALUE/TYPE_MAX_VALUE do not
cover the entire range of values allowed by TYPE_PRECISION.
We do not want to optimize away conversions to such types. Long
term I'd rather see the Ada front-end fixed. */
if (INTEGRAL_TYPE_P (type))
{
tree t;
t = upper_bound_in_type (type, inner_type);
if (! TYPE_MAX_VALUE (type)
|| ! operand_equal_p (TYPE_MAX_VALUE (type), t, 0))
return NULL_TREE;
t = lower_bound_in_type (type, inner_type);
if (! TYPE_MIN_VALUE (type)
|| ! operand_equal_p (TYPE_MIN_VALUE (type), t, 0))
return NULL_TREE;
}
return build_polynomial_chrec (CHREC_VARIABLE (chrec), lc, rc);
}