[Bug tree-optimization/126528] New: Another missing min/max detection (sign change)

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126528

            Bug ID: 126528
           Summary: Another missing min/max detection (sign change)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
unsigned
smax (unsigned a)
{
  if (((signed) a) > 10)
    return a;
  return 10;
}

signed
umax (signed a)
{
  if (((unsigned) a) > 10)
    return a;
  return 10;
}
```

These are not detected in match so phiopt does not detect it.
Note the old phiopt minmax optimization code didn't detect it either.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.