> On 03/10/2021 23:55 Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > > On 9/29/2021 7:08 PM, Luís Ferreira wrote: > > This patch allows the compiler to efficiently generate jump tables instead > > of > > using if-else-if. > > > > Signed-off-by: Luís Ferreira <cont...@lsferreira.net> > I'm not sure this is terribly useful. Compilers have the ability to > analyze the underlying code and make sensible decisions for how to > implement either form. So the right metric here is does this make the > code cleaner/easier to understand. With just 3 clauses it's hard (for > me) to make the case that it is considerably cleaner. >
I'd be inclined to agree here. FAOD, I put together a quick example of what difference this patch makes. Other than freely reordering the conditions, the answer is nothing. https://godbolt.org/z/nKjjv64zM Iain.