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

            Bug ID: 111827
           Summary: `a > b ? ~a : ~b` is sometimes not detected until
                    phiopt4 (or not at all)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
int f(int a, int b, int c)
{
        int at = ~a;
        int bt = ~b;
        int ct = ~c;
        int t = a < b ? at : bt;
        return t;        
}
```

This takes until phiopt4 (after sink) to detect ~MIN_EXPR.
Note if at is used more than once like in PR 67438, it is not detected at all
which is why the main reason `~X op ~Y` patterns have a single_use on them.

Reply via email to