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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] (m+m)/(m) is not optimized
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          ZY546
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/Y84oh497E

```cpp
int m, n;
void func(int a){

    m=a+a+a;
    n=(m+m)/(m);
}
```
We note that the expression `(m+m)/m` is optimized to `2` if the number of a in the expression assigned to m is 2ⁿ, otherwise it is not optimized.

proof:
https://alive2.llvm.org/ce/z/y9amEc
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUk1vnDAQ_TXDxcoKD4Y1Bw4hLFJ_QZXebGwWV9hG2Gya_PrK7KZJtpH4sGfmvRnNeyIEc3ZaN1C2UHaZ2OLk1-bXc8mqTHr12kwxLgGKR8AesD97Jf0cD349A_ZvgP0zZ35i9fEEeQf54-1b5ddnWJZrxLhILOATcVC019DFG0XGzQ2APKUFYA3H9jMPIYRYKDoB2F7fd3DKOCg6QG4BW5uwaUK-n96r4NjdDXS9_tTE-ahJnEQkcdJE_1lWHYLxjqSiL6QWqpyYQPwSjTVvWpHoUxXu8XHHu81KvRI_EkGMu6e8bXkH2kSFcELgFNo-rcTHSa8vJmhiYso6Hz-aHT7vY1m9H5MY--2rNGI2F42Heb7YmzyDvmn0Wgt7GjLVFKouapHphlZ1zTnNyyKbmnrkqlSylkeuyiGXhaKC0nKsFRtKxVlmGsyxoJQWtEiYA2MV0ooLWbEqH4YKWK6tMPO_7pkJYdPNESll2SyknsNuMUSnX8ieBMTkuLVJmAe5nQOwfDYhhg-WaOK8e_OHC_HJW2mchrIj36r-3-qybZ3v_WvitMnD4C1gn9rcfg_L6n_rIQL2-3ABsN-H_xsAAP__yuLq8g">