Hi, On Fri, 8 Jul 2011, Richard Guenther wrote:
> It should be indeed safe with the current handling of conversions, but > better be safe. So, like the following? No. The point is that you can't compare the bounds that VRP computes with each other when the outcome affects correctness. Think about a very trivial and stupid VRP, that assigns the range [WIDEST_INT_MIN .. WIDEST_UINT_MAX] to each and every SSA name without looking at types and operations at all (assuming that this reflects the largest int type on the target). It's useless but correct. Of course we wouldn't implement such useless range discovery, but similar situations can arise when some VRP algorithms give up for certain reasons, or computation of tight bounds merely isn't implemented for some operations. Your routines need to work also in the presence of such imprecise ranges. Hence, the check that the intermediate conversion is useless needs to take into account the input value range (that's conservatively correct), and the precision and signedness of the target type (if it can represent all value of the input range the conversion was useless). It must not look at the suspected value range of the destination, precisely because it is conservative only. Ciao, Michael.