[Bug tree-optimization/126762] New: missing usatadd due to pre

"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=126762

            Bug ID: 126762
           Summary: missing usatadd due to pre
           Product: gcc
           Version: 17.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:
```
unsigned f(unsigned a, unsigned cst)
{
    unsigned add;
    if (__builtin_add_overflow (a, cst, &add))
      add = -1u;
    add -= 4;
    return add;
}
```

This should be recognized as `usatadd(a,cst) - 4`. But it is not because we
recongize sat add late after pre happens.
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.