This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 10 Feb 2017 16:40:30 -0700
- Subject: Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2
- Authentication-results: sourceware.org; auth=none
- References: <c79e6794-5688-900d-4b66-d65a588373cc@redhat.com> <CAFiYyc3yYez5FUq0-+moRznnGV5pk53uyEh=a72RJdR2nGokEA@mail.gmail.com> <32351b14-f7e6-da07-d601-e0a481f10410@redhat.com>
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