On Tue, 18 Jul 2017, Jakub Jelinek wrote:
In the PR Marc noted that the optimization might be useful even for constants other than 1, by transforming x+C1 <= C2 if unsigned and C2-C1==INT_MAX into (int)x > (int)(-1-C1).
(int)x >= (int)(-C1) might be easier (and more valid, except that the only case where that makes a difference seems to be when C2==UINT_MAX, in which case we could hope not to reach this transformation).
Shall I do that immediately, or incrementally?
I vote for "incremental", unless someone finds an issue with your current patch.
Shall we also change build_range_check to do that (i.e. drop the integer_onep above and use right etype constant?
I would rather consider build_range_check legacy and avoid modifying it too much, but if you are motivated...
+ && TYPE_PRECISION (TREE_TYPE (@0)) > 1
I see you've been bitten in the past ;-) -- Marc Glisse