Kai Henningsen wrote:

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.

right, i agree completely with this analysis, very nice clear
statement. Now how difficult is this to implement?

Reply via email to