https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128385
Bug ID: 128385
Summary: pre/hoisting does not take into account eq/ne
condition in some cases
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 *b, int *c)
{
if (a == b) return *a + *c;
return *b + *c;
}
```
This should be optimized in PRE but it takes until phiopt4 to optimize it. The
original code in the upstream LLVM issue report is able to optimize at PRE due
to dom but turning off dom, pre does not detect it and only takes until phiopt4
to optimize it (only on the trunk due to load factoring).