Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-08-03 Thread Richard Biener via Gcc-patches
On Thu, Aug 3, 2023 at 5:21 PM Jeff Law wrote: > > > > On 8/3/23 01:04, Richard Biener wrote: > > On Wed, Aug 2, 2023 at 4:08 PM Manolis Tsamis > > wrote: > >> > >> Hi all, > >> > >> I'm pinging to discuss again if we want to move this forward for GCC14. > >> > >> I did some testing again and I

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-08-03 Thread Jeff Law via Gcc-patches
On 8/3/23 01:04, Richard Biener wrote: On Wed, Aug 2, 2023 at 4:08 PM Manolis Tsamis wrote: Hi all, I'm pinging to discuss again if we want to move this forward for GCC14. I did some testing again and I haven't been able to find obvious regressions, including testing the code from PR86270

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-08-03 Thread Richard Biener via Gcc-patches
On Wed, Aug 2, 2023 at 4:08 PM Manolis Tsamis wrote: > > Hi all, > > I'm pinging to discuss again if we want to move this forward for GCC14. > > I did some testing again and I haven't been able to find obvious > regressions, including testing the code from PR86270 and PR70359 that > Richard mentio

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-08-02 Thread Manolis Tsamis
Hi all, I'm pinging to discuss again if we want to move this forward for GCC14. I did some testing again and I haven't been able to find obvious regressions, including testing the code from PR86270 and PR70359 that Richard mentioned. I still believe that zero can be considered a special case even

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-04-25 Thread Richard Biener via Gcc-patches
On Wed, Apr 26, 2023 at 4:30 AM Jeff Law wrote: > > > > On 4/25/23 01:21, Richard Biener wrote: > > On Tue, Apr 25, 2023 at 1:05 AM Jeff Law wrote > >> > >> > >> > >> > >> On 4/24/23 02:06, Richard Biener via Gcc-patches wrote: > >>> On Fri, Apr 21, 2023 at 11:01 PM Philipp Tomsich > >>> wrote:

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-04-25 Thread Jeff Law via Gcc-patches
On 4/25/23 01:21, Richard Biener wrote: On Tue, Apr 25, 2023 at 1:05 AM Jeff Law wrote On 4/24/23 02:06, Richard Biener via Gcc-patches wrote: On Fri, Apr 21, 2023 at 11:01 PM Philipp Tomsich wrote: Any guidance on the next steps for this patch? I think we want to perform this tran

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-04-25 Thread Richard Biener via Gcc-patches
On Tue, Apr 25, 2023 at 1:05 AM Jeff Law wrote > > > > > On 4/24/23 02:06, Richard Biener via Gcc-patches wrote: > > On Fri, Apr 21, 2023 at 11:01 PM Philipp Tomsich > > wrote: > >> > >> Any guidance on the next steps for this patch? > > > > I think we want to perform this transform later, in par

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-04-24 Thread Jeff Law via Gcc-patches
On 4/24/23 02:06, Richard Biener via Gcc-patches wrote: On Fri, Apr 21, 2023 at 11:01 PM Philipp Tomsich wrote: Any guidance on the next steps for this patch? I think we want to perform this transform later, in particular when the test is a loop exit test we do not want to do it as it p

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-04-24 Thread Richard Biener via Gcc-patches
On Fri, Apr 21, 2023 at 11:01 PM Philipp Tomsich wrote: > > Any guidance on the next steps for this patch? I think we want to perform this transform later, in particular when the test is a loop exit test we do not want to do it as it prevents coalescing of the IV on the backedge at out-of-SSA tim

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-04-21 Thread Philipp Tomsich
Any guidance on the next steps for this patch? I believe that we answered all open questions, but may have missed something. With trunk open for new development, we would like to revise and land this… Thanks, Philipp. On Mon, 20 Mar 2023 at 15:02, Manolis Tsamis wrote: > > On Fri, Mar 17, 2023

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-23 Thread Jeff Law via Gcc-patches
On 3/20/23 08:01, Manolis Tsamis wrote: On Fri, Mar 17, 2023 at 10:31 AM Richard Biener wrote: On Thu, Mar 16, 2023 at 4:27 PM Manolis Tsamis wrote: For this C testcase: void g(); void f(unsigned int *a) { if (++*a == 1) g(); } GCC will currently emit a comparison with 1 by usi

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-20 Thread Manolis Tsamis
On Fri, Mar 17, 2023 at 10:31 AM Richard Biener wrote: > > On Thu, Mar 16, 2023 at 4:27 PM Manolis Tsamis > wrote: > > > > For this C testcase: > > > > void g(); > > void f(unsigned int *a) > > { > > if (++*a == 1) > > g(); > > } > > > > GCC will currently emit a comparison with 1 by using

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-17 Thread Andrew Waterman via Gcc-patches
On Fri, Mar 17, 2023 at 6:16 AM Philipp Tomsich wrote: > > On Fri, 17 Mar 2023 at 09:31, Richard Biener > wrote: > > > > On Thu, Mar 16, 2023 at 4:27 PM Manolis Tsamis > > wrote: > > > > > > For this C testcase: > > > > > > void g(); > > > void f(unsigned int *a) > > > { > > > if (++*a == 1)

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-17 Thread Andrew MacLeod via Gcc-patches
On 3/17/23 04:31, Richard Biener wrote: On Thu, Mar 16, 2023 at 4:27 PM Manolis Tsamis wrote: For this C testcase: void g(); void f(unsigned int *a) { if (++*a == 1) g(); } GCC will currently emit a comparison with 1 by using the value of *a after the increment. This can be improved

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-17 Thread Richard Biener via Gcc-patches
On Fri, Mar 17, 2023 at 2:15 PM Philipp Tomsich wrote: > > On Fri, 17 Mar 2023 at 09:31, Richard Biener > wrote: > > > > On Thu, Mar 16, 2023 at 4:27 PM Manolis Tsamis > > wrote: > > > > > > For this C testcase: > > > > > > void g(); > > > void f(unsigned int *a) > > > { > > > if (++*a == 1)

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-17 Thread Philipp Tomsich
On Fri, 17 Mar 2023 at 09:31, Richard Biener wrote: > > On Thu, Mar 16, 2023 at 4:27 PM Manolis Tsamis > wrote: > > > > For this C testcase: > > > > void g(); > > void f(unsigned int *a) > > { > > if (++*a == 1) > > g(); > > } > > > > GCC will currently emit a comparison with 1 by using th

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-17 Thread Richard Biener via Gcc-patches
On Thu, Mar 16, 2023 at 4:27 PM Manolis Tsamis wrote: > > For this C testcase: > > void g(); > void f(unsigned int *a) > { > if (++*a == 1) > g(); > } > > GCC will currently emit a comparison with 1 by using the value > of *a after the increment. This can be improved by comparing > against 0

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-16 Thread Philipp Tomsich
Just to add a bit more color on this one... It was originally observed (and isolated from) _ZN11xalanc_1_1027XalanReferenceCountedObject12addReferenceEPS0_ and reproduces both for AArch64 and RISC-V. The basic block (annotated with dynamic instructions executed and percentage of total dynamic inst

Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-16 Thread Jeff Law via Gcc-patches
On 3/16/23 09:27, Manolis Tsamis wrote: For this C testcase: void g(); void f(unsigned int *a) { if (++*a == 1) g(); } GCC will currently emit a comparison with 1 by using the value of *a after the increment. This can be improved by comparing against 0 and using the value before the

[PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop.

2023-03-16 Thread Manolis Tsamis
For this C testcase: void g(); void f(unsigned int *a) { if (++*a == 1) g(); } GCC will currently emit a comparison with 1 by using the value of *a after the increment. This can be improved by comparing against 0 and using the value before the increment. As a result there is a potentially s