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

    <tr>
        <th>Summary</th>
        <td>
            Wrong code at -O3 on x86_64-linux_gnu (a recent regression in SimplifyCFGPass)
        </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 at -O3 produces the wrong code. `opt-bisect-limit` suggests that the issue might be in `SimplifyCFGPass`.

Compiler explorer: https://godbolt.org/z/4ecEWWr58

```console
% cat a.c
int a[5];
int b;
unsigned long c;
char d;
static int e = 531392347;
long f;
int g(int h) {
  if (h > 7)
    return 0;
 return h + 2 ? 5 & 1 << h : 48 & 1 << (h - 2);
}
int main() {
  for (; f >= 0; f--) {
    c = 0;
    for (; g(e) + e + 65535 + e + d - 1062850229 + c < 5; c++)
      a[c] = 1;
  }
  c = 0;
  int *i[] = {&b, &e};
}
%
% clang-tk -O0 a.c && ./a.out
%
% clang-tk -O3 a.c
% ./a.out
Killed (timeout)
%
% 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/8
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/eJy0VUuP2zYQ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