https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126877
Bug ID: 126877
Summary: a==b imples (a+b)&1 is known to 0
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: easyhack, missed-optimization, TREE
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Blocks: 85316
Target Milestone: ---
Take:
```
signed f(signed a, signed b)
{
if (a == b)
{
signed c = a + b;
return c&1;
}
return 1;
}
```
This should optimize to return a == b. which it does on the RTL level.
A operator_plus::op1_op2_relation_effect needs to be implemented though the
range that is being intersection with is one with a bitmask/value rather than
zero/nonegative (etc.).
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases