[Bug tree-optimization/126829] New: a > CST && (unsigned)a > CST is not optimized to (unsigned)a > CST until reassociation

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

            Bug ID: 126829
           Summary: a > CST && (unsigned)a > CST is not optimized to
                    (unsigned)a > CST until reassociation
           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:
```
int f(int a)
{
    int t = a <= 9;
    int t1 = a >= 0 && a <= 9;
    return t & t1;
}
int g(int a)
{
    int t = a <= 9;
    int t1 = a >= 0 && a <= 9;
    return t | t1;
}
```

Only reassociation optimizes these two. But we should be able to optimize these
in match too. Which should allow for ifcombine to optimize these and tail merge
to optimize them (via r17-1845-g23b6a9a41a5c05) even for `--param
logical-op-non-short-circuit=0` which does not do it currently.
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.