Re: [PATCH 06/17] value-relation.h: Mark dom_oracle::next_relation as override

2025-06-25 Thread Andrew MacLeod
BTW, consider all such future changes in ranger code pre-approved! Thanks Andrew On 6/25/25 10:27, Andrew MacLeod wrote: OK for all the ranger related patches. Thanks Andrew On 6/25/25 10:08, Martin Jambor wrote: Hi, When GCC is compiled with clang, it emits a warning that dom_oracle

Re: [PATCH 06/17] value-relation.h: Mark dom_oracle::next_relation as override

2025-06-25 Thread Andrew MacLeod
OK for all the ranger related patches. Thanks Andrew On 6/25/25 10:08, Martin Jambor wrote: Hi, When GCC is compiled with clang, it emits a warning that dom_oracle::next_relation is not marked as override even though it does override a virtual function of its ancestor. This patch marks it as

[COMMITTED] - Remove unused vector in value-relation.cc.

2025-06-25 Thread Andrew MacLeod
86_64-pc-linux-gnu  with no regressions.   Pushed. Andrew From 25a15a4c0318d928d534a0db9592cb6f0e454707 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 24 Jun 2025 16:51:56 -0400 Subject: [PATCH 3/3] Remove unused vector in value-relation.cc. The relation_to_code vector in value-relatio

[COMMITTED] Promote verify_range to vrange.

2025-06-25 Thread Andrew MacLeod
.  Bootstraps on x86_64-pc-linux-gnu  with no regressions. Pushed. Andrew From 8213212eba1cad976823716c0c4ba835c842d0b2 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 19 Jun 2025 21:19:27 -0400 Subject: [PATCH 2/3] Promote verify_range to vrange. most range classes had a verufy_range, but

[COMMITTED] - get_bitmask is sometimes less refined.

2025-06-25 Thread Andrew MacLeod
5ae33c8f44f0112644b561dfc549c1dc2c679b6f Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 24 Jun 2025 13:10:56 -0400 Subject: [PATCH 1/3] get_bitmask is sometimes less refined. get_bitmask intersects the current mask with a mask generated from the range. If the 2 masks are incompatible, it currently returns

Re: [COMMITTED 02/12] - Move to an always available relation oracle.

2025-06-24 Thread Andrew MacLeod
yeah, sure. Its wasted memory.  If we ever need it fro anything, it could be added back in. I'll add it to my next commit. Thanks Andrew On 6/23/25 18:21, Martin Jambor wrote: Hello, On Thu, May 23 2024, Andrew MacLeod wrote: This patch provides a basic oracle which doesn't d

Re: [committed] value-range: Use int instead of uint for wi::ctz result [PR120746]

2025-06-21 Thread Andrew MacLeod
ay. On 6/21/25 10:14, Jakub Jelinek wrote: On Tue, Jun 17, 2025 at 09:27:27PM -0400, Andrew MacLeod wrote: + uint z = wi::ctz (m_bitmask.mask ()); uint is some compatibility type in glibc sys/types.h enabled in misc/GNU modes, so it doesn't exist on many hosts. Furthermore, wi::ctz ret

[COMMITTED] PR tree-optimization/120701 - Fix range wrap check and enhance verify_range.

2025-06-20 Thread Andrew MacLeod
fy_range. I also made some minor comment adjustments Aldy pointed out earlier. Bootstraps on x86_64-pc-linux-gnu with no regressions.   Pushed. Andrew From b03e0d69b37f6ea7aef220652635031a89f56a11 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Fri, 20 Jun 2025 08:50:39 -0400 Subject: [PA

[COMMITTED] Re: [PATCH] PR tree-optimization/119039 - Simplify switches utilizing subranges.

2025-06-18 Thread Andrew MacLeod
On 6/18/25 14:17, Andrew Pinski wrote: On Wed, Jun 18, 2025, 11:11 AM Andrew MacLeod wrote: On 6/18/25 14:00, Andrew Pinski wrote: > > > +/* { dg-final { scan-tree-dump-not "foo" "evrp" } } */ > > May I suggest this be changed t

Re: [PATCH] PR tree-optimization/119039 - Simplify switches utilizing subranges.

2025-06-18 Thread Andrew MacLeod
On 6/18/25 14:00, Andrew Pinski wrote: +/* { dg-final { scan-tree-dump-not "foo" "evrp" } } */ May I suggest this be changed to "foo " (adding a space). To avoid maybe matching on a directory name that contains foo. I only noticed this today after you pushed thr change sorry. Thanks, And

[COMMITTED] Always update bitmask if it changed.

2025-06-18 Thread Andrew MacLeod
if we know what it should be. bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. From eb11ee3d7d8ed9a3b024740343a5fe9467ec9e0f Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 12 Jun 2025 14:48:50 -0400 Subject: [PATCH 4/4] intersect_bitmask - Always update bitmask. The

[COMMITTED] PR tree-optimization/119039 - Improve contains_p and intersect with bitmasks.

2025-06-18 Thread Andrew MacLeod
hese changes primarily produce more UNDEFINED results than we use to. Bootstraps on x86_64-pc-linux-gnu with no regressions.   Pushed. Andrew From e65c2537b019ea19f274c09b357b01cc948fdbcb Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Wed, 28 May 2025 16:27:16 -0400 Subject: [PATCH

Re: [PATCH] PR tree-optimization/119039 - Simplify switches utilizing subranges.

2025-06-18 Thread Andrew MacLeod
Pushed.   Lets see if the thread testcase triggers a different number of threads somewhere else. Andrew On 6/10/25 13:01, Andrew MacLeod wrote: simplify_switch_using_ranges has never been converted over properly to use irange.  It still uses get_legacy_range, and as a result, is very

[COMMITTED] PR tree-optimization/120661 - Snap subrange boundries to bitmask constraints.

2025-06-17 Thread Andrew MacLeod
d be good to sit down and see if it needs reworking.. Im pretty sure there is some work being done over and over we can improve on, but this is good enough for now. Bootstraps on x86_64-pc-linux-gnu with no regressions.   Pushed. Andrew From 9808af57ef1d4cbafb40b2446fd6808cbf20b36d Mon Sep

Re: Gimple lowering question

2025-06-11 Thread Andrew MacLeod
On 6/11/25 11:02, Andrew MacLeod wrote: On 6/10/25 17:05, Richard Biener wrote: Am 10.06.2025 um 22:18 schrieb Andrew MacLeod :  I had a question asked of me, and now I'm passing the buck.     extern void *memcpy(void *, const void *, unsigned int);     extern int memcmp(const

Re: Gimple lowering question

2025-06-11 Thread Andrew MacLeod
On 6/10/25 17:05, Richard Biener wrote: Am 10.06.2025 um 22:18 schrieb Andrew MacLeod :  I had a question asked of me, and now I'm passing the buck. extern void *memcpy(void *, const void *, unsigned int); extern int memcmp(const void *, const void *, unsigned int); ty

Gimple lowering question

2025-06-10 Thread Andrew MacLeod
I had a question asked of me, and now I'm passing the buck. extern void *memcpy(void *, const void *, unsigned int); extern int memcmp(const void *, const void *, unsigned int); typedef unsigned long bits32; typedef unsigned char byte; static const byte orig[10] = {    'J', '2

Re: [PATCH] expand, ranger: Use ranger during expansion [PR120434]

2025-06-10 Thread Andrew MacLeod
On 6/10/25 13:52, Jakub Jelinek wrote: On Tue, Jun 10, 2025 at 10:51:25AM -0400, Andrew MacLeod wrote: Edge range should be fine, and really that assert doesnt really need to be there. Where the issue could arise is in gimple-range-fold.cc in fold_using_range::range_of_range_op()  where we

[PATCH] PR tree-optimization/119039 - Simplify switches utilizing subranges.

2025-06-10 Thread Andrew MacLeod
From: Andrew MacLeod Date: Wed, 28 May 2025 11:16:05 -0400 Subject: [PATCH] Simplify switches utilizing subranges. Adjust simplify_switch_using_ranges to use irange rather than relying on the older legacy_range mechaism. PR tree-optimization/119039 gcc/ * vr-values.cc (simplify_using_r

[COMMITTED] Check if constant is a member before returning it.

2025-06-10 Thread Andrew MacLeod
gressions.  Pushed Andrew From ea2cfcbf652c9531aae2af6352c9519d36795cf1 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 10 Jun 2025 12:11:18 -0400 Subject: [PATCH] Check if constant is a member before returning it. set_range_from_bitmask checks the new bitmask, and if it is a constant, simpl

Re: [PATCH] expand, ranger: Use ranger during expansion [PR120434]

2025-06-10 Thread Andrew MacLeod
On 6/10/25 10:07, Jakub Jelinek wrote: On Tue, Jun 10, 2025 at 09:59:33AM -0400, Andrew MacLeod wrote: Yes, there are places , particularly fold_using_range in gimple-range-fold.cc,  which expects there to be 2 edges to a GCOND stmt. it always expects 2 successors.   There are not many places

Re: [PATCH] expand, ranger: Use ranger during expansion [PR120434]

2025-06-10 Thread Andrew MacLeod
On 6/10/25 07:10, Jakub Jelinek wrote: On Tue, Jun 10, 2025 at 12:55:39PM +0200, Richard Biener wrote: Yes, it must (but we expand those separately, so we could tear down ranger then). So apart from ICEing I wonder how ranger (and it's cache) deals with basic blocks being added, edges vanishi

Re: [PATCH] expand, ranger: Use ranger during expansion [PR120434]

2025-06-10 Thread Andrew MacLeod
On 6/10/25 06:55, Richard Biener wrote: On Mon, 9 Jun 2025, Jakub Jelinek wrote: On Sun, Jun 08, 2025 at 10:49:44AM +0200, Richard Biener wrote: I'm also a bit nervous about this given during RTL expansion the IL is neither fully GIMPLE nor fully RTL. Given we do not perform many range quer

Re: [PATCH] expand, ranger: Use ranger during expansion [PR120434]

2025-06-10 Thread Andrew MacLeod
On 6/10/25 08:21, Richard Biener wrote: On Tue, 10 Jun 2025, Jakub Jelinek wrote: On Tue, Jun 10, 2025 at 01:05:51PM +0200, Richard Biener wrote: With your experiment of computing ranges for everything we're good from the ICE point-of-view. I think there's nothing we can do to reassure us o

Re: [PATCH] expand, ranger: Use ranger during expansion [PR120434]

2025-06-06 Thread Andrew MacLeod
On 6/6/25 11:07, Jakub Jelinek wrote: On Fri, Jun 06, 2025 at 10:54:55AM -0400, Andrew MacLeod wrote: I don't remember details about the order of things...  Is there any chance that you might query an SSA_NAME whose DEF was in  a block which has been converted to RTL?   Ranger will quer

Re: [PATCH] expand, ranger: Use ranger during expansion [PR120434]

2025-06-06 Thread Andrew MacLeod
Interesting. I don't remember details about the order of things...  Is there any chance that you might query an SSA_NAME whose DEF was in  a block which has been converted to RTL?   Ranger will query all the way back to the def block, accessed via gimple_bb (SSA_NAME_DEF_STMT (name)), or top

Re: [PATCH] ranger: Add support for float <-> int casts [PR120231]

2025-06-05 Thread Andrew MacLeod
On 6/5/25 11:00, Jakub Jelinek wrote: Hi! The following patch adds support for float <-> integer conversions in ranger. The patch reverts part of the r16-571 changes, those changes were right for fold_range, but not for op1_range, where RO_IFI and RO_FIF are actually called rather than RO_IFF

Re: [PATCH 2/4] Use ranger for table based CTZ detection

2025-06-05 Thread Andrew MacLeod
On 6/5/25 09:28, Richard Biener wrote: The following uses context sensitive ranger for determining whether the input to the table based CTZ is ever zero. Bootstrapped and tested on x86_64-unknown-linux-gnu. * tree-ssa-forwprop.cc (simplify_count_trailing_zeroes): Use ranger in

Re: [PATCH] ranger: Add support for float <-> float casts [PR120231]

2025-06-04 Thread Andrew MacLeod
Fine with me.  I don't think Aldy got to many of the cast conversions. Andrew On 6/3/25 03:31, Jakub Jelinek wrote: Hi! I've noticed we don't even support say float -> double and other scalar floating point to scalar floating point conversions in the ranger, we just end up with VARYING for tho

Re: [PATCH] ranger: Some parameter formatting fixes

2025-06-04 Thread Andrew MacLeod
On 6/3/25 03:33, Jakub Jelinek wrote: Hi! When reading the code, I've noticed various function definitions with misaligned parameters, they should IMHO always align below the first character after opening ( and in most cases they do, but in some cases they were indented more or less. Perhaps th

Re: [PATCH 2/2] VR-VALUES: Rewrite test_for_singularity using range_op_handler

2025-05-23 Thread Andrew MacLeod
On 9/29/23 16:17, Jeff Law wrote: On 9/5/23 01:12, Andrew Pinski wrote: On Mon, Sep 4, 2023 at 11:06 PM Jeff Law via Gcc-patches wrote: On 9/1/23 11:30, Andrew Pinski via Gcc-patches wrote: So it turns out there was a simplier way of starting to improve VRP to start to fix PR 110131, P

Re: [COMMITTED] PR tee-optimization/120277 - Check for casts becoming UNDEFINED.

2025-05-16 Thread Andrew MacLeod
On 5/16/25 02:35, Richard Biener wrote: On Thu, May 15, 2025 at 7:02 PM Andrew MacLeod wrote: Recent changes to get_range_from_bitmask can sometimes turn a small range into an undefined one if the bitmask indicates the bits make all values impossible. range_cast () was not expecting this and

[COMMITTED 3/4] PR tee-optimization/116546 - Allow bitmask intersection to process unknown masks.

2025-05-15 Thread Andrew MacLeod
.   Pushed. Andrew From b3327649bffd32af962662dce054b94be2d7330d Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Wed, 14 May 2025 11:13:15 -0400 Subject: [PATCH 3/4] Allow bitmask intersection to process unknown masks. bitmask_intersection should not return immediately if the current mask is

[COMMITTED] PR tee-optimization/120277 - Check for casts becoming UNDEFINED.

2025-05-15 Thread Andrew MacLeod
w From f332f23d6b6b45dce3ab19440eecffa26bf3fc15 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 15 May 2025 11:06:05 -0400 Subject: [PATCH 1/5] Check for casts becoming UNDEFINED. In various situations a cast that is ultimately unreahcable may produce an UNDEFINED result, and we can't check th

[COMMITTED 1/4] PR tree-optimization/116546 - Turn get_bitmask_from_range into an irange_bitmask, constructor.

2025-05-15 Thread Andrew MacLeod
r for irange_bitmask. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  pushed. From e4c6a0214c3ea8aa73e50b1496eb7a8aa5eda635 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 13 May 2025 13:23:16 -0400 Subject: [PATCH 1/4] Turn get_bitmask_from_range into an irange_bitmask constructor.

[COMMITTED 4/4] PR tree-optimization/116546 - Enhance bitwise_and::op1_range

2025-05-15 Thread Andrew MacLeod
lves the PR by successfully tracking the bit through to the AND operation. Bootstraps on  x86_64-pc-linux-gnu with no regressions.   Pushed. Andrew From ac55655ce45a237a6a01e0cce50211841603c2ec Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Wed, 14 May 2025 11:32:58 -0400 Subject: [PATC

[COMMITTED 2/4] PR tree-optimization/116546 - Improve constant bitmasks.

2025-05-15 Thread Andrew MacLeod
  :  [5, 7]  mask 0x3 value 0x4    //  first 6 bits are known to be 01 Bootstraps on  x86_64-pc-linux-gnu with no regressions.   Pushed. Andrew From 65cd212bd4c533351a09e6974f40ae5d7effca84 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Wed, 14 May 2025 11:12:22 -0400 Subject: [PATCH 2/

[COMMITTED][gcc13] PR tree-optimization/117287 - Backport new assume implementation

2025-05-14 Thread Andrew MacLeod
On 4/29/25 18:00, Andrew MacLeod wrote: On 3/28/25 05:25, Jakub Jelinek wrote: On Fri, Mar 28, 2025 at 08:12:35AM +0100, Richard Biener wrote: On Thu, Mar 27, 2025 at 8:14 PM Andrew MacLeod wrote: This patch backports the ASSUME support that was rewritten in GCC 15. Its slightly more

[COMMITTED] Remove negative ranges using trailing zero masks.

2025-05-12 Thread Andrew MacLeod
regressions.   Pushed. Andrew From c40a4cc2d943d8572a62f21d3eb1d4171e51d5ac Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 8 May 2025 20:28:11 -0400 Subject: [PATCH] Remove negative ranges using trailing zero masks. When there are trailing 0's in the bitmask, set_range_from_bitmask ()

[COMMITTED] PR tree-optimization/120231 - Add dispatch for casts between integer and float.

2025-05-12 Thread Andrew MacLeod
perator for new operand combinations. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From 6f375445ef09d5c97d5bcc0fcb6069612217963e Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 12 May 2025 11:41:37 -0400 Subject: [PATCH] Add dispatch for casts between intege

[PATCH] [GCC14] PR tree-optimization/120048 - Allow IPA_CP to handle UNDEFINED as VARYING.

2025-05-05 Thread Andrew MacLeod
On 5/3/25 07:41, Richard Biener wrote: On Sat, May 3, 2025 at 12:39 AM Andrew MacLeod wrote: On trunk I'll eventually do something different.. but it will be more invasive than I think is reasonable for a backport. The problem in the PR is that there is a variable with a range and

[PATCH][GCC15] PR tree-optimization/120048 - Allow IPA_CP to handle UNDEFINED as VARYING.

2025-05-05 Thread Andrew MacLeod
On 5/3/25 07:41, Richard Biener wrote: On Sat, May 3, 2025 at 12:39 AM Andrew MacLeod wrote: On trunk I'll eventually do something different.. but it will be more invasive than I think is reasonable for a backport. The problem in the PR is that there is a variable with a range and

Re: [PATCH][gcc13] PR tree-optimization/117287 - Backport new assume implementation

2025-05-04 Thread Andrew MacLeod
e: On Fri, Mar 28, 2025 at 08:12:35AM +0100, Richard Biener wrote: On Thu, Mar 27, 2025 at 8:14 PM Andrew MacLeod wrote: This patch backports the ASSUME support that was rewritten in GCC 15. Its slightly more complicated than the port to GCC 14 was in that a few classes have been rewritten. I&#

Re: [PATCH] PR tree-optimization/120048 - Allow IPA_CP to handle UNDEFINED as VARYING.

2025-05-03 Thread Andrew MacLeod
On 5/3/25 07:41, Richard Biener wrote: On Sat, May 3, 2025 at 12:39 AM Andrew MacLeod wrote: On trunk I'll eventually do something different.. but it will be more invasive than I think is reasonable for a backport. The problem in the PR is that there is a variable with a range and

[PATCH] PR tree-optimization/120048 - Allow IPA_CP to handle UNDEFINED as VARYING.

2025-05-02 Thread Andrew MacLeod
more failure. bootstraps on -x86_64-pc-linux-gnu  with no regressions. If this is acceptable, I will push it to trunk, then also test/verify for the GCC15 and 14(?) branches and check it in there. Andrew From bfe4b05074232fbba28f0c189762f46f3b042616 Mon Sep 17 00:00:00 2001 From: Andrew MacLe

Re: [PATCH] ranger: Improve nonnull_if_nonzero attribute [PR117023]

2025-05-02 Thread Andrew MacLeod
OK by me. Andrew On 5/2/25 10:48, Jakub Jelinek wrote: On Mon, Mar 31, 2025 at 11:30:20AM -0400, Andrew MacLeod wrote: From 7116177599a3bb907d21fe642a4bdcb401e1263b Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 31 Mar 2025 11:18:22 -0400 Subject: [PATCH 2/2] Use the current cache

Re: [COMMITTED] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-30 Thread Andrew MacLeod
On 4/30/25 02:56, Richard Biener wrote: On Wed, Apr 30, 2025 at 12:00 AM Andrew MacLeod wrote: On 4/28/25 17:26, Andrew MacLeod wrote: I have committed this patch to trunk after bootstrap/regression testing again on trunk. I'll get to gcc14/15 once I flush the current queue. Andrew

Re: [PATCH][gcc13] PR tree-optimization/117287 - Backport new assume implementation

2025-04-29 Thread Andrew MacLeod
On 3/28/25 05:25, Jakub Jelinek wrote: On Fri, Mar 28, 2025 at 08:12:35AM +0100, Richard Biener wrote: On Thu, Mar 27, 2025 at 8:14 PM Andrew MacLeod wrote: This patch backports the ASSUME support that was rewritten in GCC 15. Its slightly more complicated than the port to GCC 14 was in

Re: [PATCH] PR tree-optimization/95801 - infer non-zero for integral division RHS.

2025-04-29 Thread Andrew MacLeod
On 4/28/25 17:26, Andrew MacLeod wrote: I have committed this patch to trunk after bootstrap/regression testing again on trunk. I'll get to gcc14/15 once I flush the current queue. Andrew On 1/23/25 04:39, Richard Biener wrote: On Wed, Jan 22, 2025 at 12:49 AM Andrew MacLeod wrote:

Re: [COMMITTED] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-29 Thread Andrew MacLeod
On 4/28/25 17:26, Andrew MacLeod wrote: I have committed this patch to trunk after bootstrap/regression testing again on trunk. I'll get to gcc14/15 once I flush the current queue. Andrew On 4/17/25 06:44, Richard Biener wrote: On Wed, Apr 16, 2025 at 10:55 PM Andrew MacLeod wrote:

Re: [PATCH] PR tree-optimization/119471 - If the LHS does not contain zero, neither do multiply operands.

2025-04-29 Thread Andrew MacLeod
On 3/28/25 10:36, Andrew MacLeod wrote: On 3/28/25 03:19, Richard Biener wrote: On Fri, Mar 28, 2025 at 12:28 AM Andrew MacLeod wrote: This patch fixes both 119471 and the remainder of 110992. At issue is we do not recognize that if     "a * b != 0" , then neither "a"

[COMMITTED] Do not overwrite relation in range_of_range_op.

2025-04-28 Thread Andrew MacLeod
etween LHS and OP2...   so I dont think it needs back porting at this point... although it would be harmless to do so. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From 1df77858cac29c71fc29bc6571e17d3b26d9d176 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: T

[COMITTED] Add a Relation iterator to the relation oracle.

2025-04-28 Thread Andrew MacLeod
"nearest" relations. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From bf2e0fb97183d46a84d283b795067d586d874556 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 10 Feb 2025 16:14:17 -0500 Subject: [PATCH 6/9] Add a Relation iterator to the relation ora

[COMMITTED] Add lhs_op1 relation to pointer_plus.

2025-04-28 Thread Andrew MacLeod
new dispatch patterns to range-ops as lhs_op1_relation had no prange/prange/irange combination. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From 6b88dab02640f1653bbab66f411da1d28ef1c1dc Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 22 Apr 2025 10:36:26 -0400 Subj

[COMMITTED] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-28 Thread Andrew MacLeod
I have committed this patch to trunk after bootstrap/regression testing again on trunk. I'll get to gcc14/15 once I flush the current queue. Andrew On 4/17/25 06:44, Richard Biener wrote: On Wed, Apr 16, 2025 at 10:55 PM Andrew MacLeod wrote: This was a fun one! An actual bug, a

[COMMITTED ]Use the current Ranger cache when creating inferred ranges.

2025-04-28 Thread Andrew MacLeod
sions.  Pushed. Andrew From f2e2d6202b1af94a22775706d9987f155f3f6760 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 31 Mar 2025 11:18:22 -0400 Subject: [PATCH 3/9] Use the current cache when creating inferred ranges. Infer range processing was adjusted to allow a query to be specified, but d

Re: [PATCH] PR tree-optimization/95801 - infer non-zero for integral division RHS.

2025-04-28 Thread Andrew MacLeod
I have committed this patch to trunk after bootstrap/regression testing again on trunk. I'll get to gcc14/15 once I flush the current queue. Andrew On 1/23/25 04:39, Richard Biener wrote: On Wed, Jan 22, 2025 at 12:49 AM Andrew MacLeod wrote: This patch simply adds an op2_ran

Re: [PATCH] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-16 Thread Andrew MacLeod
On 4/16/25 16:55, Andrew MacLeod wrote: I started at a 0.2% overall compilation increase (1.8% in VRP). In the end, this patch is down to 0.6% in VRP, and only 0.08% overall, so manageable for all the extra work. Final version performance run... VRP slowed down by 0.28% Threading sped

Re: [PATCH] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-16 Thread Andrew MacLeod
On 4/16/25 17:28, Sam James wrote: Andrew MacLeod writes: * gcc.dg/tree-ssa/phi-opt-value-5.c  : WIth the expanded ranges, CCP2 pass use to export:    Global Exported: d_3 = [irange] int [-INF, +INF] MASK 0xfffe VALUE 0x1 and now    Global Exported: d_3 = [irange] int [-INF, -1][1

[PATCH] PR tree-optimization/119712 - Always reflect lower bits from mask in subranges.

2025-04-16 Thread Andrew MacLeod
bitmask is explicitly applied in some places and not others. Bootstraps on x86_64-pc-linux-gnu with no regressions. Finally.   Is this OK for trunk, or should I hold off a little bit? Andrew From 36e4b77565a1965d5bca15d196f32d5758393063 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-11 Thread Andrew MacLeod
On 4/11/25 10:27, Qing Zhao wrote: On Apr 10, 2025, at 11:12, Martin Uecker wrote: Am Donnerstag, dem 10.04.2025 um 10:55 -0400 schrieb Siddhesh Poyarekar: On 2025-04-10 10:50, Andrew MacLeod wrote: Its not clear to me exactly what is being asked, but I think the suggestion is that

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-11 Thread Andrew MacLeod
On 4/11/25 11:36, Qing Zhao wrote: On Apr 11, 2025, at 10:42, Andrew MacLeod wrote: On 4/11/25 10:27, Qing Zhao wrote: On Apr 10, 2025, at 11:12, Martin Uecker wrote: Am Donnerstag, dem 10.04.2025 um 10:55 -0400 schrieb Siddhesh Poyarekar: On 2025-04-10 10:50, Andrew MacLeod wrote

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-11 Thread Andrew MacLeod
On 4/11/25 10:05, Qing Zhao wrote: On Apr 10, 2025, at 10:55, Siddhesh Poyarekar wrote: On 2025-04-10 10:50, Andrew MacLeod wrote: Its not clear to me exactly what is being asked, but I think the suggestion is that pointer references are being replaced with a builtin function called

Re: .ACCESS_WITH_SIZE and pointer ranges

2025-04-10 Thread Andrew MacLeod
On 4/8/25 13:13, Siddhesh Poyarekar wrote: On 2025-04-08 12:41, Qing Zhao wrote: For the following small example: [ counted_by_whole]$ cat t.c #include #include struct annotated {    size_t count;    char other;    char array[] __attribute__((counted_by (count))); }; #define MAX(A, B) (A

Re: [PATCH] tailc: Use the IPA-VRP tail call hack even for pointers [PR119614]

2025-04-04 Thread Andrew MacLeod
On 4/4/25 00:57, Jakub Jelinek wrote: Hi! As the first two testcases show, even with pointers IPA-VRP can optimize return values from functions if they have singleton ranges into just the exact value, so we need to virtually undo that for tail calls similarly to integers and floats. The third

Re: [PATCH] ranger: Improve nonnull_if_nonzero attribute [PR117023]

2025-03-31 Thread Andrew MacLeod
On 3/29/25 20:54, Jeff Law wrote: On 3/4/25 2:10 AM, Jakub Jelinek wrote: Hi! On Fri, Nov 22, 2024 at 07:25:23PM -0500, Andrew MacLeod wrote:   I will shortly be submitting , and presumable committing, this patch as part of a series to improve VRP time for 117467.. So it may be in place

Re: [PATCH] PR tree-optimization/119471 - If the LHS does not contain zero, neither do multiply operands.

2025-03-28 Thread Andrew MacLeod
On 3/28/25 03:19, Richard Biener wrote: On Fri, Mar 28, 2025 at 12:28 AM Andrew MacLeod wrote: This patch fixes both 119471 and the remainder of 110992. At issue is we do not recognize that if "a * b != 0" , then neither "a" nor "b" can be zero. This is

[PATCH] PR tree-optimization/119471 - If the LHS does not contain zero, neither do multiply operands.

2025-03-27 Thread Andrew MacLeod
nches.  OK for gcc13 and gcc14 branches? Andrew From 74edd2831affac005d2d5bf0170668188aa1a091 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 27 Mar 2025 13:44:00 -0400 Subject: [PATCH] If the LHS does not contain zero, neither do multiply operands. Given ~[0,0] = op1 * op2, range-ops sho

[PATCH][gcc13] PR tree-optimization/117287 - Backport new assume implementation

2025-03-27 Thread Andrew MacLeod
x-gnu with no regressions. Andrew From e39271c8c13b8fd5a49349000bfe8639c25cf470 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 27 Mar 2025 10:51:16 -0400 Subject: [PATCH 1/2] backport new assume implementation and cache. --- gcc/Makefile.in| 1 + gcc/gi

Re: [RFA][PR tree-optimization/98028] Use relationship between operands to simplify SUB_OVERFLOW

2025-02-12 Thread Andrew MacLeod
On 2/12/25 10:18, Jakub Jelinek wrote: On Tue, Feb 11, 2025 at 05:20:49PM -0700, Jeff Law wrote: So this is a fairly old regression, but with all the ranger work that's been done, it's become easy to resolve. The basic idea here is to use known relationships between two operands of a SUB_OVER

Re: [RFA][PR tree-optimization/98028] Use relationship between operands to simplify SUB_OVERFLOW

2025-02-12 Thread Andrew MacLeod
The patch is mostly fine, although you probably want to change the condition to check for a non-null stmt as well... ie -   if (subcode == MINUS_EXPR) +  if (s && subcode == MINUS_EXPR) because it looks like the stmt defaults to NULL and I suspect the relation query will trap if S is null. I

[PATCH] PR tree-optimization/95801 - infer non-zero for integral division RHS.

2025-01-21 Thread Andrew MacLeod
ndrew From 83260dd7c035a2317a6a5083d70288c3fdaf6ab4 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 21 Jan 2025 11:49:12 -0500 Subject: [PATCH] infer non-zero for integral division RHS. Adding op2_range for operator_div allows ranger to notice the divisor is non-zero after execution.

[PATCH] PR tree-optimization/88575 - Use relations when simplifying MIN and MAX.

2025-01-10 Thread Andrew MacLeod
00:00 2001 From: Andrew MacLeod Date: Fri, 10 Jan 2025 13:33:01 -0500 Subject: [PATCH] Use relations when simplifying MIN and MAX. Query for known relations between the operands, and pass that to fold_range to help simplify MIN and MAX relations. Make it type agnostic as well. Adapt testcases from D

Re: [PATCH] Fix comment typos in tree-assume.cc

2024-12-19 Thread Andrew MacLeod
I have no issues. ok by me.  I clearly need a proofreader :-) Andrew On 12/18/24 11:22, Andrew Carlotti wrote: I think this counts as obvious, but I'll leave it a few days before committing in case Andrew (or anyone else) disagrees. gcc/ChangeLog: * tree-assume.cc: Fix comment typos.

Re: [PATCH 1/3] tree-optimization/117467 - Do not calculate an entry range for invariant names.

2024-12-06 Thread Andrew MacLeod
, Nov 25, 2024 at 07:55:46PM -0500, Andrew MacLeod wrote: From 97bea858ff782dc5c80490bb48cbd3241ad3413c Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 25 Nov 2024 09:50:33 -0500 Subject: [PATCH 1/3] Do not calculate an entry range for invariant names. If an SSA_NAME is invariant, do not

[PATCH 2/3] PR tree-optimization/117467 - Add a range query to inferred ranges.

2024-11-25 Thread Andrew MacLeod
registering redundant inferred ranges . Bootstraps on build-x86_64-pc-linux-gnu with no regressions.  OK? Andrew From 0aee6d112bf4dd9accd7aaa8b48a520a878dedf9 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Sat, 16 Nov 2024 08:29:30 -0500 Subject: [PATCH 2/3] Add a range query to inferred ranges

[PATCH 3/3] PR tree-optimization/117647 - Only add inferred ranges if they change the value.

2024-11-25 Thread Andrew MacLeod
-gnu with no regressions.  OK? Andrew From 9434efb95a481ea57db8d47919d05cbe17b8bcba Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Sat, 23 Nov 2024 14:05:54 -0500 Subject: [PATCH 3/3] Only add inferred ranges if they change the value. Do not add an inferred range if it is already

[PATCH 1/3] tree-optimization/117467 - Do not calculate an entry range for invariant names.

2024-11-25 Thread Andrew MacLeod
n Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 25 Nov 2024 09:50:33 -0500 Subject: [PATCH 1/3] Do not calculate an entry range for invariant names. If an SSA_NAME is invariant, do not calculate an on_entry value. PR tree-optimization/117467 * gimple-range-cache.cc (ranger_cache::entry_

Re: [PATCH] ranger, v2: Handle nonnull_if_nonzero attribute [PR117023]

2024-11-22 Thread Andrew MacLeod
FYI,  I will shortly be submitting , and presumable committing, this patch as part of a series to improve VRP time for 117467.. So it may be in place by the time you need it Andrew On 11/18/24 09:31, Andrew MacLeod wrote: Attached is a pre-approved patch which adds a range_query to the

Re: [PATCH] ranger, v2: Handle nonnull_if_nonzero attribute [PR117023]

2024-11-18 Thread Andrew MacLeod
as a bootstrap with your patches.. Andfrew On 11/15/24 04:36, Jakub Jelinek wrote: On Thu, Nov 14, 2024 at 06:25:49PM +0100, Jakub Jelinek wrote: On Thu, Nov 14, 2024 at 10:05:05AM -0500, Andrew MacLeod wrote: The inferred range mechanism is also initialized using cfun, so again introducing a

Re: [PATCH] ranger, v2: Handle nonnull_if_nonzero attribute [PR117023]

2024-11-15 Thread Andrew MacLeod
Unfortunately that broke bootstrap. https://gcc.gnu.org/pipermail/gcc-patches/2024-November/668554.html https://gcc.gnu.org/pipermail/gcc-patches/2024-November/668699.html https://gcc.gnu.org/pipermail/gcc-patches/2024-November/668700.html https://gcc.gnu.org/pipermail/gcc-patches/2024-November/66

Re: [PATCH] ranger, v2: Handle nonnull_if_nonzero attribute [PR117023]

2024-11-15 Thread Andrew MacLeod
On 11/15/24 04:36, Jakub Jelinek wrote: On Thu, Nov 14, 2024 at 06:25:49PM +0100, Jakub Jelinek wrote: On Thu, Nov 14, 2024 at 10:05:05AM -0500, Andrew MacLeod wrote: The inferred range mechanism is also initialized using cfun, so again introducing a use of cfun shouldnt be an issue

Re: [PATCH 5/8] ipa: Update value range jump functions during inlining

2024-11-15 Thread Andrew MacLeod
On 11/15/24 10:19, Jan Hubicka wrote: I have seen this happen when the result of the intersection is an empty set (one of the few comments in value-range.h actually describes an undefined range as an "empty range"). I have only seen this happen when the edge has been redirected to builtin_unre

Re: [PATCH] ranger: Handle nonnull_if_nonzero attribute [PR117023]

2024-11-14 Thread Andrew MacLeod
On 11/14/24 05:26, Jakub Jelinek wrote: Hi! On top of the https://gcc.gnu.org/pipermail/gcc-patches/2024-November/668554.html patch which introduces the nonnull_if_nonzero attribute (because C2Y is allowing NULL arguments on various calls like memcpy, memset, strncpy etc. as long as the count

[COMMITTED] Add details output for assume processing.

2024-11-06 Thread Andrew MacLeod
were made.  I'll add a gcc14 version in a few days to keep them in sync.. assuming we want that. Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. Andrew From 137b26412f681bb1f8b3eb52b8f9efd79e6bda2a Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 5 Nov 2024 12:

Re: [COMMITTED] PR tree-optimization/117398 - Don't call invert on VARYING.

2024-11-05 Thread Andrew MacLeod
On 11/5/24 03:37, Richard Biener wrote: On Mon, Nov 4, 2024 at 4:52 PM Andrew MacLeod wrote: Am 04.11.2024 um 16:32 schrieb Andrew MacLeod :  On 11/4/24 10:27, Richard Biener wrote: Am 04.11.2024 um 16:01 schrieb Andrew MacLeod : The invert() range operation is not supported on

Re: [COMMITTED] [gcc12] [gcc13] [gcc14] PR tree-optimization/117398 - Don't call invert on VARYING.

2024-11-04 Thread Andrew MacLeod
On 11/4/24 10:00, Andrew MacLeod wrote: The invert() range operation is not supported on values of either VARYING or UNDEFINED.  Primarily this is because UNDEFINED has no type, which makes it impossible to perform invert() twice on a value, and produce that same value.  There were also

Re: [COMMITTED] PR tree-optimization/117398 - Don't call invert on VARYING.

2024-11-04 Thread Andrew MacLeod
Am 04.11.2024 um 16:32 schrieb Andrew MacLeod :  On 11/4/24 10:27, Richard Biener wrote: Am 04.11.2024 um 16:01 schrieb Andrew MacLeod : The invert() range operation is not supported on values of either VARYING or UNDEFINED. Primarily this is because UNDEFINED has no type, which

Re: [COMMITTED] PR tree-optimization/117398 - Don't call invert on VARYING.

2024-11-04 Thread Andrew MacLeod
On 11/4/24 10:27, Richard Biener wrote: Am 04.11.2024 um 16:01 schrieb Andrew MacLeod : The invert() range operation is not supported on values of either VARYING or UNDEFINED. Primarily this is because UNDEFINED has no type, which makes it impossible to perform invert() twice on a value

[COMMITTED] PR tree-optimization/117398 - Don't call invert on VARYING.

2024-11-04 Thread Andrew MacLeod
hed. Backports to GCC12 - 14 forthcoming. Andrew From 766075c47db5cc9d04463bfb2219b593bb4263ee Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Sat, 2 Nov 2024 10:26:24 -0400 Subject: [PATCH] Don't call invert on VARYING. When all cases go to one label and resul in a VARYING value,

[COMMITTED] [GCC14] Implement new assume pass.

2024-11-04 Thread Andrew MacLeod
anger instance into the assume pass to access gori. Other than that, they are pretty much in sync. Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. Andrew From 34db084961e01172de81f7689f31fe30fb0a781a Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 31 Oct 2024 14:

Re: [COMMITTED 3/3] Update bitwise_or op_range.

2024-11-02 Thread Andrew MacLeod
Fresh extract and bootstrap, and I dont see those spurious failures I mnetioned.  And everything is good with the port of these patches too on GCC14.  so whenever seems reasonable. Andrew On 11/1/24 17:10, Andrew MacLeod wrote: It eas an existing branch.  I will get a scrtach branch and do

Re: [COMMITTED 3/3] Update bitwise_or op_range.

2024-11-01 Thread Andrew MacLeod
.. it should. Andrew On 11/1/24 17:05, Jakub Jelinek wrote: On Fri, Nov 01, 2024 at 05:00:05PM -0400, Andrew MacLeod wrote: no, I mean those are on the branch as is...  at least when I extracted and built stage 1 release gcc14 branch. UNless there was something wrong with my build which I

Re: [COMMITTED 3/3] Update bitwise_or op_range.

2024-11-01 Thread Andrew MacLeod
, Jakub Jelinek wrote: On Fri, Nov 01, 2024 at 04:00:17PM -0400, Andrew MacLeod wrote: Maybe.  The bitwise_and op1_range is very complicated.. I think its heavily used, so I would be surprised if it didn't.   bitwise or was doing nothing at all and showed up immediately when I tried a few t

Re: [COMMITTED 3/3] Update bitwise_or op_range.

2024-11-01 Thread Andrew MacLeod
errors Andrew On 11/1/24 15:45, Jakub Jelinek wrote: On Fri, Nov 01, 2024 at 03:25:37PM -0400, Andrew MacLeod wrote: When experimenting with more complex flow for the assume pass, I found a case where we were not as precise as we should be, but it was because range-ops hadn't been taught

[COMMITTED 2/3] PR tree-optimization/117287 - Reimplement 'assume' processing pass.

2024-11-01 Thread Andrew MacLeod
es to this alogithm.  This is certainly better than it was before anyway, and I think it should always be correct. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From 74710442f291902c19b84cebf7642b74ecec8965 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 28 Oct 202

[COMMITTED 3/3] Update bitwise_or op_range.

2024-11-01 Thread Andrew MacLeod
3f708a4fc11fb6dfcf208ab218a5d9 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 31 Oct 2024 14:07:00 -0400 Subject: [PATCH 3/3] Update bitwise_or op_range. If the LHS of a bitwise OR is positive, then so are both operands when using op1_range or op2_range. gcc/ * range-op.cc (operator_bit

[COMMITTED 1/3] Make fur_edge accessible.

2024-11-01 Thread Andrew MacLeod
. Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed. Andrew From 548a78d0e4c02f1e5d07c8812d4324fef581d14b Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 31 Oct 2024 15:44:15 -0400 Subject: [PATCH 1/3] Make fur_edge accessible. Move the decl of fur_edge out of the source file

[COMMITTED] - Fix bitwise_or logic for prange.

2024-10-28 Thread Andrew MacLeod
Fixed. Bootstrapped on with no regressions.  Pushed. Andrew On 10/28/24 10:25, Mikael Morin wrote: Le 28/10/2024 à 14:38, Andrew MacLeod a écrit : On 10/26/24 15:08, Mikael Morin wrote: Hello, Le 24/10/2024 à 14:53, Andrew MacLeod a écrit : diff --git a/gcc/range-op-ptr.cc b/gcc/range-op

Re: [COMMITTED 4/4] - Implement pointer_or_operator.

2024-10-28 Thread Andrew MacLeod
On 10/26/24 15:08, Mikael Morin wrote: Hello, Le 24/10/2024 à 14:53, Andrew MacLeod a écrit : diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc index dd312a80366..ef2b2cce516 100644 --- a/gcc/range-op-ptr.cc +++ b/gcc/range-op-ptr.cc (...) -void -pointer_or_operator::wi_fold (irange

  1   2   3   4   5   6   7   8   9   10   >