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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] (a+a)/a is not optimized with limiting a>10 && a<20
        </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>
    Test code:
https://godbolt.org/z/4sEWEEbvT
```c
unsigned n1,n2;
void func1(unsigned a){
    n1=a+a;
    if(a>10&&a<20){
 n2=(a+a)/a;
    }
}
```
Maybe `InstCombine` should optimize it to `n2=2`.
But clang 17.0.1 -O3:
```asm
func1(unsigned int): # @func1(unsigned int)
        lea     eax, [rdi + rdi]
        mov     dword ptr [rip + n1], eax
        lea     ecx, [rdi - 11]
        cmp     ecx, 8
        ja      .LBB0_2
 xor     edx, edx
        div     edi
        mov     dword ptr [rip + n2], eax
.LBB0_2:                                # %if.end
 ret
```

A proof: https://alive2.llvm.org/ce/z/y_QsEw
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2PozgQ_TXFpRRkCnDgwCEkQVppV6uVWlrNXFoGm8QtwBE2SXf_-hEfzXT64zAoSsWu9-pVOTwLa_WpUyqDOIf44InBnU2f_fwRR9wrjXzJHpR1WBmpINwBOwDbnZ272HFFBVBxMrI0jfNNfwIqXoGKyB7_Px7L68MMB87mTzWvh26SlNgFQPuOIMznxNVoifXQVQFQsqIEUArbBYKIIy08CKBcrMxxW9dAiYDwGDAgDsQFhHtid-xR7DDBRjalQMV9EdgelqbXH2_dz8t_xEupEDj7q7Nub9pSdwo4Q3s2QyPRXJxu9atC7dCZETdJEnDmzwXywWHViO6EwdZnfoCbf8P1ZFcxYdt559Nx6M6NjYc7BAoRIvYdYp1pfBolpqjEM9AeIc57qREox15qiA_36NZcpyhvppd4cf1E0JeJ0AUjnvZTra9FqvciGwyCTwpVe3kPTe6zT3Md9P_Oc_ZIS_LZ9DNHTpwx3LGkvi55_Sfj0Mdx3lTDtcB3z_QPUKxrX3Vy0eyV-_LFmb93eOmNqcfa9y4Sjb4q8pvm2i5OqtRip5fH_-zx5skslGmYCk9lAU85j5M0Ju-ciaCMax5vFVHA40jWEUso3spQVYypOPF0RozCgLEt4ywNyE8oLWXCRcSiOixrARFTrdDNqu5paweV8STiW68RpWrsdD8QdeqGUxJoPDevz0bOphxOFiLWaOvs7ypOu2a6WN57JT7gBwOittgZt3pH4k27Mza61U53J5w9jbOpcXa1N_RN9uEe0u48lH5lWqBi7GEJm0tvnlTlgIqpcwtUTJP9CgAA__9LiFgR">