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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
TER doesn't cross calls these days, it's really sinking doing this.

I think given the schedule of instructions inside a BB on GIMPLE is somewhat
arbitrary sinking should always sink to the beginning of the basic block.

Note sinking also pushes things downward to post-dominating blocks, so for
the slightly modified testcase:

void bar();
int j, x;
void foo(int a, int b, int c, int d, int e, int f)
{
  int l;
  l = a + b + c + d +e + f;
  if (a != 5)
    {
      bar();
      if (b != 3)
        x = 3;
      else
        x = 5;
      j = l;
    }
}

the trick with the start of the BB wouldn't work as it crosses the if (b != 3)
diamond as well.

I suppose it should get some register pressure modeling here (sinking a
load with no SSA dependencies as far as possible is good, but when SSA
dependencies are involved the live-in of the sunk stmt group matters).

The interesting part is also why RTL scheduling doesn't rectify things
here?

Reply via email to