Re: [PATCH] fold fold_truth_andor field merging into ifcombine

2024-11-04 Thread Alexandre Oliva
On Oct 20, 2024, Alexandre Oliva wrote: > the x86 hits are newer, and > the line numbers didn't help me find the errors, so I don't even know > whether it's macros that we're talking about. These new warnings were > encouraging, for they showed that the ifcombine incarnation of the patch > cover

Re: [PATCH #8/7++] limit ifcombine stmt moving and adjust flow info (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-11-04 Thread Richard Biener
On Sat, Nov 2, 2024 at 12:20 PM Alexandre Oliva wrote: > > > It became apparent that conditions could be combined that had deep SSA > dependency trees, that might thus require moving lots of statements. > Set a hard upper bound for now, hopefully to be replaced by a > dynamically computed bound, b

[PATCH #8/7++] limit ifcombine stmt moving and adjust flow info (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-11-02 Thread Alexandre Oliva
It became apparent that conditions could be combined that had deep SSA dependency trees, that might thus require moving lots of statements. Set a hard upper bound for now, hopefully to be replaced by a dynamically computed bound, based on probabilities and costs. Also reset flow sensitive info a

Re: [PATCH #2/7] drop redundant ifcombine_ifandif parm (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-30 Thread Richard Biener
On Fri, Oct 25, 2024 at 4:39 PM Alexandre Oliva wrote: > > > In preparation to changes that may modify both inner and outer > conditions in ifcombine, drop the redundant parameter result_inv, that > is always identical to inner_inv. OK. > > for gcc/ChangeLog > > * tree-ssa-ifcombine.cc

Re: [PATCH #6/7] ifcombine across noncontiguous blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-30 Thread Richard Biener
On Fri, Oct 25, 2024 at 4:39 PM Alexandre Oliva wrote: > > > Rework ifcombine to support merging conditions from noncontiguous > blocks. This depends on earlier preparation changes. > > The function that attempted to ifcombine a block with its immediate > predecessor, tree_ssa_ifcombine_bb, now l

Re: [PATCH #5/7] extend ifcombine_replace_cond to handle noncontiguous ifcombine (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-30 Thread Richard Biener
On Fri, Oct 25, 2024 at 4:39 PM Alexandre Oliva wrote: > > > Prepare to handle noncontiguous ifcombine, introducing logic to modify > the outer condition when needed. There are two cases worth > mentioning: > > - when blocks are noncontiguous, we have to place the combined > condition in the ou

Re: [PATCH #4/7] adjust update_profile_after_ifcombine for noncontiguous ifcombine (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-30 Thread Richard Biener
On Fri, Oct 25, 2024 at 4:39 PM Alexandre Oliva wrote: > > > Prepare for ifcombining noncontiguous blocks, adding (still unused) > logic to the ifcombine profile updater to handle such cases. > > > for gcc/ChangeLog > > * tree-ssa-ifcombine.cc (known_succ_p): New. > (update_profil

Re: [PATCH #3/7] introduce ifcombine_replace_cond (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-30 Thread Richard Biener
On Fri, Oct 25, 2024 at 4:39 PM Alexandre Oliva wrote: > > > Refactor ifcombine_ifandif, moving the common code from the various > paths that apply the combined condition to a new function. > > > for gcc/ChangeLog > > * tree-ssa-ifcombine.cc (ifcombine_replace_cond): Factor out >

Re: [PATCH #1/7] allow vuses in ifcombine blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-30 Thread Richard Biener
On Fri, Oct 25, 2024 at 4:39 PM Alexandre Oliva wrote: > > > Disallowing vuses in blocks for ifcombine is too strict, and it > prevents usefully moving fold_truth_andor into ifcombine. That > tree-level folder has long ifcombined loads, absent other relevant > side effects. OK. Richard. > > fo

[PATCH #7/7] handle TRUTH_ANDIF cond exprs in ifcombine_replace_cond (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
The upcoming move of fold_truth_andor to ifcombine brings with it the possibility of TRUTH_ANDIF cond exprs. Handle them by splitting the cond so as to best use both BB insertion points, but only if they're contiguous. for gcc/ChangeLog * tree-ssa-ifcombine.c (ifcombine_replace_cond)

[PATCH #5/7] extend ifcombine_replace_cond to handle noncontiguous ifcombine (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
Prepare to handle noncontiguous ifcombine, introducing logic to modify the outer condition when needed. There are two cases worth mentioning: - when blocks are noncontiguous, we have to place the combined condition in the outer block to avoid pessimizing carefully crafted short-circuited te

[PATCH #6/7] ifcombine across noncontiguous blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
Rework ifcombine to support merging conditions from noncontiguous blocks. This depends on earlier preparation changes. The function that attempted to ifcombine a block with its immediate predecessor, tree_ssa_ifcombine_bb, now loops over dominating blocks eligible for ifcombine, attempting to c

[PATCH #3/7] introduce ifcombine_replace_cond (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
Refactor ifcombine_ifandif, moving the common code from the various paths that apply the combined condition to a new function. for gcc/ChangeLog * tree-ssa-ifcombine.cc (ifcombine_replace_cond): Factor out of... (ifcombine_ifandif): ... this. --- gcc/tree-ssa-ifcombin

[PATCH #4/7] adjust update_profile_after_ifcombine for noncontiguous ifcombine (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
Prepare for ifcombining noncontiguous blocks, adding (still unused) logic to the ifcombine profile updater to handle such cases. for gcc/ChangeLog * tree-ssa-ifcombine.cc (known_succ_p): New. (update_profile_after_ifcombine): Handle noncontiguous blocks. --- gcc/tree-ssa-ifco

[PATCH #2/7] drop redundant ifcombine_ifandif parm (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
In preparation to changes that may modify both inner and outer conditions in ifcombine, drop the redundant parameter result_inv, that is always identical to inner_inv. for gcc/ChangeLog * tree-ssa-ifcombine.cc (ifcombine_ifandif): Drop redundant result_inv parm. Adjust all ca

[PATCH #1/7] allow vuses in ifcombine blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
Disallowing vuses in blocks for ifcombine is too strict, and it prevents usefully moving fold_truth_andor into ifcombine. That tree-level folder has long ifcombined loads, absent other relevant side effects. for gcc/ChangeLog * tree-ssa-ifcombine.c (bb_no_side_effects_p): Allow vuses

Re: [PATCH] fold fold_truth_andor field merging into ifcombine

2024-10-25 Thread Alexandre Oliva
On Oct 22, 2024, Richard Biener wrote: > On Mon, Oct 21, 2024 at 4:30 AM Alexandre Oliva wrote: >> >> On Oct 10, 2024, Richard Biener wrote: >> >> > As you special-case hard register uses, do we want to ever make >> > hard-register >> > uses or defs unconditional? I'll note that on GIMPLE h

[PATCH #0/7] noncontiguous ifcombine patchset (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
I've just posted 7 patches related with the implementation of noncontiguous ifcombine. They've been regstrapped together on x86_64-linux-gnu, and each patch has been tested to build on top of the previous on. Patches #1, #2 and #3 are preparatory patches that stand on their own. Patches #4, #5 a

Re: [PATCH] fold fold_truth_andor field merging into ifcombine

2024-10-22 Thread Richard Biener
On Mon, Oct 21, 2024 at 4:30 AM Alexandre Oliva wrote: > > On Oct 10, 2024, Richard Biener wrote: > > > Thanks for working on this. There's #if 0 portions in the patch - did you > > send the correct version? > > 'fraid so. Sorry, I'd forgotten about that bit. Long story (not so) > short, this

Re: [PATCH] fold fold_truth_andor field merging into ifcombine

2024-10-20 Thread Alexandre Oliva
On Oct 10, 2024, Richard Biener wrote: > Thanks for working on this. There's #if 0 portions in the patch - did you > send the correct version? 'fraid so. Sorry, I'd forgotten about that bit. Long story (not so) short, this patch is a bit of a frankenstein monster: there's a large portion from

Re: [PATCH] fold fold_truth_andor field merging into ifcombine was: [PATCH] assorted improvements for fold_truth_andor_1)

2024-10-10 Thread Richard Biener
On Thu, Sep 26, 2024 at 10:49 AM Alexandre Oliva wrote: > > > This patch introduces various improvements to the logic that merges > field compares, moving it into ifcombine. > > Before the patch, we could merge: > > (a.x1 EQNE b.x1) ANDOR (a.y1 EQNE b.y1) > > into something like: > > (((type

[PATCH] fold fold_truth_andor field merging into ifcombine was: [PATCH] assorted improvements for fold_truth_andor_1)

2024-09-26 Thread Alexandre Oliva
This patch introduces various improvements to the logic that merges field compares, moving it into ifcombine. Before the patch, we could merge: (a.x1 EQNE b.x1) ANDOR (a.y1 EQNE b.y1) into something like: (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK) if both of A's fields li