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

    <tr>
        <th>Summary</th>
        <td>
            Wrong code at -O1/2/3/s  on x86_64-linux_gnu
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          shao-hua-li
      </td>
    </tr>
</table>

<pre>
    ```console
% clang-tk -v
clang version 16.0.0 (https://github.com/llvm/llvm-project.git 70fdabff416936cbcb021ff2e7a7b8d520bc2d8c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
%
% clang-tk -O0 a.c && a./.out
0
% clang-tk -O1 a.c && a./.out
20
% clang-tk -O2 a.c && a./.out
20
% clang-tk -O3 a.c && a./.out
20
% clang-tk -Os a.c && a./.out
20
% cat a.c
int printf(const char *format, ...);
int a;
char b;
int main() {
    int c = (1 << a) - 1;
    b = 10 * c;
    printf("%d\n", b);
}
%
```

Compiler explorer: https://godbolt.org/z/d6WGWczax

`opt-bisect-limit` suggests the issue might be in `InstCombinePass`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVMlu2zAQ_RrpQkggKWs76JDYcNBTC7RAjgE3SWxo0hCp1M3Xdyg5zoIgaIAYtETO8vhmNDPcyb9dUuF1CWe9MyrBuwRfJbREwjA7ZOEeZQ-rcBGgBzV57SwiVY5zjBLajCEcfVKA0x7WoMM481y4AxyMeXh6ZcfJ_VYi5GCAatxLxvt-Q6q2qAQXHFPS91TVrOaNLCnmgspGJLRd7_7FpkEFuASdmuqu2mSzvbfuj82MtvMpG-x8thsnxSQ6OKlMtD46r0-r6pv1gRmj5E5PUQW8HiULDN5-ZM5o2ADrozYQYdwLPmsj1ZQ9SxegvZutRIJZqcFfoZvtFukVnAVIzRl89lMMXfOYFAGh7M_UnynTPSFfj3lO2U9lIN1Kfgm_7YXZYTZBRy9AyZPiOtngQ7V5c-VHRlBb7xXZd4xYLoBYBQu2cHnu5rCa4nc9yAce9H0X-nmX4vMu_n9dWIiWq0DbgI4TPHvoqdiNAYmRTQBz1bvpwEJCtyjP89gTkNGLD7ucFnP-Snlg2gIc-KCkPssR_KIOGBa72MAENltYAAV2GSIXiGjKFzMSW_0KiVeqC92EUohHJuXWLtst0HhBM6l3b7_909g5H9ciO_cZUqejcZNa2vTNdHGSOxNyNw2xf-Evq9ubW_HITi-RANgdQ8a1h3qEgj7oACLk52FQPngURoW09zOUsx7GgDgcLQKTOCSABtdW_WDegyRPVUeqqi5wWWOSyq6QbdGyNOhgVHc7OZiJAsYNgm8JJQmMIP59EacKQjAnXzbVHTRVOk-m-9zIhONCNk6lsqlpmY5dJTYKiNCWyKJWeNO2fdU0TV3SXpC2rFPDuDK-S8rrpNyluqOYUkIwIZQ2lORNX9e4klWJRVkp0kOHKigWk8eLY3rTqVs48HnwoDQa8vashNzowSr1hM_mMLqpi4M0G2cG4aYL5W7h-w_Wc9zx">