<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76043>76043</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
missed optimization: Optimization based on the first of the two conditions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Test case from gcc testsuite:
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-11.c
```cpp
int f(int a, int b, int c)
{
if (a == 0 && b > c)
return 0;
return a;
}
int g(int a, int b, int c)
{
if (a == 42 && b > c)
return 42;
return a;
}
int h(int a, int b, int c, int d)
{
if (a == d && b > c)
return d;
return a;
}
```
https://godbolt.org/z/hd8Pb116n
Any of these functions can be optimized to a function which returns `a`. I feel like there may be a duplicate of this issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklM-OmzAQxp9muIyCzJhAcuCQbYrUU3voC_gfwV3AyDaNdp--MiS7e6h2t6oUyTNfmJmfP2xECPYyGdPA_gH250wssXe-edwJ7901ZNLpp-anCRGVCAY770a8KIXRhBgWGw3wE7AzsFMf4xxSRi1Qe7GxX2Su3JgSpXaj9d75LQFq5eAkUDuKEM2r-tp1VXJ9SaI3ZheCAGrn3u7cHHdFkattKlRs-6l53hQ7ReyADmkVQF8wBfIeKKDjrbJ-2AJE2yHQQSDwM_AzMgSqgCqUCPzrmxJE9CYufkIG_F59U8SLAvX5FrzwXP6Lp6SPgUr6N6L-PaIt0J9A0x-T6U-B3V_jX8-S09INMXc-HYdnoLbXhx-yKKrp7bZO0xO6DmNv0kFdJhWtmwIqMaE06OZoR_tsNEaH4uV_vPZW9TeygFAxARXL8Rt2xgw42EeTOnqDo3hKfQTqZR6sEtFs02xAG8Ji8kw3XB_5UWSmKWrGWb1nJcv6RoljsTeqOrB9fay0ZKqUHa-LveJlcTiKzDbEiBdErCDi5TEnZYjVvOBUdMW-k1AyMwo75MPwe0w-ZOvIpq5YybNBSDOE9QYTTea68QBRutC-STU7uVwClGywIYbXLtHGwTSjDcHou0Mi2QL8hN_f5CjF-siUzMDO-hBvXmO8OlRu0na1O1v80LzzKUijb8tu9u6XURGoXYEDULtu6E8AAAD__3EIWMk">