On 02/09/2017 08:06 PM, Jeff Law wrote:
+ && *vr0min == *vr0max
+ && integer_zerop (*vr0min)
+ && TREE_CODE (vr1max) == INTEGER_CST
+ && TREE_CODE (vr1min) == INTEGER_CST
+ && difference_larger_than (vr1max, vr1min, 65536))
+ ;
in the case that interests us for the PR what is vr1?
[-2305843009213693952, 2305843009213693951]
And just for completeness, I instrumented the compiler to dump the range
every time this code triggered to see what kind of ranges we'd be
changing into ~[0,0].
It triggers 1260 times during a bootstrap. 20 most common:
20 [-1073741824,1073741823]
20 [-65535,65535]
22 [-2147483647,2147483646]
23 [-1152921504606846976,1152921504606846975]
24 [-2147483648,39]
24 [-72057594037927936,72057594037927935]
24 [-8388608,8388607]
27 [-536870912,536870911]
28 [-2305843009213693952,2305843009213693951]
28 [-536870910,536870910]
32 [-2147483648,113]
41 [-2147483648,32767]
48 [-1,2147483646]
48 [-2147483647,2147483647]
48 [-2147483648,63]
48 [-9223372036854775807,9223372036854775807]
53 [-214748364,214748364]
70 [-2147483648,1]
160 [-2147483648,2147483647]
162 [-2147483648,2147483646]
Obviously it's harder to know how many of those ultimately lead to
optimizing something better.
With your heuristic we get 378 triggers with the most common being:
17 [-2147483648,113]
17 [-9223372036854775808,9223372036854775806]
18 [-1,2147483646]
18 [-2147483648,32767]
23 [-1152921504606846976,1152921504606846975]
24 [-72057594037927936,72057594037927935]
27 [-536870912,536870911]
28 [-2305843009213693952,2305843009213693951]
45 [-2147483648,2147483646]
48 [-9223372036854775807,9223372036854775807]
Anyway, I'll do the usual testing with your version.
jeff