PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VA
Kai Henningsen
kaih@khms.westfalen.de
Fri Aug 12 22:19:00 GMT 2005
kenner@vlsi1.ultra.nyu.edu (Richard Kenner) wrote on 12.08.05 in <10508121750.AA15217@vlsi1.ultra.nyu.edu>:
> What has to happen is that we need some sort of way of indicating that it's
> not permissible to derive information through a particular conversion.
That may be the only practical solution, but it seems to me it's not the
perfect solution.
The point is that there are two different kinds of value range
calculations. You have value range information from program flow, and you
have value range information from types.
You want 'Valid optimization to ignore range information from types,
because that's what you're checking for in the first place.
On the other hand, you *want* to use range information from program flow.
For example, if you just assigned a constant, you *know* the exact range
of the thing. Or maybe you already passed a program point where any out-of-
range value would have been caught by an implicit 'Valid. It could
optimize away a lot of implicit 'Valid checks done, say, on the same
variable used as an array index multiple times.
Now that is certainly nontrivial to implement, and may not be worth it for
gcc. But I believe it would be better than the other way.
MfG Kai
More information about the Gcc
mailing list