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

    <tr>
        <th>Summary</th>
        <td>
            else branch can be optimized from the conditions that preceding if(condition) and else-if(condition) imply
        </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>
    Consider the following example.
https://godbolt.org/z/Kx6YGsYen
```cpp
int foo(int a, int b) {
  if (a + b)
    return 0;
  else if (a)
    return a;
 else
    return b;
}

int bar(int a, int b) {
  if (a + b)
 return 0;
  else
    return a;
}
```

The variable `b` in the else branch in the function `foo` can be found to be 0 (= `a`) from the conditions that preceding `if (a + b)` and `else if (a)` imply.


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU81u2zwQfJrVhbBBrWzaOuiQxNB3-K695MiftcWWIgWSyt_TF5RjJ4jboiggQIud4XJ2litTsidP1MH2HraHSs55CLH7sZIxhudUqWBeu4fgkzUUWR6IHYNz4dn6E6MXOU6O1sAPwO-GnKcEzR1gD9ifglHB5XWIJ8D-DbD__0U8_pceyZ_pIPj509N0zlif2TEEwH2JJOADK4ECbBns7s8kxuyRAe4lA7xfsEuesUh5jp5xaK5kcokuJ37FlR_cQr3B1RWH3eE9uIpVMv6j2N8o_YO8j-svvn1W820g9iSjlcoRA8EVCM6sX-a1WKCi9Hq4pI6z19kGX6jFccGZlp6pMtzZG5ZDiXmRDs2hsGS5EFt2jGFcSujgjS01EsuDzGyKpMmUVwGC33QtOJPeFOjrQIrOcXKv68_tVKZrTNu0sqKuFm0rENsWq6Hb1srs9wK3XGyk4LudEVoK3DQ1UWtMU9kOOTZ1XfO6wXaL62a7EbLRSmtZi1q1sOE0SuvWzj2N5XVWNqWZul3dbnjlpCKXll1A9PTMFhAQy2rErpxZqfmUYMOdTTl9VMk2O-o-e_3uaJiyHe0bmb_xzh4B91e4GF5sK1VXt9DiWzVH131ZPZuHWa11GAH7IvD9t5pi-E46A_ZLWwmwX9r-GQAA___3ii_T">