Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-30 Thread Filip Kastl
On Tue 2024-07-30 14:34:54, Richard Biener wrote: > On Tue, 30 Jul 2024, Filip Kastl wrote: > > > > > > Ah, I see you fix those up. Then 2.) is left - the final block. Iff > > > > > the final block needs adjustment you know there was a path from > > > > > the default case to it which means one o

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Filip Kastl wrote: > > > > Ah, I see you fix those up. Then 2.) is left - the final block. Iff > > > > the final block needs adjustment you know there was a path from > > > > the default case to it which means one of its predecessors is dominated > > > > by the default case?

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-30 Thread Filip Kastl
> Meanwhile I'll look into source code of the rest of the switch conversion > pass. > Switch conversion pass inserts conditions similar to what I'm doing so someone > before me may have already solved how to properly fix dominators in this > situation. Oh nevermind. Switch conversion (gen_inboun

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-30 Thread Filip Kastl
> > > Ah, I see you fix those up. Then 2.) is left - the final block. Iff > > > the final block needs adjustment you know there was a path from > > > the default case to it which means one of its predecessors is dominated > > > by the default case? In that case, adjust the dominator to cond_bb,

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-30 Thread Richard Biener
On Mon, 29 Jul 2024, Filip Kastl wrote: > Hi Richard, > > > > Sorry, I'm not sure if I understand. Are you suggesting something like > > > this? > > > > > > if (idom(default bb) == cond bb) > > > { > > > if (exists a path from default bb to final bb) > > > { > > > idom(final bb) = cond

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-29 Thread Filip Kastl
Hi Richard, > > Sorry, I'm not sure if I understand. Are you suggesting something like > > this? > > > > if (idom(default bb) == cond bb) > > { > > if (exists a path from default bb to final bb) > > { > > idom(final bb) = cond bb; > > } > > else > > { > > idom(final bb) = swit

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-26 Thread Richard Biener
On Thu, 18 Jul 2024, Filip Kastl wrote: > On Thu 2024-07-18 12:07:42, Richard Biener wrote: > > On Wed, 17 Jul 2024, Filip Kastl wrote: > > > > > + } > > > > > + > > > > > + vec v; > > > > > + v.create (1); > > > > > + v.quick_push (m_final_bb); > > > > > + iterate_fix_domi

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-18 Thread Filip Kastl
On Thu 2024-07-18 12:07:42, Richard Biener wrote: > On Wed, 17 Jul 2024, Filip Kastl wrote: > > > > + } > > > > + > > > > + vec v; > > > > + v.create (1); > > > > + v.quick_push (m_final_bb); > > > > + iterate_fix_dominators (CDI_DOMINATORS, v, true); > > > > > > The fina

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-18 Thread Richard Biener
On Wed, 17 Jul 2024, Filip Kastl wrote: > Hi, > > This is the second version of my patch introducing "exponential index > transformation" to the switch conversion pass. See the version 1 mail here: > > https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653120.html > > > Changes made > ---

[PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-17 Thread Filip Kastl
Hi, This is the second version of my patch introducing "exponential index transformation" to the switch conversion pass. See the version 1 mail here: https://gcc.gnu.org/pipermail/gcc-patches/2024-May/653120.html Changes made In this version I addressed the following comments: -