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

            Bug ID: 116689
           Summary: Some simple scheduling to reduce register presure
                    should be done on the gimple level
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
int h(void);
int h1(void);

int f(int a, int b, int d)
{
  int c = d > 0 ? d : -d;
  if (a < 0)
  {
        a = h();
  }
  else
  {
        a = h1();
  }
  return a + c + d;
}
```

Right now with -O2, we don't move (sink?) the assignment of c past the
conditional even though it is not used in the conditional and would reduce the
life range of c and reduce the register pressure by only have 2 variables
across the calls. If we have `a + c` for the return then sinking the assignment
of c does not make a difference.

Reply via email to