<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/71792>71792</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Simplification Comparison for `(a | b) ? (a ^ b) : (a & b)` etc. (Clang13 vs Clang trunk)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    Consider the following six functions.
https://godbolt.org/z/cTsd43jhh
```cpp
bool test1(bool a, bool b)
{
    return (a | b) ? (a ^ b) : (a & b);
}

bool test2(bool a, bool b)
{
    return (a | b) ? (a & b) : (a ^ b);
}

bool test3(bool a, bool b)
{
    return (a & b) ? (a | b) : (a ^ b);
}

bool test4(bool a, bool b)
{
    return (a & b) ? (a ^ b) : (a | b);
}

bool test5(bool a, bool b)
{
 return (a ^ b) ? (a | b) : (a & b);
}

bool test6(bool a, bool b)
{
    return (a ^ b) ? (a & b) : (a | b);
}
```

Clang13 can simplify four of these, `test1`, `test2`, `test3` and `test4`, while Clang trunk cannot. Neither Clang13 nor Clang trunk can simplify `test5` and `test6`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslM1uqzwQhq9m2IyKzDiGsGDRph_Lb3PODRgwwa1jR7ZpT8_VH_ETJW1U9UeVIsUzDPM-HuxXhqD3VqkKxB2I-0SOcXC-eryR3rvnkDSue6l2zgbdKY9xUNg7Y9yztnsM-g_2o22jdjakwO6B3Q4xHgPwW6AaqN67rnEmps7vgeq_QHX7O3Qb_jAMSznkbPm1x-OSaZwzGFWIGdB2DiTQDudVA1Su7xV3ywIR0as4eotAW4lQ7OYyBF6vGfHfKXO7ZihfWvG7U7f7dfEagX4KYRW8QFihPkTg30M4C9ZXUF9F2PwUwvWHWKE-RBCfQ3ilf1Z7fwSfPQj590ZwjXB9EN4fwelqXBLtjLT7jGMrLQZ9OBrdv2DvRo-un25nUBMg5Gy5QTm7COl1yCFnKG13ijfr4-dBG4WzEEY_2sdJzLqY4v9Kx0F5PEFY59_WnaHWruKNSg45S5Ou4l3JS5moKsvLUlBRZCIZKkYbvi1lW_ZCliXvm150MtsqyVWXdUokuiJGPMtYmWUsE5tUsEI1ueh6LnKSXQ8bpg5Sm9SYp8PkO4kOYVRVkRUlJUY2yoTZ64jaCR2IJtvz1VR_04z7ABtmdIjh3CHqaFT1a9mZbuXkd7hzh6P0OjiLvfM4D--r_pMzVLFNp-xppk_hcqRAZTJ6U71xVR2HsUlbdwCqJ8r17-bo3YNqI1A9bzoA1fO-_wUAAP__Uh-b1w">