Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-16 Thread Richard Biener
On Tue, Feb 14, 2017 at 10:41 PM, Jeff Law wrote: > On 02/14/2017 01:58 AM, Richard Biener wrote: >>> >>> >>> I spoke with Andrew a bit today, he's consistently seeing cases where the >>> union of 3 ranges is necessary to resolve the kinds of queries we're >>> interested in.

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-14 Thread Jeff Law
On 02/14/2017 01:58 AM, Richard Biener wrote: I spoke with Andrew a bit today, he's consistently seeing cases where the union of 3 ranges is necessary to resolve the kinds of queries we're interested in. He's made a design decision not to use anti-ranges in his work, so y'all are in sync on

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V3

2017-02-14 Thread Richard Biener
On Tue, Feb 14, 2017 at 7:53 AM, Jeff Law wrote: > > This is the first patch in the series with Richi's comments from last week > addressed. #2, #3 and #4 were unchanged. > > Richi asked for the EXACT_DIV_EXPR handling in > extract_range_from_binary_exit_1 to move out one IF

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-14 Thread Marc Glisse
On Mon, 13 Feb 2017, Jeff Law wrote: On 02/13/2017 09:15 AM, Marc Glisse wrote: On Mon, 13 Feb 2017, Jeff Law wrote: On 02/12/2017 12:13 AM, Marc Glisse wrote: On Tue, 7 Feb 2017, Jeff Law wrote: * tree-vrp.c (extract_range_from_binary_expr_1): For EXACT_DIV_EXPR, if the numerator has the

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-14 Thread Richard Biener
On Tue, Feb 14, 2017 at 12:19 AM, Jeff Law wrote: > On 02/07/2017 01:39 AM, Richard Biener wrote: >> >> On Mon, Feb 6, 2017 at 10:57 PM, Jeff Law wrote: >>> >>> On 02/06/2017 08:33 AM, Richard Biener wrote: >>> ah, indeed vr0type is VR_ANTI_RANGE and yes we

[RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V3

2017-02-13 Thread Jeff Law
This is the first patch in the series with Richi's comments from last week addressed. #2, #3 and #4 were unchanged. Richi asked for the EXACT_DIV_EXPR handling in extract_range_from_binary_exit_1 to move out one IF conditional nesting level. Richi noted that the use of

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-13 Thread Jeff Law
On 02/07/2017 01:39 AM, Richard Biener wrote: On Mon, Feb 6, 2017 at 10:57 PM, Jeff Law wrote: On 02/06/2017 08:33 AM, Richard Biener wrote: ah, indeed vr0type is VR_ANTI_RANGE and yes we have the case of a range with an anti-range "inside". This also covers [-1,1] v ~[0,0]

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-13 Thread Jeff Law
On 02/13/2017 09:15 AM, Marc Glisse wrote: On Mon, 13 Feb 2017, Jeff Law wrote: On 02/12/2017 12:13 AM, Marc Glisse wrote: On Tue, 7 Feb 2017, Jeff Law wrote: * tree-vrp.c (extract_range_from_binary_expr_1): For EXACT_DIV_EXPR, if the numerator has the range ~[0,0] make the resultant range

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-13 Thread Marc Glisse
On Mon, 13 Feb 2017, Jeff Law wrote: On 02/12/2017 12:13 AM, Marc Glisse wrote: On Tue, 7 Feb 2017, Jeff Law wrote: * tree-vrp.c (extract_range_from_binary_expr_1): For EXACT_DIV_EXPR, if the numerator has the range ~[0,0] make the resultant range ~[0,0]. If I understand correctly, for x

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-13 Thread Jeff Law
On 02/12/2017 12:13 AM, Marc Glisse wrote: On Tue, 7 Feb 2017, Jeff Law wrote: * tree-vrp.c (extract_range_from_binary_expr_1): For EXACT_DIV_EXPR, if the numerator has the range ~[0,0] make the resultant range ~[0,0]. If I understand correctly, for x /[ex] 4 with x!=0, we currently split

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-11 Thread Marc Glisse
On Tue, 7 Feb 2017, Jeff Law wrote: * tree-vrp.c (extract_range_from_binary_expr_1): For EXACT_DIV_EXPR, if the numerator has the range ~[0,0] make the resultant range ~[0,0]. If I understand correctly, for x /[ex] 4 with x!=0, we currently split ~[0,0] into [INT_MIN,-1] and [1,INT_MAX],

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-10 Thread Jeff Law
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

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-10 Thread Richard Biener
On Fri, Feb 10, 2017 at 4:06 AM, Jeff Law wrote: > On 02/08/2017 05:45 AM, Richard Biener wrote: >> >> On Tue, Feb 7, 2017 at 7:31 PM, Jeff Law wrote: >>> >>> >>> This patch addresses issues Richi raised from V1. Specifically it moves >>> EXACT_DIV_EXPR

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-09 Thread Jeff Law
On 02/08/2017 05:53 AM, Richard Biener wrote: Bah. Add a nonnull_p flag to value_range ... /me runs... Honestly, the way to go is ditch VR_ANTI_RANGE and make value_range be // template struct GTY(()) value_range { enum value_range_type type; // The value range is the union of [

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-09 Thread Jeff Law
On 02/08/2017 05:45 AM, Richard Biener wrote: On Tue, Feb 7, 2017 at 7:31 PM, Jeff Law wrote: This patch addresses issues Richi raised from V1. Specifically it moves EXACT_DIV_EXPR handling into extract_range_from_binary_expr_1 and less aggressively uses ~[0,0] when

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-08 Thread Richard Biener
On Tue, Feb 7, 2017 at 7:34 PM, Jeff Law wrote: > On 02/07/2017 01:39 AM, Richard Biener wrote: >> >> On Mon, Feb 6, 2017 at 10:57 PM, Jeff Law wrote: >>> >>> On 02/06/2017 08:33 AM, Richard Biener wrote: >>> ah, indeed vr0type is VR_ANTI_RANGE and yes we

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-08 Thread Richard Biener
On Tue, Feb 7, 2017 at 7:31 PM, Jeff Law wrote: > > This patch addresses issues Richi raised from V1. Specifically it moves > EXACT_DIV_EXPR handling into extract_range_from_binary_expr_1 and less > aggressively uses ~[0,0] when intersecting ranges -- only doing so when > vr1's

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-07 Thread Jeff Law
On 02/07/2017 01:39 AM, Richard Biener wrote: On Mon, Feb 6, 2017 at 10:57 PM, Jeff Law wrote: On 02/06/2017 08:33 AM, Richard Biener wrote: ah, indeed vr0type is VR_ANTI_RANGE and yes we have the case of a range with an anti-range "inside". This also covers [-1,1] v ~[0,0]

[RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR V2

2017-02-07 Thread Jeff Law
This patch addresses issues Richi raised from V1. Specifically it moves EXACT_DIV_EXPR handling into extract_range_from_binary_expr_1 and less aggressively uses ~[0,0] when intersecting ranges -- only doing so when vr1's range is > 65536 elements. That number is highly arbitrary. I'm

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-07 Thread Richard Biener
On Mon, Feb 6, 2017 at 10:57 PM, Jeff Law wrote: > On 02/06/2017 08:33 AM, Richard Biener wrote: > >> ah, indeed vr0type is VR_ANTI_RANGE and yes we have the case >> of a range with an anti-range "inside". This also covers [-1,1] v ~[0,0] >> where you choose the much larger

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Jeff Law
On 02/06/2017 08:33 AM, Richard Biener wrote: ah, indeed vr0type is VR_ANTI_RANGE and yes we have the case of a range with an anti-range "inside". This also covers [-1,1] v ~[0,0] where you choose the much larger anti-range now. So at least we want to have some idea about the sizes of the

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Jeff Law
On 02/06/2017 08:33 AM, Richard Biener wrote: On Mon, Feb 6, 2017 at 4:18 PM, Jeff Law wrote: On 02/06/2017 08:15 AM, Jeff Law wrote: On 02/06/2017 01:11 AM, Richard Biener wrote: On Sat, Feb 4, 2017 at 3:52 PM, Jeff Law wrote: This is the first of a 4

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Richard Biener
On Mon, Feb 6, 2017 at 4:28 PM, Jeff Law wrote: > On 02/06/2017 01:11 AM, Richard Biener wrote: >> >> On Sat, Feb 4, 2017 at 3:52 PM, Jeff Law wrote: >>> >>> This is the first of a 4 part series to address the issues around 79095. >>> >>> This patch addresses

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Richard Biener
On Mon, Feb 6, 2017 at 4:18 PM, Jeff Law wrote: > On 02/06/2017 08:15 AM, Jeff Law wrote: >> >> On 02/06/2017 01:11 AM, Richard Biener wrote: >>> >>> On Sat, Feb 4, 2017 at 3:52 PM, Jeff Law wrote: This is the first of a 4 part series to address the

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Jeff Law
On 02/06/2017 01:11 AM, Richard Biener wrote: On Sat, Feb 4, 2017 at 3:52 PM, Jeff Law wrote: This is the first of a 4 part series to address the issues around 79095. This patch addresses improvements in determining ranges of binary expressions in three ways. First if we are

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Jeff Law
On 02/06/2017 08:15 AM, Jeff Law wrote: On 02/06/2017 01:11 AM, Richard Biener wrote: On Sat, Feb 4, 2017 at 3:52 PM, Jeff Law wrote: This is the first of a 4 part series to address the issues around 79095. This patch addresses improvements in determining ranges of binary

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Jeff Law
On 02/06/2017 01:11 AM, Richard Biener wrote: On Sat, Feb 4, 2017 at 3:52 PM, Jeff Law wrote: This is the first of a 4 part series to address the issues around 79095. This patch addresses improvements in determining ranges of binary expressions in three ways. First if we are

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-06 Thread Richard Biener
On Sat, Feb 4, 2017 at 3:52 PM, Jeff Law wrote: > This is the first of a 4 part series to address the issues around 79095. > > This patch addresses improvements in determining ranges of binary > expressions in three ways. > > First if we are otherwise unable to find a range for

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-05 Thread Jeff Law
On 02/05/2017 04:06 PM, kugan wrote: Hi Jeff, On 05/02/17 01:52, Jeff Law wrote: + /* EXACT_DIV_EXPR is typically used for pointer subtraction; + as a result a ~[0,0] may be better than what has already + been computed. + + In particular if numerator has the range ~[0,0], then the

Re: [RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-05 Thread kugan
Hi Jeff, On 05/02/17 01:52, Jeff Law wrote: + /* EXACT_DIV_EXPR is typically used for pointer subtraction; + as a result a ~[0,0] may be better than what has already + been computed. + + In particular if numerator has the range ~[0,0], then the + result range is going to be

[RFA][PR tree-optimization/79095] [PATCH 1/4] Improve ranges for MINUS_EXPR and EXACT_DIV_EXPR

2017-02-04 Thread Jeff Law
This is the first of a 4 part series to address the issues around 79095. This patch addresses improvements in determining ranges of binary expressions in three ways. First if we are otherwise unable to find a range for the result of a MINUS_EXPR, if we know the arguments are not equal, then