https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103429

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
So it's very funny what's happening here. iftoswitch pass is called for all
e.g.
f_dispatch_always_inline<10>, f_dispatch_always_inline<9> and so on until
f_dispatch_always_inline<5> which is converted to switch.
And then all early passes are called for f_dispatch_always_inline<4> which
include einline and we end up with:

__attribute__((always_inline))
void f_dispatch_always_inline<4> (int i)
{
  <bb 2> :
  if (i_2(D) == 4)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  f<4> ();
  goto <bb 11>; [INV]

  <bb 4> :
  switch (i_2(D)) <default: <L9> [16.67%], case 5: <L3> [16.67%], case 6: <L4>
[16.67%], case 7: <L5> [16.67%], case 8: <L6> [16.67%], case 9: <L7> [16.67%]>

  <bb 5> :
<L3>:
  f<5> ();
  goto <bb 11>; [100.00%]

  <bb 6> :
<L4>:
  f<6> ();
  goto <bb 11>; [100.00%]

  <bb 7> :
<L5>:
  f<7> ();
  goto <bb 11>; [100.00%]

  <bb 8> :
<L6>:
  f<8> ();
  goto <bb 11>; [100.00%]

  <bb 9> :
<L7>:
  f<9> ();

  <bb 11> :
<L9>:
  return;

}

which is a mixture of if and switch statements.

So what we basically need is if-to-switch hybrid support for if-else chain
combined with switches.

Reply via email to