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

    <tr>
        <th>Summary</th>
        <td>
            Clang hang at -O1 on x86_64-linux_gnu (a recent regression in InstCombinePass)
        </td>
    </tr>

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

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

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

<pre>
    This looks like a recent regression.
Clang would hang at -O1 on the following test case. `opt-bisect-limit` suggests that the issue might be in `InstCombinePass`.

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

```console
% cat a.c
int g_3, g_637;
int foo(unsigned x, unsigned n) { return x << n | x >> (32 - n); }
int func_1() {
  int l_26;
  g_3 = 5;
  for (;; g_3 -= 1) {
 int l_4;
    for (; l_26; l_26 -= 1) {
      long l_2068;
 g_637 = 0;
      for (; g_637 <= 6;)
        for (;;) {
 int ij;
          if ((char)(foo(g_3, 2) + g_3))
            break;
 return 0;
        }
    }
  }
}
int main() {}
%
% clang-tk -O1 a.c
Killed
% clang-tk -v
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 46333f71f8e0d6444a9b2c9e063aedb83ebb9735)
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/10
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
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VV2L4zYX_jXKzcFGlhx_XPhiklkvL-9FC10ovQqyfWJrR5GCJM-k_fVFsifJZIdCYWsCsY-e8-h86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