Re: [COMMITTED] Improve union of ranges containing NAN.

2022-08-31 Thread Aldy Hernandez via Gcc-patches
On Wed, Aug 31, 2022 at 8:22 AM Richard Biener wrote: > > On Tue, Aug 30, 2022 at 5:43 PM Aldy Hernandez via Gcc-patches > wrote: > > > > Previously [5,6] U NAN would just drop to VARYING. With this patch, > > the resulting range becomes [5,6] with the NAN bit set t

[COMMITTED] Improve union of ranges containing NAN.

2022-08-30 Thread Aldy Hernandez via Gcc-patches
Previously [5,6] U NAN would just drop to VARYING. With this patch, the resulting range becomes [5,6] with the NAN bit set to unknown. [I still have yet to decide what to do with intersections. ISTM, the intersection of a known NAN with anything else should be a NAN, but it could also be

[COMMITTED] Force a [NAN, NAN] range when the definite NAN property is set.

2022-08-30 Thread Aldy Hernandez via Gcc-patches
Setting the definite NAN property should also force a [NAN, NAN] range, otherwise we'd have two ways of representing a NAN: with the endpoints or with the property. In the ranger world we avoid at all costs having more than one representation for a range. In doing this, I removed the

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-30 Thread Aldy Hernandez via Gcc-patches
in reviewing/improving the code for readers. Also, it always helps regression hunting to have smaller pieces ;-). Retested on x86-64 Linux. Pushed. On Mon, Aug 29, 2022 at 4:42 PM Toon Moene wrote: > > On 8/29/22 16:36, Aldy Hernandez wrote: > > > On Mon, Aug 29, 2022 at 4:3

Re: [PATCH] A == 0 ? A : -A same as -A (when A is 0.0)

2022-08-30 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 30, 2022 at 9:03 AM Richard Biener wrote: > > On Mon, Aug 29, 2022 at 10:45 PM Aldy Hernandez via Gcc-patches > wrote: > > > > The upcoming work for frange triggers a regression in > > gcc.dg/tree-ssa/phi-opt-24.c. > > > > For -O2 -fno-signed-ze

[PATCH] A == 0 ? A : -A same as -A (when A is 0.0)

2022-08-29 Thread Aldy Hernandez via Gcc-patches
The upcoming work for frange triggers a regression in gcc.dg/tree-ssa/phi-opt-24.c. For -O2 -fno-signed-zeros, we fail to transform the following into -A: float f0(float A) { // A == 0? A : -Asame as -A if (A == 0) return A; return -A; } This is because the abs/negative match.pd

Re: [PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 5:08 PM Jeff Law wrote: > > > > On 8/29/2022 8:26 AM, Aldy Hernandez wrote: > > On Mon, Aug 29, 2022 at 4:22 PM Jeff Law via Gcc-patches > > wrote: > >> > >> > >> On 8/29/2022 7:31 AM, Aldy Hernandez via Gcc-patches

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:30 PM Toon Moene wrote: > > On 8/29/22 16:15, Aldy Hernandez wrote: > > > But even with -ffinite-math-only, is there any benefit to propagating > > a known NAN? For example: > > The original intent (in 2002) for the option -ffinite-math-on

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:27 PM Jakub Jelinek wrote: > > On Mon, Aug 29, 2022 at 04:20:16PM +0200, Aldy Hernandez wrote: > > Sure, I can add the HONOR_NANS, but can we even "see" a NAN in the IL > > for -ffinite-math-only? > > Sure, you can, e.g. __b

Re: [PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:22 PM Jeff Law via Gcc-patches wrote: > > > > On 8/29/2022 7:31 AM, Aldy Hernandez via Gcc-patches wrote: > > On Mon, Aug 29, 2022 at 3:22 PM Jakub Jelinek wrote: > >> On Mon, Aug 29, 2022 at 03:13:21PM +0200, Aldy Hernandez wrote: >

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:17 PM Jakub Jelinek wrote: > > On Mon, Aug 29, 2022 at 04:08:58PM +0200, Aldy Hernandez wrote: > > On Mon, Aug 29, 2022 at 3:55 PM Jakub Jelinek wrote: > > > > > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > &

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:08 PM Toon Moene wrote: > > On 8/29/22 15:54, Jakub Jelinek via Gcc-patches wrote: > > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > >> For convenience, singleton_p() returns false for a NAN. IMO, it makes > >>

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 3:55 PM Jakub Jelinek wrote: > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > For convenience, singleton_p() returns false for a NAN. IMO, it makes > > the implementation cleaner, but I'm not wed to the idea if s

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
(correctly) a 0.0 into the PHI. Hints? Takers? ;-). Aldy On Fri, Aug 26, 2022 at 9:44 PM Andrew Pinski wrote: > > On Fri, Aug 26, 2022 at 12:16 PM Aldy Hernandez wrote: > > > > On Fri, Aug 26, 2022 at 7:40 PM Andrew Pinski wrote: > > > > > > On Fri, Aug 26, 2

Re: [PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 3:22 PM Jakub Jelinek wrote: > > On Mon, Aug 29, 2022 at 03:13:21PM +0200, Aldy Hernandez wrote: > > It seems to me we can do this optimization regardless, but then treat > > positive and negative zero the same throughout the frange class. > >

Re: [PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022 at 6:40 PM Jakub Jelinek wrote: > > On Fri, Aug 26, 2022 at 05:46:06PM +0200, Aldy Hernandez wrote: > > On the true side of x == -0.0, we can't just blindly value propagate > > the -0.0 into every use of x because x could be +0.0 (or vice versa). > >

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022 at 7:40 PM Andrew Pinski wrote: > > On Fri, Aug 26, 2022 at 8:55 AM Aldy Hernandez wrote: > > > > [pinskia: I'm CCing you as the author of the match.pd pattern.] > > > > So, as I wrap up the work here (latest patch attached), I see there's

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022, 19:40 Andrew Pinski wrote: > On Fri, Aug 26, 2022 at 8:55 AM Aldy Hernandez wrote: > > > > [pinskia: I'm CCing you as the author of the match.pd pattern.] > > > > So, as I wrap up the work here (latest patch attached), I see there's &g

Re: [PATCH] Add set/get functions for negative infinity in real.*

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022 at 6:34 PM Jeff Law wrote: > > > > On 8/26/2022 10:24 AM, Aldy Hernandez wrote: > > On Fri, Aug 26, 2022 at 6:08 PM Jeff Law via Gcc-patches > > wrote: > >> > >> > >> On 8/23/2022 4:33 AM, Aldy Hernandez via Gcc

Re: [PATCH] Add set/get functions for negative infinity in real.*

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022 at 6:09 PM Jeff Law via Gcc-patches wrote: > > > > On 8/26/2022 9:43 AM, Aldy Hernandez via Gcc-patches wrote: > > Another real.* tweak. This time, adding a real_iszero() entry point > > to match the real_isnegzero. I could combine this patch with t

Re: [PATCH] Add set/get functions for negative infinity in real.*

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022 at 6:08 PM Jeff Law via Gcc-patches wrote: > > > > On 8/23/2022 4:33 AM, Aldy Hernandez via Gcc-patches wrote: > > For the frange implementation with endpoints I'm about to contribute, > > we need to set REAL_VALUE_TYPEs with negative infinity. Th

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Aldy Hernandez via Gcc-patches
that can be done by improving the match.pd pattern, or should be done elsewhere? Thanks. Aldy From a1f64017defaf6d5841b54e8bc867d63738a9f5c Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Tue, 23 Aug 2022 13:36:33 +0200 Subject: [PATCH] Add support for floating point endpoints to frange. The curren

[PATCH] Make all default vrange setters set VARYING.

2022-08-26 Thread Aldy Hernandez via Gcc-patches
frange is using some of the default vrange setters, some of which are leaving the range in an undefined state. We hadn't noticed this because neither frange nor unsupported_range, both which use some of the default implementation, weren't being used much. We can never go wrong with setting

[PATCH] [ranger] x == -0.0 does not mean we can replace x with -0.0

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On the true side of x == -0.0, we can't just blindly value propagate the -0.0 into every use of x because x could be +0.0 (or vice versa). With this change, we only allow the transformation if !HONOR_SIGNED_ZEROS or if the range is known not to contain 0. Will commit after tests complete.

Re: [PATCH] Add set/get functions for negative infinity in real.*

2022-08-26 Thread Aldy Hernandez via Gcc-patches
think we could inline a bunch of these functions in the header file. On Tue, Aug 23, 2022 at 12:33 PM Aldy Hernandez wrote: > > For the frange implementation with endpoints I'm about to contribute, > we need to set REAL_VALUE_TYPEs with negative infinity. The support > is already ther

Re: [PATCH] Speedup path discovery in predicate::use_cannot_happen

2022-08-23 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 23, 2022 at 2:16 PM Richard Biener wrote: > > The following reverts a hunk from r8-5789-g11ef0b22d68cd1 that > made compute_control_dep_chain start from function entry rather > than the immediate dominator of the source block of the edge with > the undefined value on the PHI node.

[PATCH] Add support for floating point endpoints to frange.

2022-08-23 Thread Aldy Hernandez via Gcc-patches
The current implementation of frange is just a type with some bits to represent NAN and INF. We can do better and represent endpoints to ultimately solve longstanding PRs such as PR24021. This patch adds these endpoints. In follow-up patches I will add support for relational operators using

[PATCH] Add set/get functions for negative infinity in real.*

2022-08-23 Thread Aldy Hernandez via Gcc-patches
For the frange implementation with endpoints I'm about to contribute, we need to set REAL_VALUE_TYPEs with negative infinity. The support is already there in real.cc, but it is awkward to get at. One could call real_inf() and then negate the value, but I've added the ability to pass the sign

[COMMITTED] Copy range from op2 in foperator_equal::op1_range.

2022-08-23 Thread Aldy Hernandez via Gcc-patches
Like the integer version, when op1 == op2 is known to be true the ranges are also equal. gcc/ChangeLog: * range-op-float.cc (foperator_equal::op1_range): Set range to range of op2. --- gcc/range-op-float.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH] Add newline when checking path profitability.

2022-08-23 Thread Aldy Hernandez via Gcc-patches
It looks like we're missing a newline for cases where we don't print anything. OK? gcc/ChangeLog: * tree-ssa-threadbackward.cc (possibly_profitable_path_p): Always add newline. (profitable_path_p): Same. --- gcc/tree-ssa-threadbackward.cc | 10 +- 1 file

[PATCH] Remove path_range_query constructor that takes an edge.

2022-08-18 Thread Aldy Hernandez via Gcc-patches
The path_range_query constructor that takes an edge is really a convenience function for the loop-ch pass. It feels wrong to pollute the API with such a specialized function that could be done with a small inline function closer to its user. As an added benefit, we remove one use of reset_path.

Re: [PATCH] Make path_range_query standalone and add reset_path.

2022-08-18 Thread Aldy Hernandez via Gcc-patches
On Thu, Aug 18, 2022, 11:34 Richard Biener wrote: > > On Thu, Aug 18, 2022 at 9:58 AM Aldy Hernandez wrote: > > > > FWIW, here is a rebased version with the latest trunk. > > > > There are no regressions, or differences in threading counts, and the > &

Re: [PATCH] Make path_range_query standalone and add reset_path.

2022-08-18 Thread Aldy Hernandez via Gcc-patches
FWIW, here is a rebased version with the latest trunk. There are no regressions, or differences in threading counts, and the performance change is negligible. Aldy On Wed, Aug 17, 2022 at 1:59 PM Aldy Hernandez wrote: > > These are a bunch of cleanups inspired by Richi's suggestion of

Re: [COMMITTED] Abstract interesting ssa-names from GORI.

2022-08-18 Thread Aldy Hernandez via Gcc-patches
Thanks. Pushed. On Wed, Aug 17, 2022 at 3:18 AM Andrew MacLeod wrote: > > > On 8/16/22 21:16, Andrew MacLeod wrote: > > > > On 8/16/22 04:21, Aldy Hernandez wrote: > >> On Thu, Aug 11, 2022 at 1:42 PM Richard Biener > >> wrote: > >> > >>

Re: [PATCH] Avoid further recomputations in path_range_query once path is finalized.

2022-08-17 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022 at 4:12 PM Richard Biener wrote: > > On Tue, Aug 16, 2022 at 3:59 PM Aldy Hernandez wrote: > > > > [Richi, I'm trying to make things more obvious for others working for the > > cose base. What do you think?] > > > > This makes a few thi

[PATCH] Reset root oracle from path_oracle::reset_path.

2022-08-17 Thread Aldy Hernandez via Gcc-patches
When we cross a backedge in the path solver, we reset the path relations and nuke the root oracle. However, we forget to reset it for the next path. This is causing us to miss threads because subsequent paths will have no root oracle to use. With this patch we get 201 more threads in the

[PATCH] Make path_range_query standalone and add reset_path.

2022-08-17 Thread Aldy Hernandez via Gcc-patches
These are a bunch of cleanups inspired by Richi's suggestion of making path_range_query standalone, instead of having to call compute_ranges() for each path. I've made the ranger need explicit, and moved the responsibility for its creation to the caller. I've also investigated and documented why

Re: [PATCH] Refactor back_threader_profitability

2022-08-17 Thread Aldy Hernandez via Gcc-patches
On Wed, Aug 17, 2022 at 10:59 AM Richard Biener wrote: > > On Wed, 17 Aug 2022, Aldy Hernandez wrote: > > > On Wed, Aug 17, 2022 at 10:38 AM Richard Biener wrote: > > > > > > On Wed, 17 Aug 2022, Aldy Hernandez wrote: > > > > > > > On Wed,

Re: [PATCH] Refactor back_threader_profitability

2022-08-17 Thread Aldy Hernandez via Gcc-patches
On Wed, Aug 17, 2022 at 10:38 AM Richard Biener wrote: > > On Wed, 17 Aug 2022, Aldy Hernandez wrote: > > > On Wed, Aug 17, 2022 at 9:54 AM Richard Biener wrote: > > > > > > On Wed, 17 Aug 2022, Aldy Hernandez wrote: > > > > > > > I just

Re: [PATCH] Refactor back_threader_profitability

2022-08-17 Thread Aldy Hernandez via Gcc-patches
On Wed, Aug 17, 2022 at 9:54 AM Richard Biener wrote: > > On Wed, 17 Aug 2022, Aldy Hernandez wrote: > > > I just have a few high level comments. > > > > On Tue, Aug 16, 2022 at 4:05 PM Richard Biener wrote: > > > > > > The following refacto

Re: [PATCH] Refactor back_threader_profitability

2022-08-17 Thread Aldy Hernandez via Gcc-patches
I just have a few high level comments. On Tue, Aug 16, 2022 at 4:05 PM Richard Biener wrote: > > The following refactors profitable_path_p in the backward threader, > splitting out parts that can be computed once the exit block is known, > parts that contiguously update and that can be checked

[PATCH] Avoid further recomputations in path_range_query once path is finalized.

2022-08-16 Thread Aldy Hernandez via Gcc-patches
[Richi, I'm trying to make things more obvious for others working for the cose base. What do you think?] This makes a few things explicit to avoid misuse. First, we add a flag to differentiate between a path whose depdenency ranges are being computed, and a path that is finalized and no further

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022 at 3:48 PM Andrew MacLeod wrote: > > > On 8/16/22 06:25, Aldy Hernandez wrote: > > On Mon, Aug 15, 2022 at 11:53 AM Richard Biener wrote: > >> The remaining issue I have with the path_range_query is that > >> we re-use the s

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022, 14:26 Richard Biener wrote: > On Tue, 16 Aug 2022, Aldy Hernandez wrote: > > > On Tue, Aug 16, 2022 at 1:38 PM Richard Biener > wrote: > > > > > > On Tue, 16 Aug 2022, Aldy Hernandez wrote: > > > > > > > On

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022 at 1:38 PM Richard Biener wrote: > > On Tue, 16 Aug 2022, Aldy Hernandez wrote: > > > On Mon, Aug 15, 2022 at 11:53 AM Richard Biener wrote: > > > > > > The remaining issue I have with the path_range_query is that > > > we re-

Re: [PATCH] Support threading of just the exit edge

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022 at 1:32 PM Richard Biener wrote: > > On Tue, 16 Aug 2022, Aldy Hernandez wrote: > > > On Tue, Aug 16, 2022 at 11:18 AM Richard Biener wrote: > > > > > > On Mon, 15 Aug 2022, Aldy Hernandez wrote: > > > > > > > On Mon,

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 15, 2022 at 11:53 AM Richard Biener wrote: > > The remaining issue I have with the path_range_query is that > we re-use the same instance in the back threader but the > class doesn't provide any way to "restart", aka give m_path > a lifetime. The "start a new path" API seems to

Re: [PATCH] Support threading of just the exit edge

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022 at 11:18 AM Richard Biener wrote: > > On Mon, 15 Aug 2022, Aldy Hernandez wrote: > > > On Mon, Aug 15, 2022 at 9:24 PM Andrew MacLeod wrote: > > > > > > heh. or just > > > > > > > > > + int_range&l

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022 at 11:08 AM Aldy Hernandez wrote: > > On Tue, Aug 16, 2022 at 10:32 AM Richard Biener wrote: > > > > On Tue, 16 Aug 2022, Aldy Hernandez wrote: > > > > > On Thu, Aug 11, 2022 at 1:42 PM Richard Biener wrote: > > > >

Re: [PATCH][pushed] VR: add missing override keyworks

2022-08-16 Thread Aldy Hernandez via Gcc-patches
Thanks. On Tue, Aug 16, 2022 at 11:07 AM Martin Liška wrote: > > Pushing as it follows the same pattern as: > > virtual void set (tree, tree, value_range_kind = VR_RANGE) override; > > Martin > > Address: > > gcc/value-range-equiv.h:57:8: warning: 'set_undefined' overrides a member > function

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 16, 2022 at 10:32 AM Richard Biener wrote: > > On Tue, 16 Aug 2022, Aldy Hernandez wrote: > > > On Thu, Aug 11, 2022 at 1:42 PM Richard Biener wrote: > > > > > @@ -599,6 +592,30 @@ path_range_query::compute_imports (bi

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 15, 2022 at 11:53 AM Richard Biener wrote: > > On Thu, 11 Aug 2022, Aldy Hernandez wrote: > > > On Thu, Aug 11, 2022 at 3:59 PM Andrew MacLeod wrote: > > > > > > > > > On 8/11/22 07:42, Richard Biener wrote: > > > > This avoid

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-16 Thread Aldy Hernandez via Gcc-patches
On Thu, Aug 11, 2022 at 1:42 PM Richard Biener wrote: > @@ -599,6 +592,30 @@ path_range_query::compute_imports (bitmap imports, const > vec ) > worklist.safe_push (arg); > } > } > + else if (gassign *ass = dyn_cast (def_stmt)) > + { > +

Re: [PATCH] Support threading of just the exit edge

2022-08-15 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 15, 2022 at 9:24 PM Andrew MacLeod wrote: > > heh. or just > > > + int_range<2> r; > + if (!fold_range (r, const_cast (cond_stmt)) > + || !r.singleton_p ()) > > > if you do not provide a range_query to any of the fold_using_range code, > it defaults to: > >

Re: [PATCH] Support threading of just the exit edge

2022-08-15 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 15, 2022 at 11:39 AM Richard Biener wrote: > > On Fri, 12 Aug 2022, Aldy Hernandez wrote: > > > On Fri, Aug 12, 2022 at 2:01 PM Richard Biener wrote: > > > > > > This started with noticing we add ENTRY_BLOCK to our threads > > > just f

Re: [PATCH] Support threading of just the exit edge

2022-08-12 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 12, 2022 at 2:01 PM Richard Biener wrote: > > This started with noticing we add ENTRY_BLOCK to our threads > just for the sake of simplifying the conditional at the end of > the first block in a function. That's not really threading > anything but it ends up duplicating the entry

Re: [PATCH] tree-optimization/106593 - fix ICE with backward threading

2022-08-12 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 12, 2022 at 1:36 PM Richard Biener wrote: > > On Fri, 12 Aug 2022, Aldy Hernandez wrote: > > > On Fri, Aug 12, 2022 at 12:59 PM Richard Biener wrote: > > > > > > With the last re-org I failed to make sure to not add SSA names > > > no

Re: [PATCH] tree-optimization/106593 - fix ICE with backward threading

2022-08-12 Thread Aldy Hernandez via Gcc-patches
In that case Richi, go right ahead with your original patch. I for one am happy we can use range_on_entry, which always seemed cleaner. Aldy On Fri, Aug 12, 2022, 16:07 Andrew MacLeod wrote: > > On 8/12/22 09:38, Andrew MacLeod wrote: > > > > On 8/12/22 07:31, Aldy Hernandez

Re: [PATCH] tree-optimization/106593 - fix ICE with backward threading

2022-08-12 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 12, 2022 at 12:59 PM Richard Biener wrote: > > With the last re-org I failed to make sure to not add SSA names > nor supported by ranger into m_imports which then triggers an > ICE in range_on_path_entry because range_of_expr returns false. I've > noticed that range_on_path_entry

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-11 Thread Aldy Hernandez via Gcc-patches
On Thu, Aug 11, 2022 at 3:59 PM Andrew MacLeod wrote: > > > On 8/11/22 07:42, Richard Biener wrote: > > This avoids going BBs outside of the path when adding def chains > > to the set of imports. It also syncs the code with > > range_def_chain::get_def_chain to not miss out on some imports > >

Re: [PATCH] Tame path_range_query::compute_imports

2022-08-11 Thread Aldy Hernandez via Gcc-patches
OK On Thu, Aug 11, 2022, 13:42 Richard Biener wrote: > This avoids going BBs outside of the path when adding def chains > to the set of imports. It also syncs the code with > range_def_chain::get_def_chain to not miss out on some imports > this function would identify. > > Bootstrap / regtest

Re: [PATCH] Fix path query compute_imports for external path

2022-08-10 Thread Aldy Hernandez via Gcc-patches
to be making good progress. Aldy On Wed, Aug 10, 2022 at 6:10 PM Aldy Hernandez wrote: > > Looks good to me. > > Thanks. > Aldy > > On Wed, Aug 10, 2022 at 3:01 PM Richard Biener wrote: > > > > The following fixes the use of compute_imports from the backwards >

Re: [PATCH] Fix path query compute_imports for external path

2022-08-10 Thread Aldy Hernandez via Gcc-patches
Looks good to me. Thanks. Aldy On Wed, Aug 10, 2022 at 3:01 PM Richard Biener wrote: > > The following fixes the use of compute_imports from the backwards > threader which ends up accessing stale m_path from a previous > threading attempt. The fix is to pass in the path explicitely > (and not

Re: [PATCH] tree-optimization/106514 - revisit m_import compute in backward threading

2022-08-10 Thread Aldy Hernandez via Gcc-patches
On Wed, Aug 10, 2022 at 12:46 PM Richard Biener wrote: > > On Wed, 10 Aug 2022, Richard Biener wrote: > > > On Tue, 9 Aug 2022, Andrew MacLeod wrote: > > > > > > > > On 8/9/22 09:01, Richard Biener wrote: > > > > This revisits how we compute imports later used for the ranger path > > > > query

Re: [PATCH] tree-optimization/106514 - revisit m_import compute in backward threading

2022-08-10 Thread Aldy Hernandez via Gcc-patches
I'm still on vacation, but I figured I'd mention a few things to either unblock you, or move the conversation along. On Wed, Aug 10, 2022 at 8:45 AM Richard Biener wrote: > > On Tue, 9 Aug 2022, Andrew MacLeod wrote: > > > > > On 8/9/22 09:01, Richard Biener wrote: > > > This revisits how we

[COMMITTED] Inline unsupported_range constructor.

2022-08-05 Thread Aldy Hernandez via Gcc-patches
An unsupported_range temporary is instantiated in every Value_Range for completeness sake and should be mostly a NOP. However, it's showing up in the callgrind stats, because it's not inline. This fixes the oversight. PR tree-optimization/106514 gcc/ChangeLog: * value-range.cc

Re: [PATCH] Backwards threader greedy search TLC

2022-08-04 Thread Aldy Hernandez via Gcc-patches
On Thu, Aug 4, 2022 at 9:15 AM Richard Biener wrote: > > On Thu, 4 Aug 2022, Aldy Hernandez wrote: > > > On Wed, Aug 3, 2022 at 11:53 AM Richard Biener wrote: > > > > > > I've tried to understand how the greedy search works seeing the > > > bitmap da

Re: [PATCH] Backwards threader greedy search TLC

2022-08-04 Thread Aldy Hernandez via Gcc-patches
On Wed, Aug 3, 2022 at 11:53 AM Richard Biener wrote: > > I've tried to understand how the greedy search works seeing the > bitmap dances and the split into resolve_phi. I've summarized > the intent of the algorithm as > > // For further greedy searching we want to remove interesting >

[COMMITTED] Adjust testsuite/gcc.dg/tree-ssa/vrp-float-1.c

2022-08-02 Thread Aldy Hernandez via Gcc-patches
I missed the -details dump flag, plus I wasn't checking the actual folding. As a bonus I had flipped the dump file name and the count, so the test was coming out as unresolved, which I missed because I was only checking for failures and passes. Whooops. gcc/testsuite/ChangeLog: *

Re: [PATCH] Properly honor param_max_fsm_thread_path_insns in backwards threader

2022-08-02 Thread Aldy Hernandez via Gcc-patches
Feel free to blame me for everything except the profitability code and the generic block copier. That stuff was all there before and I mostly avoided it. :-) Thanks for the work in this space. Aldy On Tue, Aug 2, 2022, 15:29 Richard Biener wrote: > On Tue, 2 Aug 2022, Aldy Hernandez wr

Re: [RFA] Implement basic range operators to enable floating point VRP.

2022-08-02 Thread Aldy Hernandez via Gcc-patches
changing diapers, but without a laptop. Feedback still welcome; I'll just address it as a follow-up. Pushed. Aldy On Sun, Jul 31, 2022 at 8:11 PM Aldy Hernandez wrote: > > PING > > Andrew, anyone, would you mind giving this a once over? I realize > reviewing ranger'

[PATCH] Implement streamer for frange.

2022-08-02 Thread Aldy Hernandez via Gcc-patches
This patch Allows us to export floating point ranges into the SSA name (SSA_NAME_RANGE_INFO). [Richi, in PR24021 you suggested that match.pd could use global float ranges, because it would generally not invoke ranger. This patch implements the boiler plate to save the frange globally.] [Jeff,

[PATCH] More frange::set cleanups.

2022-08-02 Thread Aldy Hernandez via Gcc-patches
Will commit pending a final round of tests. gcc/ChangeLog: * value-range.cc (frange::set): Initialize m_props and cleanup. --- gcc/value-range.cc | 47 +++--- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/gcc/value-range.cc

[PATCH] Limit ranger query in ipa-prop.cc to integrals.

2022-08-02 Thread Aldy Hernandez via Gcc-patches
ipa-* still works on legacy value_range's which only support integrals. This patch limits the query to integrals, as to not get a floating point range that can't exist in an irange. Will commit pending a final round of tests. gcc/ChangeLog: * ipa-prop.cc

Re: [COMMITTED] Make irange dependency explicit for range_of_ssa_name_with_loop_info.

2022-08-02 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 2, 2022 at 2:07 PM Richard Biener wrote: > > On Tue, Aug 2, 2022 at 1:41 PM Aldy Hernandez wrote: > > > > On Tue, Aug 2, 2022 at 9:19 AM Richard Biener > > wrote: > > > > > > On Mon, Aug 1, 2022 at 8:17 AM Aldy Hernandez via Gcc-patches

Re: [PATCH] Properly honor param_max_fsm_thread_path_insns in backwards threader

2022-08-02 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 2, 2022 at 1:59 PM Richard Biener wrote: > > On Tue, 2 Aug 2022, Aldy Hernandez wrote: > > > On Tue, Aug 2, 2022 at 1:45 PM Richard Biener wrote: > > > > > > On Tue, 2 Aug 2022, Aldy Hernandez wrote: > > > > > > > U

Re: [PATCH] Properly honor param_max_fsm_thread_path_insns in backwards threader

2022-08-02 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 2, 2022 at 1:45 PM Richard Biener wrote: > > On Tue, 2 Aug 2022, Aldy Hernandez wrote: > > > Unfortunately, this was before my time, so I don't know. > > > > That being said, thanks for tackling these issues that my work > > triggered last r

Re: [COMMITTED] Make irange dependency explicit for range_of_ssa_name_with_loop_info.

2022-08-02 Thread Aldy Hernandez via Gcc-patches
On Tue, Aug 2, 2022 at 9:19 AM Richard Biener wrote: > > On Mon, Aug 1, 2022 at 8:17 AM Aldy Hernandez via Gcc-patches > wrote: > > > > Even though ranger is type agnostic, SCEV seems to only work with > > integers. This patch removes some FIX

Re: [PATCH] Properly honor param_max_fsm_thread_path_insns in backwards threader

2022-08-02 Thread Aldy Hernandez via Gcc-patches
Unfortunately, this was before my time, so I don't know. That being said, thanks for tackling these issues that my work triggered last release. Much appreciated. Aldy On Tue, Aug 2, 2022 at 10:41 AM Richard Biener wrote: > > I am trying to make sense of

[COMMITTED] Make irange dependency explicit for range_of_ssa_name_with_loop_info.

2022-08-01 Thread Aldy Hernandez via Gcc-patches
Even though ranger is type agnostic, SCEV seems to only work with integers. This patch removes some FIXME notes making it explicit that bounds_of_var_in_loop only works with iranges. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range-fold.cc (fold_using_range::range_of_phi): Only

[COMMITTED] const_tree conversion of vrange::supports_*

2022-08-01 Thread Aldy Hernandez via Gcc-patches
Make all vrange::supports_*_p methods const_tree as they can end up being called from functions that are const_tree. Tested on x86-64 Linux. gcc/ChangeLog: * value-range.cc (vrange::supports_type_p): Use const_tree. (irange::supports_type_p): Same.

[COMMITTED] Cleanups to frange.

2022-08-01 Thread Aldy Hernandez via Gcc-patches
These are some assorted cleanups to the frange class to make it easier to drop in an implementation with FP endpoints: * frange::set() had some asserts limiting the type of arguments passed. There's no reason why we can't handle all the variants. Worse comes to worse, we can always return a

Re: [RFA] Implement basic range operators to enable floating point VRP.

2022-07-31 Thread Aldy Hernandez via Gcc-patches
in the week to have enough time to field any possible fallout before I take a few days off next week. Updated patch attached. Thanks. Aldy On Mon, Jul 25, 2022 at 8:50 PM Aldy Hernandez wrote: > > Without further ado, here is the implementation for floating point > range operators, plus t

Re: spaceship_replacement cannot see through simplified set of FP conditionals

2022-07-29 Thread Aldy Hernandez via Gcc
Swt! Would you like me to XFAIL the test or leave it as a failure? Thanks. Aldy On Fri, Jul 29, 2022 at 1:50 PM Jakub Jelinek wrote: > > On Fri, Jul 29, 2022 at 01:40:12PM +0200, Aldy Hernandez wrote: > > With my upcoming patch enabling floating point VRP, > > g++.

Re: [PATCH] tree-optimization/105679 - disable backward threading of unlikely entry

2022-07-29 Thread Aldy Hernandez via Gcc-patches
On Fri, Jul 29, 2022 at 11:02 AM Richard Biener wrote: > > The following makes the backward threader reject threads whose entry > edge is probably never executed according to the profile. That in > particular, for the testcase, avoids threading the irq == 1 check > on the path where irq > 31,

spaceship_replacement cannot see through simplified set of FP conditionals

2022-07-29 Thread Aldy Hernandez via Gcc
Hi. With my upcoming patch enabling floating point VRP, g++.dg/opt/pr94589-2.C is failing: https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598788.html The problem is that phiopt no longer sees the following snippet, because we have folded away the final conditional as true: bool f5 (double

[COMMITTED] [106444] Handle non constant ranges in irange pretty printer.

2022-07-26 Thread Aldy Hernandez via Gcc-patches
Technically iranges only exist in constant form, but we allow symbolic ones before arriving in the ranger, so legacy VRP can work. This fixes the ICE when attempting to print symbolic iranges in the pretty printer. For consistency's sake, I have made sure irange::get_nonzero_bits does not

Re: [RFA] Implement basic range operators to enable floating point VRP.

2022-07-25 Thread Aldy Hernandez via Gcc-patches
opine. Aldy On Mon, Jul 25, 2022 at 8:50 PM Aldy Hernandez wrote: > > Without further ado, here is the implementation for floating point > range operators, plus the switch to enable all ranger clients to > handle floats. > > These are bare bone implementations good enough for

[RFA] Implement basic range operators to enable floating point VRP.

2022-07-25 Thread Aldy Hernandez via Gcc-patches
Without further ado, here is the implementation for floating point range operators, plus the switch to enable all ranger clients to handle floats. These are bare bone implementations good enough for relation operators to work, while keeping the NAN bits up to date in the frange. There is also

[PATCH] Dispatch code for floating point range ops.

2022-07-25 Thread Aldy Hernandez via Gcc-patches
\ diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc new file mode 100644 index 000..8e9d83e3827 --- /dev/null +++ b/gcc/range-op-float.cc @@ -0,0 +1,206 @@ +/* Floating point range operators. + Copyright (C) 2022 Free Software Foundation, Inc. + Contributed by Aldy Hernandez

[COMMITTED] [PR middle-end/106432] Gracefully handle unsupported type in range_on_edge

2022-07-25 Thread Aldy Hernandez via Gcc-patches
A cleaner approach to fix this PR has been suggested by Andrew, which is to just return false on range_on_edge for unsupported range types. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range.cc (gimple_ranger::range_on_edge): Return false when the result range type is

[COMMITTED] frange class to represent floating point ranges

2022-07-25 Thread Aldy Hernandez via Gcc-patches
This implements a basic frange class to represent floating point ranges. Although it is meant to be a base for further development, it is enough to handle relations and propagate NAN and other properties. For ranger clients to become floating point aware, we still need the range-op entries,

[COMMITTED] Convert some uses in ranger_cache and DOM to vrange.

2022-07-24 Thread Aldy Hernandez via Gcc-patches
Here are a few conversions to type agnostic vrange I found while working on frange. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range-cache.cc (ranger_cache::edge_range): Convert to vrange. (ranger_cache::range_from_dom): Same. * tree-ssa-dom.cc

[COMMITTED] Tweaks to global ranges.

2022-07-24 Thread Aldy Hernandez via Gcc-patches
The global get_nonzero_bits was previously returning -1 for unsupported types. I dropped this in the conversion to global ranges and it's causing a problem in the frange work, where CCP is asking for the nonzero bits of non-integral types. CCP may require further tweaks, but for now, restore the

[COMMITTED] Allow registering same SSA name relations in oracle.

2022-07-24 Thread Aldy Hernandez via Gcc-patches
Similarly to what we did for the relation oracle, but for the path oracle. This was found while working on frange, where we can test for x == x while checking for NANness. Tested on x86-64 Linux. gcc/ChangeLog: * value-relation.cc (value_relation::set_relation): Remove assert.

[COMMITTED] Minor fixes to vr_values to not die on non integral types.

2022-07-24 Thread Aldy Hernandez via Gcc-patches
The legacy code in vr_values mostly works on integral types (with few exceptions such as some conversions from float). This patch makes vr_values::range_of_expr not die when asked for a range of an unsupported type. It also keeps the min/max simplification code from being called on non

Re: [COMMITTED] Use pp_vrange for ranges in dump_ssaname_info.

2022-07-15 Thread Aldy Hernandez via Gcc-patches
On Fri, Jul 15, 2022 at 11:40 AM Aldy Hernandez wrote: > > This changes the ad-hoc dumping of ranges in the gimple pretty printer > to use the pp_vrange utility function, which has the benefit of > handling all range types going forward and unifying the dumping code.

[COMMITTED] Implement visitor pattern for vrange.

2022-07-15 Thread Aldy Hernandez via Gcc-patches
We frequently do operations on the various (upcoming) range types. The cascading if/switch statements of is_a<> are getting annoying and repetitive. The classic visitor pattern provides a clean way to implement classes handling various range types without the need for endless conditionals. It

[COMMITTED] Convert vrange dumping facilities to pretty_printer.

2022-07-15 Thread Aldy Hernandez via Gcc-patches
sks (const irange ) const +{ + wide_int nz = r.get_nonzero_bits (); + if (nz == -1) +return; + + pp_string (pp, " NONZERO "); + char buf[WIDE_INT_PRINT_BUFFER_SIZE]; + print_hex (nz, buf); + pp_string (pp, buf); +} diff --git a/gcc/value-range-pretty-print.h b/gcc/value-range-pretty-

[COMMITTED] Use pp_vrange for ranges in dump_ssaname_info.

2022-07-15 Thread Aldy Hernandez via Gcc-patches
This changes the ad-hoc dumping of ranges in the gimple pretty printer to use the pp_vrange utility function, which has the benefit of handling all range types going forward and unifying the dumping code. Instead of: # RANGE [0, 51] NONZERO 0x3f # RANGE ~[5, 10] we would now get:

<    2   3   4   5   6   7   8   9   10   11   >