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

            Bug ID: 126027
           Summary: `if (t == CST) t = CST;` is should be handled by SCCVN
           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
            Blocks: 126010
  Target Milestone: ---

Take:
```
int t = 0;
void
g (int t1)
{
  if (t == t1)
    t = t1;
}
```

Currently only DOM is able to remove the `t = 0;` statement.
I would have thought SCCVN/FRE should do this too.
As it would seem like the perfect place for it.

I assume we are not using the predicates in visit_reference_op_store but only
expressions_equal_p.
If I get some time I will look into doing that.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126010
[Bug 126010] [meta-bug] Remove DOM

Reply via email to