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

            Bug ID: 116648
           Summary: unswitch does not handle `if (a & b)` where a is
                    invariant
           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 ff(void);
int g(int a, int *tt, _Bool t1) {
  int c = 0;
  for (int e = 0; e < a; e++)
    {
      int h = 1;
      _Bool t2 = tt[e] != 0;
      if (t1 & t2)
        h = ff();
      c += h;
    }
  return c;
}
```


This could be unswitched as t1 is invariant but currently unswitch does not
handle it.

Reply via email to