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

    <tr>
        <th>Summary</th>
        <td>
            Wrong code at -O1 on x86_64_gnu_linux
        </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>
    For the following code, clang trunk at -O1 generated binary times out. This seems to be a quite recent regression since Clang-16 works fine.
`opt-bisect-limit` suggests the issue might be in `Loop Strength Reduction on loop`
Compiler explorer: https://godbolt.org/z/WzoWvE4f5

```console
$ clang-tk -O0 a.c && ./a.out
$
$ clang-tk -O1 a.c && ./a.out
Killed - processing time exceeded
$
$ clang-tk -v
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 5902bb9584d686789a80005b35de1b2c2e2ce0b4)
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
$
$ cat a.c
int a, b;
int c(int d) {
  if (d & 1)
    return d + 1;
  return d;
}
int main() {
  b = 1;
 for (; c(b + 67) - 67 >= 0; b--)
    a ^= 6;
}
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU1v4zYQ_TX0ZSCBoixKPuiQOKuiaIEFugvkGFDkWGJDkS4_kuz--oKyY3fTIkCBLGBAxnDmvccZ8lGEoCeL2JPmljR3G5Hi7HwfZuGKOYnC6M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